Packaging error on libnvidia-common-450

When installing libnvidia-common-450 on Ubuntu-20.04 LTS, the following error occurs:

/var/lib/dpkg/ 6: [[: not found

This is due to preinst being a shell script ran by /bin/sh which, unlike /bin/bash, doesn’t allow the use [[ for tests.

This should be fixed. Here’s a script that actually works:

set -e
echo "Checking for existing driver runfile install"
type -P which nvidia-uninstall 2&>/dev/null && (
    echo "Removing existing driver runfile install"
    nvidia-uninstall -s || :
exit 0