summaryrefslogtreecommitdiffstats
path: root/make_slackware_live.sh
diff options
context:
space:
mode:
author Eric Hameleers <alien@slackware.com>2016-02-06 21:45:21 +0100
committer Eric Hameleers <alien@slackware.com>2016-02-06 21:45:21 +0100
commit3181df215dd7cd9d9fd3955c7443859878bacd03 (patch)
tree214e03b2948e182e556bb6df2fc1bb9059110bb5 /make_slackware_live.sh
parentaa0ff06ef09c65416e6f87a772ff36fb53403676 (diff)
downloadliveslak-3181df215dd7cd9d9fd3955c7443859878bacd03.tar.gz
liveslak-3181df215dd7cd9d9fd3955c7443859878bacd03.tar.xz
liveinit: use MARKER instead of INITRD as prefix for message display at boot.
Diffstat (limited to 'make_slackware_live.sh')
-rwxr-xr-xmake_slackware_live.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/make_slackware_live.sh b/make_slackware_live.sh
index 9defa17..f9ee680 100755
--- a/make_slackware_live.sh
+++ b/make_slackware_live.sh
@@ -1289,6 +1289,7 @@ sed -e "s% /sbin/depmod -%#&%" -i ${LIVE_ROOTDIR}/etc/rc.d/rc.modules
# If we detect a NVIDIA driver, then run the nvidia install routine:
cat <<EOT >> ${LIVE_ROOTDIR}/etc/rc.d/rc.local
+# Deal with the presence of NVIDIA drivers:
if [ -x /usr/sbin/nvidia-switch ]; then
if [ -f /usr/lib${DIRSUFFIX}/xorg/modules/extensions/libglx.so.*-nvidia -a -f /usr/lib${DIRSUFFIX}/xorg/modules/drivers/nvidia_drv.so ]; then
# The nvidia kernel module needs to ne announced to the kernel.
@@ -1297,8 +1298,43 @@ if [ -x /usr/sbin/nvidia-switch ]; then
echo "-- Installing binary Nvidia drivers: /usr/sbin/nvidia-switch --install"
/usr/sbin/nvidia-switch --install
fi
+ # For CUDA/OpenCL to work after reboot, create missing nvidia device nodes:
+ /usr/bin/nvidia-modprobe -c 0 -u
+else
+ # Take care of a sudden reboot when nvidia drivers were activated,
+ # by restoring the original libraries:
+ if [ -L /usr/lib${DIRSUFFIX}/xorg/modules/extensions/libglx.so -a ! -e $(readlink -f /usr/lib${DIRSUFFIX}/xorg/modules/extensions/libglx.so) ]; then
+ mv /usr/lib${DIRSUFFIX}/xorg/modules/extensions/libglx.so{-xorg,} 2>/dev/null
+ mv /usr/lib${DIRSUFFIX}/xorg/modules/extensions/libglx.la{-xorg,} 2>/dev/null
+ fi
+ if [ -L /usr/lib${DIRSUFFIX}/libGL.so -a ! -e $(readlink -f /usr/lib${DIRSUFFIX}/libGL.so) ]; then
+ LIBGL=$(ls -1 /usr/lib${DIRSUFFIX}/libGL.so.*-xorg |rev |cut -d/ -f1 |cut -d- -f2- |rev)
+ mv /usr/lib${DIRSUFFIX}/${LIBGL}-xorg /usr/lib${DIRSUFFIX}/${LIBGL} 2>/dev/null
+ ln -sf ${LIBGL} /usr/lib${DIRSUFFIX}/libGL.so.1 2>/dev/null
+ ln -sf ${LIBGL} /usr/lib${DIRSUFFIX}/libGL.so 2>/dev/null
+ mv /usr/lib${DIRSUFFIX}/libGL.la-xorg /usr/lib${DIRSUFFIX}/libGL.la 2>/dev/null
+ fi
+ if [ -L /usr/lib${DIRSUFFIX}/libEGL.so -a ! -e $(readlink -f /usr/lib${DIRSUFFIX}/libEGL.so) ]; then
+ LIBEGL=$(ls -1 /usr/lib${DIRSUFFIX}/libEGL.so.*-xorg |rev |cut -d/ -f1 |cut -d- -f2- |rev)
+ mv /usr/lib${DIRSUFFIX}/${LIBEGL}-xorg /usr/lib${DIRSUFFIX}/${LIBEGL} 2>/dev/null
+ ln -sf ${LIBEGL} /usr/lib${DIRSUFFIX}/libEGL.so.1 2>/dev/null
+ ln -sf ${LIBEGL} /usr/lib${DIRSUFFIX}/libEGL.so 2>/dev/null
+ fi
+fi
+EOT
+
+# If we detect a NVIDIA driver, we run nvidia un-install on shutdown:
+cat <<EOT >> ${LIVE_ROOTDIR}/etc/rc.d/rc.local_shutdown
+
+if [ -x /usr/sbin/nvidia-switch ]; then
+ if [ -f /usr/lib${DIRSUFFIX}/xorg/modules/extensions/libglx.so-xorg -a -f /usr/lib${DIRSUFFIX}/xorg/modules/drivers/nvidia_drv.so ]; then
+ # At shutdown, revert to the non-nvidia default:
+ echo "-- Removing binary Nvidia drivers: /usr/sbin/nvidia-switch --remove"
+ /usr/sbin/nvidia-switch --remove
+ fi
fi
EOT
+chmod +x ${LIVE_ROOTDIR}/etc/rc.d/rc.local_shutdown
# Clean out the unneeded stuff:
# Note: this will fail when a directory is encountered. This failure points
@@ -1353,6 +1389,7 @@ chroot ${LIVE_ROOTDIR} /sbin/mkinitrd -c -w ${WAIT} -l us -o /boot/initrd_${KVER
# Modify the initrd content for the Live OS:
cat $LIVE_TOOLDIR/liveinit | sed \
-e "s/@LIVEMAIN@/$LIVEMAIN/g" \
+ -e "s/@MARKER@/$MARKER/g" \
-e "s/@MEDIALABEL@/$MEDIALABEL/g" \
-e "s/@PERSISTENCE@/$PERSISTENCE/g" \
-e "s/@DARKSTAR@/$LIVE_HOSTNAME/g" \