Commit f0c288e8 authored by Natanael Copa's avatar Natanael Copa

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.
parent 439c020e
...@@ -14,6 +14,9 @@ VIRTUAL=.tmp-$SCRIPT ...@@ -14,6 +14,9 @@ VIRTUAL=.tmp-$SCRIPT
SUPERUSER= SUPERUSER=
[ $(id -u) -eq 0 ] && SUPERUSER=Y [ $(id -u) -eq 0 ] && SUPERUSER=Y
if [ -z "$SUPERUSER" ] && [ -z "$FAKEROOTKEY" ]; then
exec fakeroot "$0" "$@"
fi
ARCH= ARCH=
BUILDDIR= BUILDDIR=
...@@ -181,28 +184,12 @@ fi ...@@ -181,28 +184,12 @@ fi
TMPDIR=$(mktemp -d /tmp/$SCRIPT.XXXXXX) TMPDIR=$(mktemp -d /tmp/$SCRIPT.XXXXXX)
ROOT=$TMPDIR/root ROOT=$TMPDIR/root
BOOT=$ROOT/boot BOOT=$ROOT/boot
WRAPPER=
_exec() {
$WRAPPER "$@"
}
_apk() { _apk() {
local cmd=$1 local cmd=$1
shift shift
local wrapper= apk $cmd $QUIET_OPT -p $ROOT --arch "$ARCH" \
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" \
--keys-dir /etc/apk/keys \ --keys-dir /etc/apk/keys \
--repositories-file "$REPOSITORIES_FILE" $* --repositories-file "$REPOSITORIES_FILE" $*
} }
...@@ -261,9 +248,9 @@ find $ROOT/lib/modules -type f -name "*.ko" | xargs modinfo -F firmware | sort - ...@@ -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 install -pD $ROOT/lib/firmware/$FW $MODLOOP/modules/firmware/$FW
fi fi
done 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" -o "$STAGING/initramfs-$FLAVOR" "$KVER"
for file in System.map config vmlinuz; do for file in System.map config vmlinuz; do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment