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

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

add original source

  • Property svn:executable set to *
File size: 2.7 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/dpkg')"
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/start-stop-daemon"
33
34                # Checking stage file
35                Check_stagefile .build/chroot_dpkg
36
37                # Checking lock file
38                Check_lockfile .lock
39
40                # Creating lock file
41                Create_lockfile .lock
42
43                # Create custom start-stop-daemon program
44                Chroot chroot dpkg-divert --rename --quiet --add /sbin/start-stop-daemon
45
46cat > chroot/sbin/start-stop-daemon << EOF
47#!/bin/sh
48
49exit 0
50EOF
51
52                chmod 755 chroot/sbin/start-stop-daemon
53
54                # Disable dpkg syncing
55
56cat > chroot/etc/dpkg/dpkg.cfg.d/live-build << EOF
57force-unsafe-io
58EOF
59
60                # Manual hacks for special packages
61
62                # samhain
63                if [ -e /var/state/samhain/samhain_file ]
64                then
65                        mv /var/state/samhain/samhain_file /var/state/samhain/samhain_file.orig
66                else
67                        mkdir -p /var/state/samhain
68                        touch /var/state/samhain/samhain_file
69                fi
70
71                # flash-kernel
72                Chroot chroot dpkg-divert --rename --quiet --add /usr/sbin/flash-kernel
73                ln -s /bin/true chroot/usr/sbin/flash-kernel
74
75                # Creating stage file
76                Create_stagefile .build/chroot_dpkg
77                ;;
78
79        remove)
80                Echo_message "Deconfiguring file /sbin/start-stop-daemon"
81
82                # Checking lock file
83                Check_lockfile .lock
84
85                # Creating lock file
86                Create_lockfile .lock
87
88                # Manual hacks for special packages
89
90                # flash-kernel
91                rm -f chroot/usr/sbin/flash-kernel
92                Chroot chroot dpkg-divert --rename --quiet --remove /usr/sbin/flash-kernel
93
94                # samhain
95                if [ -e /var/state/samhain/samhain_file.orig ]
96                then
97                        mv /var/state/samhain/samhain_file.orig /var/state/samhain/samhain_file
98                elif [ -d /var/state/samhain ]
99                then
100                        rm -f /var/state/samhain/samhain_file
101                        rmdir --ignore-fail-on-non-empty /var/state/samhain || true
102                fi
103
104                # Remove custom start-stop-daemon program
105                rm -f chroot/sbin/start-stop-daemon
106                Chroot chroot dpkg-divert --rename --quiet --remove /sbin/start-stop-daemon
107
108                # Remove dpkg sync configuration
109                rm -f chroot/etc/dpkg/dpkg.cfg.d/live-build
110
111                # Removing stage file
112                rm -f .build/chroot_dpkg
113                ;;
114
115        *)
116                Usage
117                ;;
118esac
Note: See TracBrowser for help on using the repository browser.