source: live-build/trunk/fuentes/scripts/build/lb_chroot_proc

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

add original source

  • Property svn:executable set to *
File size: 2.0 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 'mount /proc')"
18HELP=""
19USAGE="${PROGRAM} {install|remove} [--force]"
20
21Arguments "${@}"
22
23# Ensure that a system is built as root
24lb testroot
25
26# Reading configuration files
27Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
28Set_defaults
29
30# Requiring stage file
31Require_stagefile .build/config .build/bootstrap
32
33case "${1}" in
34        install)
35                Echo_message "Begin mounting /proc..."
36
37                # Checking stage file
38                Check_stagefile .build/chroot_proc
39
40                # Checking lock file
41                Check_lockfile .lock
42
43                # Creating lock file
44                Create_lockfile .lock
45
46                if [ "${LB_USE_FAKEROOT}" != "true" ]
47                then
48                        # Creating mountpoint
49                        mkdir -p chroot/proc
50
51                        # Mounting /proc
52                        ${LB_ROOT_COMMAND} mount proc-live -t proc chroot/proc
53                else
54                        rm -rf chroot/proc
55                        ln -s /proc chroot/
56                fi
57
58                # Creating stage file
59                Create_stagefile .build/chroot_proc
60                ;;
61
62        remove)
63                Echo_message "Begin unmounting /proc..."
64
65                # Checking lock file
66                Check_lockfile .lock
67
68                # Creating lock file
69                Create_lockfile .lock
70
71                if [ "${LB_USE_FAKEROOT}" != "true" ]
72                then
73                        # Workaround binfmt-support /proc locking
74                        if [ -e chroot/proc/sys/fs/binfmt_misc/status ]
75                        then
76                                ${LB_ROOT_COMMAND} umount chroot/proc/sys/fs/binfmt_misc
77                        fi
78
79                        # Unmounting /proc
80                        #fuser -km chroot/proc
81                        if [ -e chroot/proc/version ]
82                        then
83                                ${LB_ROOT_COMMAND} umount chroot/proc
84                        fi
85                else
86                        rm -rf chroot/proc
87                        mkdir -p chroot/proc
88                fi
89
90                # Removing stage file
91                rm -f .build/chroot_proc
92                ;;
93
94        *)
95                Usage
96                ;;
97esac
Note: See TracBrowser for help on using the repository browser.