3
# lh_chroot_sysv-rc(1) - manage /usr/sbin/policy-rc.d
4
# Copyright (C) 2006-2010 Daniel Baumann <daniel@debian.org>
6
# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7
# This is free software, and you are welcome to redistribute it
8
# under certain conditions; see COPYING for details.
12
# Including common functions
13
. "${LH_BASE:-/usr/share/live-helper}"/scripts/build.sh
15
# Setting static variables
16
DESCRIPTION="$(Echo 'manage /usr/sbin/policy-rc.d')"
18
USAGE="${PROGRAM} {install|remove} [--force]"
22
# Reading configuration files
23
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
26
# Requiring stage file
27
Require_stagefile .stage/config .stage/bootstrap
31
Echo_message "Configuring file /usr/sbin/policy-rc.d"
34
Check_stagefile .stage/chroot_sysv-rc
42
if [ -f chroot/usr/sbin/policy-rc.d ]
44
# Save policy-rc.d file
45
mv chroot/usr/sbin/policy-rc.d chroot/usr/sbin/policy-rc.d.orig
48
# Create policy-rc.d file
49
cat > chroot/usr/sbin/policy-rc.d << EOF
51
echo "All runlevel operations denied by policy" >&2
55
chmod 0755 chroot/usr/sbin/policy-rc.d
58
Create_stagefile .stage/chroot_sysv-rc
62
Echo_message "Deconfiguring file /usr/sbin/policy-rc.d"
70
if [ -f chroot/usr/sbin/policy-rc.d.orig ]
72
# Restore policy-rc.d file
73
mv chroot/usr/sbin/policy-rc.d.orig chroot/usr/sbin/policy-rc.d
75
# Remove policy-rc.d file
76
rm -f chroot/usr/sbin/policy-rc.d
80
rm -f .stage/chroot_sysv-rc