summaryrefslogtreecommitdiff
path: root/scripts/build/chroot_upstart
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2013-03-11 09:26:37 +0100
committerDaniel Baumann <mail@daniel-baumann.ch>2013-05-06 14:50:07 +0200
commit20f042f923d25772cb87515a184308e2d2dec084 (patch)
tree489219f09663f4387a716cca93f1218988b395fe /scripts/build/chroot_upstart
parentc28707212663606a4a26059745fe018ea1183581 (diff)
downloadvyos-live-build-20f042f923d25772cb87515a184308e2d2dec084.tar.gz
vyos-live-build-20f042f923d25772cb87515a184308e2d2dec084.zip
Using dpkg-divert in chroot_upstart script to handle upgrades of upstart during the build (Closes: #702537).
Diffstat (limited to 'scripts/build/chroot_upstart')
-rwxr-xr-xscripts/build/chroot_upstart25
1 files changed, 11 insertions, 14 deletions
diff --git a/scripts/build/chroot_upstart b/scripts/build/chroot_upstart
index 47d68c2d3..88dc3b204 100755
--- a/scripts/build/chroot_upstart
+++ b/scripts/build/chroot_upstart
@@ -27,6 +27,12 @@ Set_defaults
# Requiring stage file
Require_stagefile .build/config .build/bootstrap
+# Check if system uses upstart
+if [ ! -e chroot/sbin/initctl ]
+then
+ exit 0
+fi
+
case "${1}" in
install)
Echo_message "Configuring file /sbin/initctl"
@@ -40,13 +46,9 @@ case "${1}" in
# Creating lock file
Create_lockfile .lock
- if [ -f chroot/sbin/initctl ]
- then
- # Save initctl file
- mv chroot/sbin/initctl chroot/sbin/initctl.orig
- fi
+ # Create custom initctl file
+ Chroot chroot dpkg-divert --rename --quiet --add /sbin/initctl
- # Create initctl file
cat > chroot/sbin/initctl << EOF
#!/bin/sh
echo "All runlevel operations denied by policy" >&2
@@ -68,14 +70,9 @@ EOF
# Creating lock file
Create_lockfile .lock
- if [ -f chroot/sbin/initctl.orig ]
- then
- # Restore initctl file
- mv chroot/sbin/initctl.orig chroot/sbin/initctl
- else
- # Remove initctl file
- rm -f chroot/sbin/initctl
- fi
+ # Remove custom initctl file
+ rm -f chroot/sbin/initctl
+ Chroot chroot dpkg-divert --rename --quiet --remove /sbin/initctl
# Removing stage file
rm -f .build/chroot_upstart