source: live-build/trunk/fuentes/scripts/build/lb_chroot_sysfs @ 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 'mount /sys')"
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 /sys..."
36
37                # Checking stage file
38                Check_stagefile .build/chroot_sysfs
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                        # Create mountpoint
49                        mkdir -p chroot/sys
50
51                        # Mounting /sys
52                        ${LB_ROOT_COMMAND} mount sysfs-live -t sysfs chroot/sys
53                else
54                        rm -rf chroot/sys
55                        ln -s /sys chroot/
56                fi
57
58                # Creating stage file
59                Create_stagefile .build/chroot_sysfs
60                ;;
61
62        remove)
63                Echo_message "Begin unmounting /sys..."
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                        # Unmounting /sys
74                        #fuser -km chroot/sys
75                        if [ -e chroot/sys/class ]
76                        then
77                                ${LB_ROOT_COMMAND} umount chroot/sys
78                        fi
79                else
80                        rm -rf chroot/sys
81                        mkdir -p chroot/sys
82                fi
83
84                # Removing stage file
85                rm -f .build/chroot_sysfs
86                ;;
87
88        *)
89                Usage
90                ;;
91esac
Note: See TracBrowser for help on using the repository browser.