2007-09-23 08:05:18 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# lh_chroot_dpkg(1) - manage /sbin/dpkg
|
2009-01-26 15:39:27 -01:00
|
|
|
# Copyright (C) 2006-2009 Daniel Baumann <daniel@debian.org>
|
2007-09-23 08:05:18 +00:00
|
|
|
#
|
|
|
|
# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
|
|
|
|
# This is free software, and you are welcome to redistribute it
|
|
|
|
# under certain conditions; see COPYING for details.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Including common functions
|
2009-11-22 12:40:20 -01:00
|
|
|
. "${LH_BASE:-/usr/share/live-helper}"/live-helper.sh
|
2007-09-23 08:05:18 +00:00
|
|
|
|
|
|
|
# Setting static variables
|
2009-01-15 01:37:42 -01:00
|
|
|
DESCRIPTION="$(Echo 'manage /sbin/dpkg')"
|
2007-09-23 08:05:18 +00:00
|
|
|
HELP=""
|
|
|
|
USAGE="${PROGRAM} {install|remove} [--force]"
|
|
|
|
|
|
|
|
Arguments "${@}"
|
|
|
|
|
|
|
|
# Reading configuration files
|
2008-10-28 14:26:17 -01:00
|
|
|
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
|
2007-09-23 08:05:18 +00:00
|
|
|
Set_defaults
|
|
|
|
|
|
|
|
# Requiring stage file
|
2008-10-14 19:32:50 +00:00
|
|
|
Require_stagefile .stage/config .stage/bootstrap
|
2007-09-23 08:05:18 +00:00
|
|
|
|
|
|
|
case "${1}" in
|
|
|
|
install)
|
|
|
|
Echo_message "Configuring file /sbin/start-stop-daemon"
|
|
|
|
|
|
|
|
# Checking stage file
|
|
|
|
Check_stagefile .stage/chroot_dpkg
|
|
|
|
|
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
|
|
|
# Save start-stop-daemon program
|
|
|
|
mv chroot/sbin/start-stop-daemon chroot/sbin/start-stop-daemon.orig
|
|
|
|
|
|
|
|
# Create start-stop-daemon program
|
|
|
|
|
|
|
|
cat > chroot/sbin/start-stop-daemon << EOF
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
EOF
|
|
|
|
|
|
|
|
chmod 755 chroot/sbin/start-stop-daemon
|
|
|
|
|
|
|
|
# Creating stage file
|
|
|
|
Create_stagefile .stage/chroot_dpkg
|
|
|
|
;;
|
|
|
|
|
|
|
|
remove)
|
2007-11-13 10:49:43 -01:00
|
|
|
Echo_message "Deconfiguring file /sbin/start-stop-daemon"
|
|
|
|
|
2007-09-23 08:05:18 +00:00
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
|
|
|
# Restore start-stop-daemon program
|
2009-12-21 12:33:03 -01:00
|
|
|
if [ -e chroot/sbin/start-stop-daemon.orig ]
|
|
|
|
then
|
|
|
|
mv chroot/sbin/start-stop-daemon.orig chroot/sbin/start-stop-daemon
|
|
|
|
fi
|
2007-09-23 08:05:18 +00:00
|
|
|
|
|
|
|
# Removing stage file
|
|
|
|
rm -f .stage/chroot_dpkg
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
Usage
|
|
|
|
;;
|
|
|
|
esac
|