blob: 12cfd7c3b53fa096b2eb9883a08a23c8b81cc2c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
From f0c288e8d7f6ef3762b7bdd0ede9efca300ba84d Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 5 Dec 2016 21:06:24 +0000
Subject: [PATCH 3/3] 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
--
2.11.0
|