From f0c288e8d7f6ef3762b7bdd0ede9efca300ba84d Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Mon, 5 Dec 2016 21:06:24 +0000 Subject: [PATCH] update-kernel: re-exec under fakeroot unless we are superuser The fakeroot fake-env feature requires that the filesystem if unmodified between the reloads of the fake-env. We dont comply with this so we re-exec the entire script in fakeroot instead. --- update-kernel.in | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/update-kernel.in b/update-kernel.in index 918055a..cd1edc0 100644 --- a/update-kernel.in +++ b/update-kernel.in @@ -14,6 +14,9 @@ VIRTUAL=.tmp-$SCRIPT SUPERUSER= [ $(id -u) -eq 0 ] && SUPERUSER=Y +if [ -z "$SUPERUSER" ] && [ -z "$FAKEROOTKEY" ]; then + exec fakeroot "$0" "$@" +fi ARCH= BUILDDIR= @@ -181,28 +184,12 @@ fi TMPDIR=$(mktemp -d /tmp/$SCRIPT.XXXXXX) ROOT=$TMPDIR/root BOOT=$ROOT/boot -WRAPPER= - -_exec() { - $WRAPPER "$@" -} _apk() { local cmd=$1 shift - local wrapper= - if [ -z "$SUPERUSER" ]; then - local opt= - local fake_env=$TMPDIR/fake-env - if [ -f $fake_env ]; then - opt="-i $fake_env" - WRAPPER="fakeroot $opt --" - fi - wrapper="fakeroot $opt -s $fake_env --" - fi - - $wrapper apk $cmd $QUIET_OPT -p $ROOT --arch "$ARCH" \ + apk $cmd $QUIET_OPT -p $ROOT --arch "$ARCH" \ --keys-dir /etc/apk/keys \ --repositories-file "$REPOSITORIES_FILE" $* } @@ -261,9 +248,9 @@ find $ROOT/lib/modules -type f -name "*.ko" | xargs modinfo -F firmware | sort - install -pD $ROOT/lib/firmware/$FW $MODLOOP/modules/firmware/$FW fi done -_exec mksquashfs $MODLOOP "$STAGING/$MODIMG" -comp xz -exit-on-error +mksquashfs $MODLOOP "$STAGING/$MODIMG" -comp xz -exit-on-error -_exec mkinitfs $MKINITFS_ARGS -q -b $ROOT -F "$features base squashfs" \ +mkinitfs $MKINITFS_ARGS -q -b $ROOT -F "$features base squashfs" \ -o "$STAGING/initramfs-$FLAVOR" "$KVER" for file in System.map config vmlinuz; do -- GitLab