Update install.sh:Replace "command -v" with encapsulated functionality (#6035)

Replace "command -v" with encapsulated functionality
This commit is contained in:
王卿 2024-09-06 00:49:48 +08:00 committed by GitHub
parent cf48603943
commit c7c845ec52
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -356,12 +356,12 @@ if ! lsmod | grep -q nvidia || ! lsmod | grep -q nvidia_uvm; then
fi fi
# make sure the NVIDIA modules are loaded on boot with nvidia-persistenced # make sure the NVIDIA modules are loaded on boot with nvidia-persistenced
if command -v nvidia-persistenced > /dev/null 2>&1; then if available nvidia-persistenced; then
$SUDO touch /etc/modules-load.d/nvidia.conf $SUDO touch /etc/modules-load.d/nvidia.conf
MODULES="nvidia nvidia-uvm" MODULES="nvidia nvidia-uvm"
for MODULE in $MODULES; do for MODULE in $MODULES; do
if ! grep -qxF "$MODULE" /etc/modules-load.d/nvidia.conf; then if ! grep -qxF "$MODULE" /etc/modules-load.d/nvidia.conf; then
echo "$MODULE" | sudo tee -a /etc/modules-load.d/nvidia.conf > /dev/null echo "$MODULE" | $SUDO tee -a /etc/modules-load.d/nvidia.conf > /dev/null
fi fi
done done
fi fi