snail.configure small fixes

This commit is contained in:
Kolan Sh 2012-04-07 12:42:28 -04:00
parent e97786e979
commit 0c5417a7c1
1 changed files with 43 additions and 27 deletions

View File

@ -1,38 +1,39 @@
#!/bin/bash #!/bin/bash
echo "Test for nVidia driver" echo "Test for acpi_call/vgaswitcheroo"
lsmod | grep '^nvidia ' &>/dev/null if [ -f /sys/kernel/debug/vgaswitcheroo/switch ]; then
[ 0 -ne $? ] && snail.nv_pwr_on && modprobe nvidia ; snail.nv_pwr_off echo "vgaswitcheroo is OK! ;-)"
if [ 0 -eq $? ]; then
echo "nVidia driver is OK! ;-)"
modprobe -r nvidia
else else
echo "You must install standart nVidia driver first!" if [ -f /proc/acpi/call ]; then
exit -1 echo "acpi_call is OK! ;-)"
fi
echo "Test for acpi_call module..."
lsmod | grep '^acpi_call ' &>/dev/null
if [ 0 -eq $? ]; then
echo "acpi_call is OK! ;-)"
else
modprobe acpi_call && lsmod | grep '^acpi_call ' &>/dev/null
if [ 0 -eq $? ]; then
modprobe -rf acpi_call
echo "Please configure acpi_call module for autoloading on system start and try again!"
exit -1
else else
echo "acpi_call kernel module not found, please install it!" modprobe acpi_call
exit -1 if [ -f /proc/acpi/call ]; then
echo "Warning: Please configure acpi_call module for autoloading on system startup!"
else
echo "No vgaswitcheroo/acpi_call found. Please configure/install one of them! ;-("
exit -1
fi
fi fi
fi fi
echo "Test for nVidia driver"
snail.nv_pwr_on && snail.nv_pwr_off
if [ 0 -eq $? ]; then
echo "nVidia driver is OK! ;-)"
else
echo "Test failed ;-("
echo "Probably you need to install standart nVidia driver or make a bug report..."
exit -1
fi
echo "Test for dmidecode utility..." echo "Test for dmidecode utility..."
dmidecode &>/dev/null which dmidecode &>/dev/null
if [ 0 -eq $? ]; then if [ 0 -eq $? ]; then
echo "dmidecode utility is OK! ;-)" echo "dmidecode utility is OK! ;-)"
else else
echo "Please install dmidecode and run the script as root again." echo "Please install dmidecode and run the script again."
exit -1
fi fi
echo "Detecting your distribution..." echo "Detecting your distribution..."
@ -59,7 +60,7 @@ elif [ -f /etc/arch-release ]; then
elif [ -f /etc/slackware_version ]; then elif [ -f /etc/slackware_version ]; then
DISTRIB_ID=slackware DISTRIB_ID=slackware
DISTRIB_DESCRIPTION=`cat /etc/slackware_version` DISTRIB_DESCRIPTION=`cat /etc/slackware_version`
elif [ `which lsb_release` ]; then elif [ `which lsb_release &>/dev/null` ]; then
DISTRIB_ID=`lsb_release | grep '^Distributor' | sed 's~[^:]*:~~' | tr 'A-Z' 'a-z'` DISTRIB_ID=`lsb_release | grep '^Distributor' | sed 's~[^:]*:~~' | tr 'A-Z' 'a-z'`
DISTRIB_DESCRIPTION=`lsb_release | grep '^Description' | sed 's~[^:]*:~~'` DISTRIB_DESCRIPTION=`lsb_release | grep '^Description' | sed 's~[^:]*:~~'`
DISTRIB_RELEASE=`lsb_release | grep '^Release' | sed 's~[^:]*:~~'` DISTRIB_RELEASE=`lsb_release | grep '^Release' | sed 's~[^:]*:~~'`
@ -69,6 +70,13 @@ elif [ -f /etc/os-release ]; then
DISTRIB_DESCRIPTION=`grep '^PRETTY_NAME=' /etc/os-release | cut -d'=' -f2` DISTRIB_DESCRIPTION=`grep '^PRETTY_NAME=' /etc/os-release | cut -d'=' -f2`
DISTRIB_RELEASE=`grep '^VERSION_ID=' /etc/os-release | cut -d'=' -f2` DISTRIB_RELEASE=`grep '^VERSION_ID=' /etc/os-release | cut -d'=' -f2`
DISTRIB_CODENAME=`grep '^NAME=' /etc/os-release | cut -d'=' -f2` DISTRIB_CODENAME=`grep '^NAME=' /etc/os-release | cut -d'=' -f2`
elif [ -f /etc/fedora-release ]; then
DISTRIB_ID=fedora
DISTRIB_DESCRIPTION=`cat /etc/fedora-release`
DISTRIB_RELEASE=${DISTRIB_DESCRIPTION% *}
DISTRIB_RELEASE=${DISTRIB_RELEASE##* }
DISTRIB_CODENAME=${DISTRIB_DESCRIPTION##*\(}
DISTRIB_CODENAME=${DISTRIB_CODENAME%%\)*}
else else
DISTRIB_DESCRIPTION=`cat /etc/*release* | head -n1` DISTRIB_DESCRIPTION=`cat /etc/*release* | head -n1`
DISTRIB_ID=`echo ${DISTRIB_DESCRIPTION%% *} | tr 'A-Z' 'a-z'` DISTRIB_ID=`echo ${DISTRIB_DESCRIPTION%% *} | tr 'A-Z' 'a-z'`
@ -82,7 +90,7 @@ echo "DISTRIB_DESCRIPTION=$DISTRIB_DESCRIPTION"
echo "DISTRIB_RELEASE=$DISTRIB_RELEASE" echo "DISTRIB_RELEASE=$DISTRIB_RELEASE"
echo "DISTRIB_CODENAME=$DISTRIB_CODENAME" echo "DISTRIB_CODENAME=$DISTRIB_CODENAME"
echo "Copying system init scripts to /etc/init.d and start snail-watcher" echo "Copying system init scripts (SysV/OpenRC/Systemd) and start snail-watcher"
SNAIL_INIT_D_PATH=/usr/share/snail/init.d SNAIL_INIT_D_PATH=/usr/share/snail/init.d
case "$DISTRIB_ID" in case "$DISTRIB_ID" in
"gentoo") "gentoo")
@ -185,7 +193,15 @@ case "$DISTRIB_ID" in
;; ;;
"fedora") "fedora")
echo "" case "$DISTRIB_CODENAME" in
Verne)
;;
*)
echo "No rules for Your distribution. Please make a bug report."
exit -1
;;
esac
;; ;;
*) *)