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
|
Description: Setup and teardown policy.d, to not autostart applications in the chroot
Author: Unit 193 <unit193@ubuntu.com>
Origin: vendor
Forwarded: not-needed
Last-Update: 2018-01-28
Index: arch-install-scripts/common
===================================================================
--- arch-install-scripts.orig/common
+++ arch-install-scripts/common
@@ -77,10 +77,18 @@ chroot_maybe_add_mount() {
fi
}
+chroot_policyd() {
+ cat << EOF > "$1/usr/sbin/policy-rc.d"
+#!/bin/sh
+exit 101
+EOF
+ chmod +x "$1/usr/sbin/policy-rc.d"
+}
+
chroot_setup() {
CHROOT_ACTIVE_MOUNTS=()
[[ $(trap -p EXIT) ]] && die '(BUG): attempting to overwrite existing EXIT trap'
- trap 'chroot_teardown' EXIT
+ trap "chroot_teardown $1" EXIT
chroot_add_mount proc "$1/proc" -t proc -o nosuid,noexec,nodev &&
chroot_add_mount sys "$1/sys" -t sysfs -o nosuid,noexec,nodev,ro &&
@@ -91,6 +99,7 @@ chroot_setup() {
chroot_add_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev &&
chroot_add_mount /run "$1/run" --bind &&
chroot_add_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid
+ chroot_policyd "$1"
}
chroot_teardown() {
@@ -98,6 +107,7 @@ chroot_teardown() {
umount "${CHROOT_ACTIVE_MOUNTS[@]}"
fi
unset CHROOT_ACTIVE_MOUNTS
+ rm -f "$1/usr/sbin/policy-rc.d"
}
try_cast() (
|