]> git.proxmox.com Git - mirror_ubuntu-impish-kernel.git/commitdiff
UBUNTU: [Debian] dkms-build -- use fakeroot if not running as root
authorSeth Forshee <seth.forshee@canonical.com>
Tue, 1 Jun 2021 15:36:03 +0000 (10:36 -0500)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 28 Jun 2021 06:04:04 +0000 (08:04 +0200)
BugLink: https://bugs.launchpad.net/bugs/1930713
Some dkms builds require running as root, or at least the illusion of
doing so. However we need to do dkms builds before deleting the
flavour build directory in order to sign the modules, and this may
happen without fakeroot. Detect whether or not dkms-build has been
invoked as root, and if not use fakeroot to do the dkms build.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Acked-by: Andy Whitcroft <apw@canonical.com>
debian/scripts/dkms-build

index c1751ffaa016a0fc9860b7aed2cc1386ef578472..9d78fc60e63f0826948bf815d1a563aefc0cabb5 100755 (executable)
@@ -158,8 +158,10 @@ dkms_version=$( sed -ne 's/PACKAGE_VERSION="\(.*\)"/\1/p' "$dkms_conf" )
 
 # Build the DKMS binaries.
 echo "II: dkms-build building $package"
+fakeroot=""
+[[ $EUID -ne 0 ]] && fakeroot="/usr/bin/fakeroot"
 rc=0
-/usr/sbin/dkms build --no-prepare-kernel --no-clean-kernel \
+$fakeroot /usr/sbin/dkms build --no-prepare-kernel --no-clean-kernel \
        -k "$abi_flavour" \
        --sourcetree "$dkms_dir/source" \
        --dkmstree "$dkms_dir/build" \