source: live-build/trunk/fuentes/scripts/build/lb_chroot_upstart @ 900

Last change on this file since 900 was 900, checked in by kbut, 4 years ago

add original source

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/bin/sh
2
3## live-build(7) - System Build Scripts
4## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
5##
6## This program 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.
9
10
11set -e
12
13# Including common functions
14( . "${LIVE_BUILD}/scripts/build.sh" > /dev/null 2>&1 || true ) || . /usr/lib/live/build.sh
15
16# Setting static variables
17DESCRIPTION="$(Echo 'manage /sbin/initctl')"
18HELP=""
19USAGE="${PROGRAM} {install|remove} [--force]"
20
21Arguments "${@}"
22
23# Reading configuration files
24Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
25Set_defaults
26
27# Requiring stage file
28Require_stagefile .build/config .build/bootstrap
29
30case "${1}" in
31        install)
32                Echo_message "Configuring file /sbin/initctl"
33
34                # Checking stage file
35                Check_stagefile .build/chroot_upstart
36
37                # Checking lock file
38                Check_lockfile .lock
39
40                # Creating lock file
41                Create_lockfile .lock
42
43                # Create custom initctl file
44                Chroot chroot dpkg-divert --rename --quiet --add /sbin/initctl
45
46                # Only create stub if we actually diverted something
47                if [ -e chroot/sbin/initctl.distrib ]; then
48cat > chroot/sbin/initctl << EOF
49#!/bin/sh
50echo "All runlevel operations denied by policy" >&2
51exit 101
52EOF
53
54                chmod 0755 chroot/sbin/initctl
55                fi
56
57                # Creating stage file
58                Create_stagefile .build/chroot_upstart
59                ;;
60
61        remove)
62                Echo_message "Deconfiguring file /sbin/initctl"
63
64                # Checking lock file
65                Check_lockfile .lock
66
67                # Creating lock file
68                Create_lockfile .lock
69
70                # Remove custom initctl file
71                rm -f chroot/sbin/initctl
72                Chroot chroot dpkg-divert --rename --quiet --remove /sbin/initctl
73
74                # Removing stage file
75                rm -f .build/chroot_upstart
76                ;;
77
78        *)
79                Usage
80                ;;
81esac
Note: See TracBrowser for help on using the repository browser.