raboof / realtimeconfigquickscan

Linux configuration checker for systems to be used for real-time audio
GNU General Public License v2.0
260 stars 26 forks source link

Location of sysctl in SwappinessCheck.pm #3

Closed thorhop closed 9 years ago

thorhop commented 9 years ago

Hey there!

In SwappinessCheck.pm the command sysctl is called using an absolute path.

my $swappiness = `/sbin/sysctl vm.swappiness`;

Please consider not using an absolute path.

my $swappiness = `sysctl vm.swappiness`;

The reason being is that I'm using NixOS which doesn't place any of it's applications in /bin, /sbin, /usr/sbin, /usr/bin, /usr/share, etc. It gives each package it's own folder with their own /bin, /usr, /local, /etc structure and applications are either patched or binaries have their ELF RPATH modified to know where to look for applications and libraries. So looking for sysctl in /sbin will not work, as it's probably in /nix/store/loooonghash-packageName/ I don't know anything about perl and it might be better for it to have an absolute path for other systems to be compatible. We can certainly patch this in the packaging. But if it's not much of an inconvenience please consider changing it :)

Cheers :+1:

raboof commented 9 years ago

Hmm, the tricky thing is some distributions put sysctl in /sbin but don't put that on the PATH for normal users (even though it works fine for them...)

I guess we want to either run sysctl from the path or fall back to /sbin/sysctl. meh :).

thorhop commented 9 years ago

so an if statement then... something like...

var SYSCTLCMD
if [ -f /sbin/sysctl ];
then
   SYSCTLCMD="/sbin/sysctl"
else
   SYSCTLCMD="sysctl"
fi

my $swappiness = `${SYSCTLCMD} vm.swappiness`