diff options
author | Jonathan Bauer | 2019-08-05 18:22:33 +0200 |
---|---|---|
committer | Jonathan Bauer | 2019-08-05 18:22:33 +0200 |
commit | 5fffd14b0e7012add9b658a3c3b25dd1d89c596a (patch) | |
tree | 7095c643f2e16ca1951597952d330645a5b93701 /builder | |
parent | [slx-drm] don't escape $ -.- (diff) | |
download | systemd-init-5fffd14b0e7012add9b658a3c3b25dd1d89c596a.tar.gz systemd-init-5fffd14b0e7012add9b658a3c3b25dd1d89c596a.tar.xz systemd-init-5fffd14b0e7012add9b658a3c3b25dd1d89c596a.zip |
[slx-drm] use dracut libs for warn
Diffstat (limited to 'builder')
-rw-r--r-- | builder/modules.d/slx-drm/hooks/activate-nvidia-drivers.sh | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/builder/modules.d/slx-drm/hooks/activate-nvidia-drivers.sh b/builder/modules.d/slx-drm/hooks/activate-nvidia-drivers.sh index d5fde771..5c9310e8 100644 --- a/builder/modules.d/slx-drm/hooks/activate-nvidia-drivers.sh +++ b/builder/modules.d/slx-drm/hooks/activate-nvidia-drivers.sh @@ -1,10 +1,12 @@ #!/bin/bash +type emergency_shell >/dev/null 2>&1 || . /lib/dracut-lib.sh + detect_nvidia_cards() { # hard check on nvidia graphic cards local cards="$(lspci | grep 'Class 0300: 10de:' | awk '{print $4}')" - if ! [ -d "/drm.cfg.d" ] && [ -n $cards]; then - echo "Failed" + if ! [ -d "/drm.cfg.d" ] && [ -n $cards ]; then + warn "Failed to find '/drm.cfg.d' or nvidia cards." return 1 fi for card in $cards; do @@ -16,21 +18,22 @@ detect_nvidia_cards() { [ -d "$driver_dir" ] || continue local driver_target="/lib/modules/$(uname -r)/kernel/drivers/gpu/drm/nvidia" if [ -d "$driver_target" ]; then - echo "'$driver_target' exists, will overwrite!" - rm -rf -- "$driver_target" + warn "'$driver_target' exists, will not overwrite!" + return 1 fi # all good, move it over if ! mv "$driver_dir" "$driver_target" 2>&1; then - echo "Failed to move '$driver_dir' to '$driver_target'." + warn "Failed to move '$driver_dir' to '$driver_target'." return 1 fi # finally run depmod to make it visible to udev if ! depmod -a 2>&1 ; then - echo "Failed to run depmod, udev won't see the nvidia modules." + warn "Failed to run depmod, udev won't see the nvidia modules." return 1 fi # blacklist nouveau echo 'blacklist nouveau' > "/lib/modprobe.d/disable-nouveau.conf" + info "Initialized nvidia drivers." return 0 done } |