aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2016-12-05 21:06:24 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2016-12-05 21:13:07 +0000
commitf0c288e8d7f6ef3762b7bdd0ede9efca300ba84d (patch)
treef485fe86cc5a79cab010d0e36b832a0eb7cd30a2
parent439c020e268830965fd5ee90147e93e753855caf (diff)
downloadalpine-conf-f0c288e8d7f6ef3762b7bdd0ede9efca300ba84d.tar.bz2
alpine-conf-f0c288e8d7f6ef3762b7bdd0ede9efca300ba84d.tar.xz
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.
-rw-r--r--update-kernel.in25
1 files 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