summaryrefslogtreecommitdiffstats
path: root/system/nvidia-legacy390-driver
diff options
context:
space:
mode:
author Lenard Spencer2020-04-17 05:45:41 +0200
committer Willy Sudiarto Raharjo2020-04-17 05:45:41 +0200
commit9a58d29c1a8ad1891a74ccd670fc7b23d2e1edf3 (patch)
treea0f064ab41506564d3545c1e8e27559924276a82 /system/nvidia-legacy390-driver
parent8db865d339f9709e12b0911575dbe71d4dd47a60 (diff)
downloadslackbuilds-9a58d29c1a8ad1891a74ccd670fc7b23d2e1edf3.tar.gz
system/nvidia-legacy390-driver: Fix nvidia-switch.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/nvidia-legacy390-driver')
-rw-r--r--system/nvidia-legacy390-driver/README12
-rw-r--r--system/nvidia-legacy390-driver/README.nvidia-persistenced6
-rw-r--r--system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild27
-rw-r--r--system/nvidia-legacy390-driver/nvidia-switch7
-rw-r--r--system/nvidia-legacy390-driver/rc.nvidia-persistenced19
5 files changed, 35 insertions, 36 deletions
diff --git a/system/nvidia-legacy390-driver/README b/system/nvidia-legacy390-driver/README
index 0fefce671d..3095e866c7 100644
--- a/system/nvidia-legacy390-driver/README
+++ b/system/nvidia-legacy390-driver/README
@@ -13,8 +13,8 @@ If you build and install this driver on current WITHOUT using the
CURRENT="yes" flag, it will corrupt both xorg-server AND libglvnd, so
after removing the driver both packages will have to be reinstalled.
-This script now installs the nvidia-persistenced daemon. For details see
-README.nvidia-persistenced.
+This script now gives the option of installing the nvidia-persistenced
+daemon. For details see README.nvidia-persistenced.
Several useful utilities are included: nvidia-xsettings, nvidia-smi, and
nvidia-settings. Please refer to the Nvidia documentation and man pages
@@ -42,9 +42,8 @@ NOTES:
Since nvidia-legacy390-driver conflicts with some files of xorg, it's a
bit complex to install/uninstall the driver. However, installation of the
nvidia-legacy390-driver package backs up the conflicting files and puts
-the nvidia-specific files into place by automatically running
- nvidia-switch --install
-in doinst.sh.
+the nvidia-specific files into place by automatically running
+nvidia-switch --install in doinst.sh.
Before uninstalling or upgrading this package, it is IMPORTANT that
you execute 'nvidia-switch --remove', which will switch back to the
@@ -62,5 +61,6 @@ not working. Here are the affected files (and their packages):
/usr/lib[64]/xorg/modules/extensions/libglx.so (xorg-server)
Simply remove the dead nvidia symlinks and and reinstall the mesa and
-xorg-server packages. (In current, only xorg-server is affected.)
+xorg-server packages. (In current, if libglx.so is a dead symlink,
+it MUST be removed before reinstalling xorg-server.)
diff --git a/system/nvidia-legacy390-driver/README.nvidia-persistenced b/system/nvidia-legacy390-driver/README.nvidia-persistenced
index 6a701bb7bd..9b0abc2c73 100644
--- a/system/nvidia-legacy390-driver/README.nvidia-persistenced
+++ b/system/nvidia-legacy390-driver/README.nvidia-persistenced
@@ -1,9 +1,9 @@
The driver now includes rc.nvidia-persistenced as an option. While it can
be run as root, it is more secure to run it as an unpriveleged user, so we
-run it as user nvidia. Create the nvidia user and group with the following:
+run it as user nvidia.
- # groupadd -g 365 nvidia
- # useradd -u 365 -g 365 -c "Nvidia" -d /dev/null -s /bin/false nvidia
+To install it, Pass PERSISTENCED=yes to the script. It will create the
+user and group nvidia, and install rc.nvidia-persistenced to /etc/rc.d.
To activate the daemon, add the following to /etc/rc.d/local:
diff --git a/system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild b/system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild
index c22fca04c2..462e4f800a 100644
--- a/system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild
+++ b/system/nvidia-legacy390-driver/nvidia-legacy390-driver.SlackBuild
@@ -173,12 +173,15 @@ cd $TMP/$SRCNAM
# Move ICDs to $PKG and cleanup (no switch option in installer?)
mv /etc/OpenCL/vendors/nvidia.icd $PKG/etc/OpenCL/vendors/nvidia.icd
mv /etc/vulkan/icd.d/nvidia_icd.json $PKG/etc/vulkan/icd.d/nvidia_icd.json
-rm -rf /etc/vulkan
# In current, mesa now puts an entry into this directory, so we
# leave it alone if it is not empty
if [ -z "$(ls -A /etc/OpenCL/vendors)" ]; then
rm -rf /etc/OpenCL
fi
+# just in case any other programs make an entry here
+if [ -z "$(ls -A /etc/vulkan)" ]; then
+ rm -rf /etc/vulkan
+fi
# Compile utilites from source, replacing the precompiled versions
#
@@ -371,14 +374,24 @@ else
fi
# Add rc.nvidia-persistenced:
-mkdir -p $PKG/var/run/nvidia-persistenced
-chown nvidia:nvidia $PKG/var/run/nvidia-persistenced
-mkdir -p $PKG/etc/rc.d
-cat $CWD/rc.nvidia-persistenced > $PKG/etc/rc.d/rc.nvidia-persistenced
-sed -i "s|__USER__|nvidia|" $PKG/etc/rc.d/rc.nvidia-persistenced
+if [ "${PERSISTENCED:-no}" = "yes" ]; then
+ if ! getent group nvidia > /dev/null 2>&1; then
+ echo "Creating the group nvidia:"
+ groupadd -g 365 nvidia || exit 1
+ fi
+ if ! getent passwd nvidia > /dev/null 2>&1; then
+ echo "Creating the user nvidia:"
+ useradd -u 365 -g 365 -c "Nvidia" -d /dev/null -s /bin/false nvidia || exit 1
+ fi
+ mkdir -p $PKG/var/run/nvidia-persistenced
+ chown nvidia:nvidia $PKG/var/run/nvidia-persistenced
+ mkdir -p $PKG/etc/rc.d
+ install -m 755 $CWD/rc.nvidia-persistenced $PKG/etc/rc.d/rc.nvidia-persistenced
+ sed -i "s|__USER__|nvidia|" $PKG/etc/rc.d/rc.nvidia-persistenced
+fi
cat $CWD/doinst.sh > $PKG/install/doinst.sh
-# Flag install as multlib as needed and build package.
+# Flag multlib as needed and build package.
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION$MULTI-$TARGET-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/nvidia-legacy390-driver/nvidia-switch b/system/nvidia-legacy390-driver/nvidia-switch
index aa92b3a01a..2f57366cfd 100644
--- a/system/nvidia-legacy390-driver/nvidia-switch
+++ b/system/nvidia-legacy390-driver/nvidia-switch
@@ -113,7 +113,7 @@ save_glx(){
case "$1" in
"nvidia")
if [ -e libglx.so ]; then
- mv libglx.so libglx.so-xorg
+ cp -a libglx.so libglx.so-xorg
fi
ln -sf libglx.so.$NV_VERSION libglx.so
;;
@@ -124,6 +124,11 @@ save_glx(){
else
if [ ! -e libglx.so ]; then
echo -e "WARNING: libglx.so not found! Please reinstall xorg-server!\n"
+ else
+ if [ -L libglx.so ]; then
+ rm libglx.so
+ echo -e "WARNING: removed dead symlink libglx.so! Please reinstall xorg-server!\n"
+ fi
fi
fi
;;
diff --git a/system/nvidia-legacy390-driver/rc.nvidia-persistenced b/system/nvidia-legacy390-driver/rc.nvidia-persistenced
index bf53fd9345..59bdf18d11 100644
--- a/system/nvidia-legacy390-driver/rc.nvidia-persistenced
+++ b/system/nvidia-legacy390-driver/rc.nvidia-persistenced
@@ -22,25 +22,6 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
-# This is a sample System V init script, designed to show how the NVIDIA
-# Persistence Daemon can be started.
-#
-# This sample does not rely on any init system functions, to ensure the
-# widest portability possible.
-#
-# chkconfig: 2345 99 01
-# description: Starts and stops the NVIDIA Persistence Daemon
-# processname: nvidia-persistenced
-#
-### BEGIN INIT INFO
-# Provides: nvidia-persistenced
-# Required-Start: $ALL
-# Required-Stop: $ALL
-# Default-Start: 2 3 4 5
-# Default-Stop: 0 1 6
-# Description: Starts and stops the NVIDIA Persistence Daemon
-### END INIT INFO
-
NVPD=nvidia-persistenced
NVPD_BIN=/usr/bin/${NVPD}