source: live-build/trunk/fuentes/scripts/build/lb_chroot_sysv-rc @ 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.9 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 /usr/sbin/policy-rc.d')"
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 /usr/sbin/policy-rc.d"
33
34                # Checking stage file
35                Check_stagefile .build/chroot_sysv-rc
36
37                # Checking lock file
38                Check_lockfile .lock
39
40                # Creating lock file
41                Create_lockfile .lock
42
43                if [ -e chroot/usr/sbin/policy-rc.d ]
44                then
45                        # Save policy-rc.d file
46                        Chroot chroot dpkg-divert --rename --quiet --add /usr/sbin/policy-rc.d
47                fi
48
49                # Create policy-rc.d file
50cat > chroot/usr/sbin/policy-rc.d << EOF
51#!/bin/sh
52echo "All runlevel operations denied by policy" >&2
53exit 101
54EOF
55
56                chmod 0755 chroot/usr/sbin/policy-rc.d
57
58                # Creating stage file
59                Create_stagefile .build/chroot_sysv-rc
60                ;;
61
62        remove)
63                Echo_message "Deconfiguring file /usr/sbin/policy-rc.d"
64
65                # Checking lock file
66                Check_lockfile .lock
67
68                # Creating lock file
69                Create_lockfile .lock
70
71                # Remove custom policy-rc.d file
72                rm -f chroot/usr/sbin/policy-rc.d
73
74                if [ -e chroot/usr/sbin/policy-rc.d.distrib ]
75                then
76                        # Restore policy-rc.d file
77                        Chroot chroot dpkg-divert --rename --quiet --remove /usr/sbin/policy-rc.d
78                fi
79
80                # Removing stage file
81                rm -f .build/chroot_sysv-rc
82                ;;
83
84        *)
85                Usage
86                ;;
87esac
Note: See TracBrowser for help on using the repository browser.