--- functions.old 2012-11-18 12:43:59.000000000 -0500 +++ functions 2012-11-18 13:31:20.953480296 -0500 @@ -87,9 +87,16 @@ ############################################ # echoes 1 if prey trigger is set -# TODO: check if this works in other distros beside the Debian derivatives +# TODO: This should work on most major distros/derivatives, but as below, there's probably +# a better way of doing this. is_trigger_loaded(){ - find /etc/rc3.d/ | grep 'prey-trigger' > /dev/null && echo 1 + if [ -d "/etc/rc3.d" ]; then + find /etc/rc3.d/ | grep 'prey-trigger' > /dev/null && echo 1 + elif [ -d "/etc/init.d" ]; then + find /etc/init.d/ | grep 'prey-trigger' > /dev/null && echo 1 + elif [ -d "/etc/rc.d" ]; then + find /etc/rc.d/ | grep 'prey-trigger' > /dev/null && echo 1 + fi } reload_trigger(){ @@ -146,23 +153,26 @@ [ -n "$distro_name" ] && return 1 - local proc_version=$(cat /proc/version 2>&1) + proc_version=$(cat /proc/version) # todo: make this in a more efficient way - if [ -n `find_in $distro 'Ubuntu'` ]; then + if [[ "$proc_version" == *Ubuntu* ]]; then distro_name=ubuntu - elif [ -n `find_in $distro 'Debian'` ]; then + elif [[ "$proc_version" == *Debian* ]]; then distro_name=debian - elif [ -n `find_in $distro 'Redhat'` ]; then + elif [[ "$proc_version" == *Redhat* ]]; then distro_name=redhat - elif [ -n `find_in $distro 'Fedora'` ]; then + elif [[ "$proc_version" == *Fedora* ]]; then distro_name=fedora - elif [ -n `find_in $distro 'CentOS'` ]; then + elif [[ "$proc_version" == *CentOS* ]]; then distro_name=redhat - elif [ -n `find_in $distro 'SuSE'` ]; then + elif [[ "$proc_version" == *SuSE* ]]; then distro_name=suse - elif [ -n `find_in $distro 'ArchLinux'` ]; then - distro_name=arch +# elif [[ "$proc_version" == *ArchLinux* ]]; then +# distro_name=arch + # Hijack arch's distro name until upstream adds a gentoo distro + elif [[ "$proc_version" == *Gentoo* ]]; then + distro_name=arch else distro_name=linux fi