Description: Setup and teardown policy.d, to not autostart applications in the chroot Author: Unit 193 Origin: vendor Forwarded: not-needed Last-Update: 2018-01-28 --- arch-install-scripts-15.orig/common +++ arch-install-scripts-15/common @@ -74,10 +74,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 && @@ -88,11 +96,13 @@ chroot_setup() { chroot_add_mount shm "$1/dev/shm" -t tmpfs -o mode=1777,nosuid,nodev && chroot_add_mount run "$1/run" -t tmpfs -o nosuid,nodev,mode=0755 && chroot_add_mount tmp "$1/tmp" -t tmpfs -o mode=1777,strictatime,nodev,nosuid + chroot_policyd "$1" } chroot_teardown() { umount "${CHROOT_ACTIVE_MOUNTS[@]}" unset CHROOT_ACTIVE_MOUNTS + rm -f "$1/usr/sbin/policy-rc.d" } try_cast() (