From 1d7b91becd97c6b3325feb92d6b0aec31de14cfd Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Fri, 23 Mar 2012 19:56:14 +0400 Subject: [PATCH 1/6] Follow General Conventions for Makefiles. --- Makefile | 31 ++++++++++++++++ {usr/local/bin => bin}/nvrun | 0 {usr/local/bin => bin}/snail.vglrun | 0 {usr/local/lib64 => lib64}/libdlfaker.so | Bin {usr/local/lib64 => lib64}/libgefaker.so | Bin {usr/local/lib64 => lib64}/librrfaker.so | Bin {usr/local/lib64 => lib64}/snail/extensions | 0 .../lib64 => lib64}/snail/modules/drivers | 0 .../lib64 => lib64}/snail/modules/extensions | 0 .../lib64 => lib64}/snail/modules/libfb.so | 0 .../lib64 => lib64}/snail/modules/libwfb.so | 0 snail.install => sbin/snail.configure | 4 +-- {usr/local/sbin => sbin}/snail.nv_pwr_off | 0 {usr/local/sbin => sbin}/snail.nv_pwr_on | 0 {usr/local/sbin => sbin}/snail.watcher.sh | 0 snail.uninstall | 34 ------------------ 16 files changed, 32 insertions(+), 37 deletions(-) create mode 100644 Makefile rename {usr/local/bin => bin}/nvrun (100%) rename {usr/local/bin => bin}/snail.vglrun (100%) rename {usr/local/lib64 => lib64}/libdlfaker.so (100%) rename {usr/local/lib64 => lib64}/libgefaker.so (100%) rename {usr/local/lib64 => lib64}/librrfaker.so (100%) rename {usr/local/lib64 => lib64}/snail/extensions (100%) rename {usr/local/lib64 => lib64}/snail/modules/drivers (100%) rename {usr/local/lib64 => lib64}/snail/modules/extensions (100%) rename {usr/local/lib64 => lib64}/snail/modules/libfb.so (100%) rename {usr/local/lib64 => lib64}/snail/modules/libwfb.so (100%) rename snail.install => sbin/snail.configure (97%) rename {usr/local/sbin => sbin}/snail.nv_pwr_off (100%) rename {usr/local/sbin => sbin}/snail.nv_pwr_on (100%) rename {usr/local/sbin => sbin}/snail.watcher.sh (100%) delete mode 100755 snail.uninstall diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..07d0f1e --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +SHELL = /bin/sh +PREFIX = /usr/local + +all: + +install: + install etc/X11/* /etc/X11 + install etc/init.d/* /etc/init.d + install bin/* ${PREFIX}/bin + install sbin/* ${PREFIX}/sbin + install lib64/*.so ${PREFIX}/lib64 + install -d ${PREFIX}/lib64/snail + ln -sf /usr/lib64/opengl/nvidia/extensions ${PREFIX}/lib64/snail/extensions + install -d ${PREFIX}/lib64/snail/modules + ln -sf /usr/lib64/xorg/modules/drivers ${PREFIX}/lib64/snail/modules/drivers + ln -sf /usr/lib64/xorg/modules/extensions ${PREFIX}/lib64/snail/modules/extensions + ln -sf /usr/lib64/xorg/modules/libfb.so ${PREFIX}/lib64/snail/modules/libfb.so + ln -sf /usr/lib64/xorg/modules/libwfb.so ${PREFIX}/lib64/snail/modules/libwfb.so + +uninstall: + rm -f /etc/X11/xorg.conf.*.snail + rm -f /etc/init.d/snail-* + rm -f ${PREFIX}/lib64/libdlfaker.so + rm -f ${PREFIX}/lib64/libgefaker.so + rm -f ${PREFIX}/lib64/librrfaker.so + rm -rf ${PREFIX}/lib64/snail + rm -f ${PREFIX}/bin/nvrun + rm -f ${PREFIX}/bin/snail.vglrun + rm -f ${PREFIX}/sbin/snail.nv_pwr_off + rm -f ${PREFIX}/sbin/snail.nv_pwr_on + rm -f ${PREFIX}/sbin/snail.watcher.sh diff --git a/usr/local/bin/nvrun b/bin/nvrun similarity index 100% rename from usr/local/bin/nvrun rename to bin/nvrun diff --git a/usr/local/bin/snail.vglrun b/bin/snail.vglrun similarity index 100% rename from usr/local/bin/snail.vglrun rename to bin/snail.vglrun diff --git a/usr/local/lib64/libdlfaker.so b/lib64/libdlfaker.so similarity index 100% rename from usr/local/lib64/libdlfaker.so rename to lib64/libdlfaker.so diff --git a/usr/local/lib64/libgefaker.so b/lib64/libgefaker.so similarity index 100% rename from usr/local/lib64/libgefaker.so rename to lib64/libgefaker.so diff --git a/usr/local/lib64/librrfaker.so b/lib64/librrfaker.so similarity index 100% rename from usr/local/lib64/librrfaker.so rename to lib64/librrfaker.so diff --git a/usr/local/lib64/snail/extensions b/lib64/snail/extensions similarity index 100% rename from usr/local/lib64/snail/extensions rename to lib64/snail/extensions diff --git a/usr/local/lib64/snail/modules/drivers b/lib64/snail/modules/drivers similarity index 100% rename from usr/local/lib64/snail/modules/drivers rename to lib64/snail/modules/drivers diff --git a/usr/local/lib64/snail/modules/extensions b/lib64/snail/modules/extensions similarity index 100% rename from usr/local/lib64/snail/modules/extensions rename to lib64/snail/modules/extensions diff --git a/usr/local/lib64/snail/modules/libfb.so b/lib64/snail/modules/libfb.so similarity index 100% rename from usr/local/lib64/snail/modules/libfb.so rename to lib64/snail/modules/libfb.so diff --git a/usr/local/lib64/snail/modules/libwfb.so b/lib64/snail/modules/libwfb.so similarity index 100% rename from usr/local/lib64/snail/modules/libwfb.so rename to lib64/snail/modules/libwfb.so diff --git a/snail.install b/sbin/snail.configure similarity index 97% rename from snail.install rename to sbin/snail.configure index 7c3d665..2550f16 100755 --- a/snail.install +++ b/sbin/snail.configure @@ -1,6 +1,4 @@ -#!/bin/sh - -PREFIX=/usr/local +#!/bin/bash # Tell the system to use xorg-x11 OpenGL libraries and nVidia GLX extensions eselect opengl set xorg-x11 diff --git a/usr/local/sbin/snail.nv_pwr_off b/sbin/snail.nv_pwr_off similarity index 100% rename from usr/local/sbin/snail.nv_pwr_off rename to sbin/snail.nv_pwr_off diff --git a/usr/local/sbin/snail.nv_pwr_on b/sbin/snail.nv_pwr_on similarity index 100% rename from usr/local/sbin/snail.nv_pwr_on rename to sbin/snail.nv_pwr_on diff --git a/usr/local/sbin/snail.watcher.sh b/sbin/snail.watcher.sh similarity index 100% rename from usr/local/sbin/snail.watcher.sh rename to sbin/snail.watcher.sh diff --git a/snail.uninstall b/snail.uninstall deleted file mode 100755 index b3bcd02..0000000 --- a/snail.uninstall +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# Tell the system to use both xorg-x11 OpenGL and GLX libraries -eselect opengl set xorg-x11 - -# Restore xorg.conf.* files from backups -[ -f /etc/X11/xorg.conf.snail-bkp ] && rm -f /etc/X11/xorg.conf && mv /etc/X11/xorg.conf.snail-bkp /etc/X11/xorg.conf -[ -f /etc/X11/xorg.conf.intel.snail-bkp ] && rm -f /etc/X11/xorg.conf.intel && mv /etc/X11/xorg.conf.intel.snail-bkp /etc/X11/xorg.conf.intel -[ -f /etc/X11/xorg.conf.nvidia.snail-bkp ] && rm -f /etc/X11/xorg.conf.nvidia && mv /etc/X11/xorg.conf.nvidia.snail-bkp /etc/X11/xorg.conf.nvidia - -# Remove backup files -for f in "" .intel .nvidia ; do - rm -f /etc/X11/xorg.conf${f}.snail-bkp -done - -# Remove all Snail files -rm -f /etc/X11/xorg.conf.intel.snail -rm -f /etc/X11/xorg.conf.nvidia -rm -f /etc/init.d/snail-watcher -rm -f /etc/init.d/snail-xserver -rm -f /usr/local/bin/nvrun -rm -f /usr/local/bin/snail.vglrun -rm -f /usr/local/lib64/libdlfaker.so -rm -f /usr/local/lib64/libgefaker.so -rm -f /usr/local/lib64/librrfaker.so -rm -f /usr/local/lib64/snail/extensions -rm -f /usr/local/lib64/snail/modules/drivers -rm -f /usr/local/lib64/snail/modules/extensions -rm -f /usr/local/lib64/snail/modules/libfb.so -rm -f /usr/local/lib64/snail/modules/libwfb.so -rmdir /usr/local/lib64/snail/modules 2>/dev/null -rm -f /usr/local/sbin/snail.nv_pwr_off -rm -f /usr/local/sbin/snail.nv_pwr_on -rm -f /usr/local/sbin/snail.watcher From 51358d7f5aa12e7e7489bf7752bd42e01b1380bc Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sat, 24 Mar 2012 00:51:23 +0400 Subject: [PATCH 2/6] snail.configure added --- Makefile | 2 +- etc/init.d/snail-watcher | 3 +- sbin/{snail.watcher.sh => snail-watcher.sh} | 0 sbin/snail.configure | 96 +++++++++++++++++++-- 4 files changed, 93 insertions(+), 8 deletions(-) rename sbin/{snail.watcher.sh => snail-watcher.sh} (100%) diff --git a/Makefile b/Makefile index 07d0f1e..e5e30fb 100644 --- a/Makefile +++ b/Makefile @@ -28,4 +28,4 @@ uninstall: rm -f ${PREFIX}/bin/snail.vglrun rm -f ${PREFIX}/sbin/snail.nv_pwr_off rm -f ${PREFIX}/sbin/snail.nv_pwr_on - rm -f ${PREFIX}/sbin/snail.watcher.sh + rm -f ${PREFIX}/sbin/snail-watcher.sh diff --git a/etc/init.d/snail-watcher b/etc/init.d/snail-watcher index 1ccdf30..d81ba7d 100755 --- a/etc/init.d/snail-watcher +++ b/etc/init.d/snail-watcher @@ -1,9 +1,8 @@ #!/sbin/runscript -DAEMON="/usr/local/sbin/snail.watcher.sh" +DAEMON="/usr/local/sbin/snail-watcher.sh" DAEMON_ARGS="" PIDFILE=/var/run/snail.pid -#PATH=/usr/local/sbin:/usr/local/bin:$PATH PATH=$PATH:/usr/local/bin depend() { diff --git a/sbin/snail.watcher.sh b/sbin/snail-watcher.sh similarity index 100% rename from sbin/snail.watcher.sh rename to sbin/snail-watcher.sh diff --git a/sbin/snail.configure b/sbin/snail.configure index 2550f16..a9398d4 100755 --- a/sbin/snail.configure +++ b/sbin/snail.configure @@ -1,10 +1,94 @@ #!/bin/bash -# Tell the system to use xorg-x11 OpenGL libraries and nVidia GLX extensions -eselect opengl set xorg-x11 -for arch in 32bit 64bit; do for chip in i915 i965 r300 r600 sw; do eselect mesa set $arch $chip classic &>/dev/null; done; done +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 + echo "acpi_call kernel module not found, please install it!" + exit -1 + fi +fi -# Create backups of original xorg.conf.* files and replacing with snail's versions +echo "Test for dmidecode utility..." +dmidecode &>/dev/null +if [ 0 -eq $? ]; then + echo "dmidecode utility is OK! ;-)" +else + echo "Please install dmidecode and run the script as root again." +fi + +echo "Detecting your distribution..." +DISTRIB_ID= +DISTRIB_DESCRIPTION= +DISTRIB_RELEASE= +DISTRIB_CODENAME= +if [ -f /etc/gentoo-release ]; then + DISTRIB_ID=gentoo + DISTRIB_DESCRIPTION=`cat /etc/gentoo-release` + DISTRIB_RELEASE=${DISTRIB_DESCRIPTION##* } + DISTRIB_CODENAME=gentoo +elif [ -f /etc/debian-version ]; then + DISTRIB_ID=debian + DISTRIB_CODENAME=`cut -d'/' /etc/debian-version -f1` +elif [ -f /etc/slax-version ]; then + DISTRIB_ID=slax + DISTRIB_DESCRIPTION=`cat /etc/slax-version` +elif [ -f /etc/arch-release ]; then + DISTRIB_ID=arch + DISTRIB_DESCRIPTION=`cat /etc/arch-release` +elif [ -f /etc/slackware-version ]; then + DISTRIB_ID=slackware + DISTRIB_DESCRIPTION=`cat /etc/slackware-version` +elif [ `which lsb_release` ]; then + DISTRIB_ID=`lsb_release | grep '^Distributor' | sed 's~[^:]*:~~' | tr 'A-Z' 'a-z'` + DISTRIB_DESCRIPTION=`lsb_release | grep '^Description' | sed 's~[^:]*:~~'` + DISTRIB_RELEASE=`lsb_release | grep '^Release' | sed 's~[^:]*:~~'` + DISTRIB_CODENAME=`lsb_release | grep '^Codename' | sed 's~[^:]*:~~'` +elif [ -f /etc/os-release ]; then + DISTRIB_ID=`grep '^ID=' /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_CODENAME=`grep '^NAME=' /etc/os-release | cut -d'=' -f2` +else + DISTRIB_DESCRIPTION=`cat /etc/*release* | head -n1` + DISTRIB_ID=`echo ${DISTRIB_DESCRIPTION%% *} | tr 'A-Z' 'a-z'` + DISTRIB_RELEASE=`echo ${DISTRIB_DESCRIPTION%% *} | sed 's~[^0-9]\+\([0-9\.]\+\).*~\1~'` + DISTRIB_CODENAME=$DISTRIB_ID +fi +[ "" == "$DISTRIB_ID" ] && echo 'GNU/Linux distribution not recognized, sorry! Please post a bug!' && exit -1 +echo 'Detected distribution:' +echo "DISTRIB_ID=$DISTRIB_ID" +echo "DISTRIB_DESCRIPTION=$DISTRIB_DESCRIPTION" +echo "DISTRIB_RELEASE=$DISTRIB_RELEASE" +echo "DISTRIB_CODENAME=$DISTRIB_CODENAME" + +echo "Configuring OpenGL libraries and nVidia GLX extensions" +if [ "gentoo" == "$DISTRIB_ID" ]; then + eselect opengl set xorg-x11 + for arch in 32bit 64bit; do + for chip in i915 i965 r300 r600 sw; do + eselect mesa set $arch $chip classic &>/dev/null; + done; + done + echo "Adding snail-watcher to default" + eselect rc delete snail-xserver boot default + eselect rc delete snail-watcher boot + eselect rc add snail-watcher default +elif [ "fedora" == "$DISTRIB_ID" ]; then + echo "" +else + echo "No rules for Your distribution. Please make a bug report." + exit -1 +fi + +echo "Creating backups of original xorg.conf.* files and replacing with snail's versions..." [[ -f /etc/X11/xorg.conf && ! -f /etc/X11/xorg.conf.snail-bkp ]] && mv /etc/X11/xorg.conf /etc/X11/xorg.conf.snail-bkp [[ -f /etc/X11/xorg.conf.intel && ! -f /etc/X11/xorg.conf.intel.snail-bkp ]] && mv /etc/X11/xorg.conf.intel /etc/X11/xorg.conf.intel.snail-bkp [[ -f /etc/X11/xorg.conf.nvidia && ! -f /etc/X11/xorg.conf.nvidia.snail-bkp ]] && mv /etc/X11/xorg.conf.nvidia /etc/X11/xorg.conf.nvidia.snail-bkp @@ -12,8 +96,10 @@ cp -f /etc/X11/xorg.conf.intel.snail /etc/X11/xorg.conf.intel cp -f /etc/X11/xorg.conf.nvidia.snail /etc/X11/xorg.conf.nvidia ln -sf xorg.conf.intel /etc/X11/xorg.conf -# Recognize BusID of both chips and set it in xorg.conf.* files +echo "Recognizing BusID of both chips and set it in xorg.conf.* files..." BusIDIntel="PCI:`lspci | grep VGA | grep Intel | cut -d" " -f1 | sed 's~\.~\:~g ; s~0\([0-9]\)~\1~g'`" BusIDNvidia="PCI:`lspci | grep VGA | grep nVidia | cut -d" " -f1 | sed 's~\.~\:~g ; s~0\([0-9]\)~\1~g'`" sed -i "s~BusIDIntel~$BusIDIntel~" /etc/X11/xorg.conf.intel sed -i "s~BusIDNvidia~$BusIDNvidia~" /etc/X11/xorg.conf.nvidia + +echo "`basename -- $0` is complete! ;-)" From 0283b8641d8409fe23da0604ce74dbc3f0fdfa5c Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sat, 24 Mar 2012 00:52:11 +0400 Subject: [PATCH 3/6] snail.configure added --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index e5e30fb..9099809 100644 --- a/Makefile +++ b/Makefile @@ -29,3 +29,4 @@ uninstall: rm -f ${PREFIX}/sbin/snail.nv_pwr_off rm -f ${PREFIX}/sbin/snail.nv_pwr_on rm -f ${PREFIX}/sbin/snail-watcher.sh + rm -f ${PREFIX}/sbin/snail.configure From 45eff031519d2015a6ad7b0a99a303b07769e324 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sat, 24 Mar 2012 01:36:51 +0400 Subject: [PATCH 4/6] Makefile fixed --- Makefile | 10 +++++----- etc/init.d/snail-xserver | 4 ++-- sbin/snail.configure | 2 ++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 9099809..2ed932b 100644 --- a/Makefile +++ b/Makefile @@ -10,12 +10,12 @@ install: install sbin/* ${PREFIX}/sbin install lib64/*.so ${PREFIX}/lib64 install -d ${PREFIX}/lib64/snail - ln -sf /usr/lib64/opengl/nvidia/extensions ${PREFIX}/lib64/snail/extensions + ln -sf /usr/lib64/opengl/nvidia/extensions ${PREFIX}/lib64/snail install -d ${PREFIX}/lib64/snail/modules - ln -sf /usr/lib64/xorg/modules/drivers ${PREFIX}/lib64/snail/modules/drivers - ln -sf /usr/lib64/xorg/modules/extensions ${PREFIX}/lib64/snail/modules/extensions - ln -sf /usr/lib64/xorg/modules/libfb.so ${PREFIX}/lib64/snail/modules/libfb.so - ln -sf /usr/lib64/xorg/modules/libwfb.so ${PREFIX}/lib64/snail/modules/libwfb.so + ln -sf /usr/lib64/xorg/modules/drivers ${PREFIX}/lib64/snail/modules + ln -sf /usr/lib64/xorg/modules/extensions ${PREFIX}/lib64/snail/modules + ln -sf /usr/lib64/xorg/modules/libfb.so ${PREFIX}/lib64/snail/modules + ln -sf /usr/lib64/xorg/modules/libwfb.so ${PREFIX}/lib64/snail/modules uninstall: rm -f /etc/X11/xorg.conf.*.snail diff --git a/etc/init.d/snail-xserver b/etc/init.d/snail-xserver index d258dd1..502fd4d 100755 --- a/etc/init.d/snail-xserver +++ b/etc/init.d/snail-xserver @@ -9,7 +9,7 @@ depend() { } start() { - ebegin "Starting bumblebee nVidia Optimus" + ebegin "Starting Snail nVidia Optimus" snail.nv_pwr_on || eend -1 ! ps -p `cat $PIDFILE 2>&1` > /dev/null 2>&1 || eend -1 export LD_LIBRARY_PATH=/usr/lib/opengl/nvidia/lib:/usr/lib/opengl/nvidia/lib @@ -26,7 +26,7 @@ start() { } stop() { - ebegin "Stopping bumblebee nVidia Optimus" + ebegin "Stopping Snail nVidia Optimus" kill `cat $PIDFILE 2>&1` > /dev/null 2>&1 snail.nv_pwr_off || eend -1 eend $result diff --git a/sbin/snail.configure b/sbin/snail.configure index a9398d4..a8fa442 100755 --- a/sbin/snail.configure +++ b/sbin/snail.configure @@ -81,6 +81,8 @@ if [ "gentoo" == "$DISTRIB_ID" ]; then eselect rc delete snail-xserver boot default eselect rc delete snail-watcher boot eselect rc add snail-watcher default + eselect rc stop snail-xserver + eselect rc start snail-watcher elif [ "fedora" == "$DISTRIB_ID" ]; then echo "" else From eb6e53db775b31f6c367d9c25c53956c8a9683a8 Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sat, 24 Mar 2012 01:46:21 +0400 Subject: [PATCH 5/6] Makefile fixed --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2ed932b..7fcc9e1 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ PREFIX = /usr/local all: install: - install etc/X11/* /etc/X11 + install --mode=644 etc/X11/* /etc/X11 install etc/init.d/* /etc/init.d install bin/* ${PREFIX}/bin install sbin/* ${PREFIX}/sbin From 5a79e109e03e64e95ecd700c21c46598b534a74c Mon Sep 17 00:00:00 2001 From: Kolan Sh Date: Sat, 24 Mar 2012 11:16:52 +0400 Subject: [PATCH 6/6] it works --- Makefile | 55 ++++++++++++++++++++++------------------ etc/init.d/snail-watcher | 2 +- etc/init.d/snail-xserver | 2 +- sbin/snail.configure | 13 +++++++++- snail-0.0.1.ebuild | 45 -------------------------------- snail-1.0.0.ebuild | 34 +++++++++++++++++++++++++ 6 files changed, 78 insertions(+), 73 deletions(-) delete mode 100644 snail-0.0.1.ebuild create mode 100644 snail-1.0.0.ebuild diff --git a/Makefile b/Makefile index 7fcc9e1..2b67ba4 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,37 @@ SHELL = /bin/sh -PREFIX = /usr/local +PREFIX = /usr all: install: - install --mode=644 etc/X11/* /etc/X11 - install etc/init.d/* /etc/init.d - install bin/* ${PREFIX}/bin - install sbin/* ${PREFIX}/sbin - install lib64/*.so ${PREFIX}/lib64 - install -d ${PREFIX}/lib64/snail - ln -sf /usr/lib64/opengl/nvidia/extensions ${PREFIX}/lib64/snail - install -d ${PREFIX}/lib64/snail/modules - ln -sf /usr/lib64/xorg/modules/drivers ${PREFIX}/lib64/snail/modules - ln -sf /usr/lib64/xorg/modules/extensions ${PREFIX}/lib64/snail/modules - ln -sf /usr/lib64/xorg/modules/libfb.so ${PREFIX}/lib64/snail/modules - ln -sf /usr/lib64/xorg/modules/libwfb.so ${PREFIX}/lib64/snail/modules + install -d ${DESTDIR}/etc/X11 + install --mode=644 etc/X11/* ${DESTDIR}/etc/X11 + install -d ${DESTDIR}/etc/init.d + install etc/init.d/* ${DESTDIR}/etc/init.d + install -d ${DESTDIR}/${PREFIX}/bin + install bin/* ${DESTDIR}/${PREFIX}/bin + install -d ${DESTDIR}/${PREFIX}/sbin + install sbin/* ${DESTDIR}/${PREFIX}/sbin + install -d ${DESTDIR}/${PREFIX}/lib64 + install lib64/*.so ${DESTDIR}/${PREFIX}/lib64 + install -d ${DESTDIR}/${PREFIX}/lib64/snail + ln -sf /usr/lib64/opengl/nvidia/extensions ${DESTDIR}/${PREFIX}/lib64/snail + install -d ${DESTDIR}/${PREFIX}/lib64/snail/modules + ln -sf /usr/lib64/xorg/modules/drivers ${DESTDIR}/${PREFIX}/lib64/snail/modules + ln -sf /usr/lib64/xorg/modules/extensions ${DESTDIR}/${PREFIX}/lib64/snail/modules + ln -sf /usr/lib64/xorg/modules/libfb.so ${DESTDIR}/${PREFIX}/lib64/snail/modules + ln -sf /usr/lib64/xorg/modules/libwfb.so ${DESTDIR}/${PREFIX}/lib64/snail/modules uninstall: - rm -f /etc/X11/xorg.conf.*.snail - rm -f /etc/init.d/snail-* - rm -f ${PREFIX}/lib64/libdlfaker.so - rm -f ${PREFIX}/lib64/libgefaker.so - rm -f ${PREFIX}/lib64/librrfaker.so - rm -rf ${PREFIX}/lib64/snail - rm -f ${PREFIX}/bin/nvrun - rm -f ${PREFIX}/bin/snail.vglrun - rm -f ${PREFIX}/sbin/snail.nv_pwr_off - rm -f ${PREFIX}/sbin/snail.nv_pwr_on - rm -f ${PREFIX}/sbin/snail-watcher.sh - rm -f ${PREFIX}/sbin/snail.configure + rm -f ${DESTDIR}/etc/X11/xorg.conf.*.snail + rm -f ${DESTDIR}/etc/init.d/snail-* + rm -f ${DESTDIR}/${PREFIX}/lib64/libdlfaker.so + rm -f ${DESTDIR}/${PREFIX}/lib64/libgefaker.so + rm -f ${DESTDIR}/${PREFIX}/lib64/librrfaker.so + rm -rf ${DESTDIR}/${PREFIX}/lib64/snail + rm -f ${DESTDIR}/${PREFIX}/bin/nvrun + rm -f ${DESTDIR}/${PREFIX}/bin/snail.vglrun + rm -f ${DESTDIR}/${PREFIX}/sbin/snail.nv_pwr_off + rm -f ${DESTDIR}/${PREFIX}/sbin/snail.nv_pwr_on + rm -f ${DESTDIR}/${PREFIX}/sbin/snail-watcher.sh + rm -f ${DESTDIR}/${PREFIX}/sbin/snail.configure diff --git a/etc/init.d/snail-watcher b/etc/init.d/snail-watcher index d81ba7d..4d6f9c0 100755 --- a/etc/init.d/snail-watcher +++ b/etc/init.d/snail-watcher @@ -1,6 +1,6 @@ #!/sbin/runscript -DAEMON="/usr/local/sbin/snail-watcher.sh" +DAEMON="snail-watcher.sh" DAEMON_ARGS="" PIDFILE=/var/run/snail.pid PATH=$PATH:/usr/local/bin diff --git a/etc/init.d/snail-xserver b/etc/init.d/snail-xserver index 502fd4d..c5d2115 100755 --- a/etc/init.d/snail-xserver +++ b/etc/init.d/snail-xserver @@ -1,7 +1,7 @@ #!/sbin/runscript DAEMON=/usr/bin/X -DAEMON_ARGS="-ac -config /etc/X11/xorg.conf.nvidia -sharevts -modulepath /usr/local/lib/snail -nolisten tcp -noreset :1 vt9" +DAEMON_ARGS="-ac -config /etc/X11/xorg.conf.nvidia -sharevts -modulepath /usr/lib/snail -nolisten tcp -noreset :1 vt9" PIDFILE=/tmp/.X1-lock depend() { diff --git a/sbin/snail.configure b/sbin/snail.configure index a8fa442..a0de663 100755 --- a/sbin/snail.configure +++ b/sbin/snail.configure @@ -1,5 +1,16 @@ #!/bin/bash +echo "Test for nVidia driver" +lsmod | grep '^nvidia ' &>/dev/null +[ 0 -ne $? ] && snail.nv_pwr_on && modprobe nvidia ; snail.nv_pwr_off +if [ 0 -eq $? ]; then + echo "nVidia driver is OK! ;-)" + modprobe -r nvidia +else + echo "You must install standart nVidia driver first!" + exit -1 +fi + echo "Test for acpi_call module..." lsmod | grep '^acpi_call ' &>/dev/null if [ 0 -eq $? ]; then @@ -82,7 +93,7 @@ if [ "gentoo" == "$DISTRIB_ID" ]; then eselect rc delete snail-watcher boot eselect rc add snail-watcher default eselect rc stop snail-xserver - eselect rc start snail-watcher + eselect rc restart snail-watcher elif [ "fedora" == "$DISTRIB_ID" ]; then echo "" else diff --git a/snail-0.0.1.ebuild b/snail-0.0.1.ebuild deleted file mode 100644 index 429051f..0000000 --- a/snail-0.0.1.ebuild +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 1999-2011 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -EAPI=4 -inherit eutils - -DESCRIPTION="Snail - nVidia Optimus support in a simple way" - -SRC_URI="ftp://backbone.myftp.org/projects/snail/snail-0.0.1.tar.gz" - -HOMEPAGE="http://backbone.myftp.org/projects/snail" - -KEYWORDS="-* ~x86 ~amd64" - -SLOT="0" - -LICENSE="GPL-3" - -IUSE="" - -DEPEND="x11-drivers/nvidia-drivers" - -RDEPEND="${DEPEND}" - -src_prepare() { - echo "src_prepare=`pwd`" >>/tmp/snail.log -} - -src_configure() { - echo "src_configure=`pwd`" >>/tmp/snail.log -} - -src_compile() { - echo "src_compile=`pwd`" >>/tmp/snail.log -} - -src_install() { - echo "src_install=`pwd`" >>/tmp/snail.log -} - -pkg_postinst() { - echo "src_postinst=`pwd`" >>/tmp/snail.log -} - diff --git a/snail-1.0.0.ebuild b/snail-1.0.0.ebuild new file mode 100644 index 0000000..8c4c746 --- /dev/null +++ b/snail-1.0.0.ebuild @@ -0,0 +1,34 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=4 +inherit eutils + +DESCRIPTION="Snail - nVidia Optimus support" + +SRC_URI="ftp://backbone.ws/projects/snail/snail-1.0.0.tar.bz2" + +HOMEPAGE="https://chili.backbone.ws/projects/snail" + +KEYWORDS="-* ~x86 ~amd64" + +SLOT="0" + +LICENSE="GPL-3" + +IUSE="" + +DEPEND="x11-drivers/nvidia-drivers" + +RDEPEND="${DEPEND}" + +src_install() { + echo "src_install=`pwd`" >>/tmp/snail.log + emake install DESTDIR="${D}" || die +} + +pkg_postinst() { + snail.configure +} +