2010-03-04 11:36:28 -01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-02 11:12:37 +00:00
|
|
|
## live-build(7) - System Build Scripts
|
2014-02-08 15:47:02 -01:00
|
|
|
## Copyright (C) 2006-2014 Daniel Baumann <mail@daniel-baumann.ch>
|
2010-09-02 11:12:37 +00:00
|
|
|
##
|
2012-07-29 23:59:00 +00:00
|
|
|
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
|
2010-09-02 11:12:37 +00:00
|
|
|
## This is free software, and you are welcome to redistribute it
|
|
|
|
## under certain conditions; see COPYING for details.
|
|
|
|
|
2010-03-04 11:36:28 -01:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Including common functions
|
2012-08-27 13:52:29 +00:00
|
|
|
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
|
2010-03-04 11:36:28 -01:00
|
|
|
|
|
|
|
# Setting static variables
|
2011-03-10 02:28:03 -01:00
|
|
|
DESCRIPTION="$(Echo 'manage /sbin/initctl')"
|
2010-03-04 11:36:28 -01:00
|
|
|
HELP=""
|
|
|
|
USAGE="${PROGRAM} {install|remove} [--force]"
|
|
|
|
|
|
|
|
Arguments "${@}"
|
|
|
|
|
|
|
|
# Reading configuration files
|
|
|
|
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
|
|
|
|
Set_defaults
|
|
|
|
|
|
|
|
# Requiring stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Require_stagefile .build/config .build/bootstrap
|
2010-03-04 11:36:28 -01:00
|
|
|
|
2013-03-11 07:26:37 -01:00
|
|
|
# Check if system uses upstart
|
|
|
|
if [ ! -e chroot/sbin/initctl ]
|
|
|
|
then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2010-03-04 11:36:28 -01:00
|
|
|
case "${1}" in
|
|
|
|
install)
|
2011-03-10 02:28:03 -01:00
|
|
|
Echo_message "Configuring file /sbin/initctl"
|
2010-03-04 11:36:28 -01:00
|
|
|
|
|
|
|
# Checking stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Check_stagefile .build/chroot_upstart
|
2010-03-04 11:36:28 -01:00
|
|
|
|
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
2013-03-11 07:26:37 -01:00
|
|
|
# Create custom initctl file
|
|
|
|
Chroot chroot dpkg-divert --rename --quiet --add /sbin/initctl
|
2010-03-04 11:36:28 -01:00
|
|
|
|
2011-03-10 02:28:03 -01:00
|
|
|
cat > chroot/sbin/initctl << EOF
|
2010-03-04 11:36:28 -01:00
|
|
|
#!/bin/sh
|
|
|
|
echo "All runlevel operations denied by policy" >&2
|
|
|
|
exit 101
|
|
|
|
EOF
|
|
|
|
|
2011-03-10 02:28:03 -01:00
|
|
|
chmod 0755 chroot/sbin/initctl
|
2010-03-04 11:36:28 -01:00
|
|
|
|
|
|
|
# Creating stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Create_stagefile .build/chroot_upstart
|
2010-03-04 11:36:28 -01:00
|
|
|
;;
|
|
|
|
|
|
|
|
remove)
|
2011-03-10 02:28:03 -01:00
|
|
|
Echo_message "Deconfiguring file /sbin/initctl"
|
2010-03-04 11:36:28 -01:00
|
|
|
|
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
2013-03-11 07:26:37 -01:00
|
|
|
# Remove custom initctl file
|
|
|
|
rm -f chroot/sbin/initctl
|
|
|
|
Chroot chroot dpkg-divert --rename --quiet --remove /sbin/initctl
|
2010-03-04 11:36:28 -01:00
|
|
|
|
|
|
|
# Removing stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
rm -f .build/chroot_upstart
|
2010-03-04 11:36:28 -01:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
Usage
|
|
|
|
;;
|
|
|
|
esac
|