Updating year in copyright notices to 2015.
[debian-live-build.git] / scripts / build / chroot_selinuxfs
blob7f9850926d97fd267151eb9b32e8a4ce6b783935
1 #!/bin/sh
3 ## live-build(7) - System Build Scripts
4 ## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
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.
11 set -e
13 # Including common functions
14 [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
16 # Setting static variables
17 DESCRIPTION="$(Echo 'mount /sys/fs/selinux')"
18 HELP=""
19 USAGE="${PROGRAM} {install|remove} [--force]"
21 Arguments "${@}"
23 # Reading configuration files
24 Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
25 Set_defaults
27 # Requiring stage file
28 Require_stagefile .build/config .build/bootstrap
30 case "${1}" in
31 install)
32 if [ -e /sys/fs/selinux/enforce ] && [ "$(cat /sys/fs/selinux/enforce)" = "1" ]
33 then
34 Echo_message "Begin mounting /sys/fs/selinux..."
36 # Checking stage file
37 Check_stagefile .build/chroot_selinuxfs
39 # Checking lock file
40 Check_lockfile .lock
42 # Creating lock file
43 Create_lockfile .lock
45 # Create mountpoint
46 mkdir -p chroot/sys/fs/selinux
48 # Mounting /sys/fs/selinux
49 mount selinuxfs-live -t selinuxfs chroot/sys/fs/selinux
51 # Creating stage file
52 Create_stagefile .build/chroot_selinuxfs
56 remove)
57 Echo_message "Begin unmounting /sys/fs/selinux..."
59 # Checking lock file
60 Check_lockfile .lock
62 # Creating lock file
63 Create_lockfile .lock
65 # Unmounting /sys/fs/selinux
66 if [ -e chroot/sys/fs/selinux/enforce ]
67 then
68 umount chroot/sys/fs/selinux
71 # Removing stage file
72 rm -f .build/chroot_selinux
76 Usage
78 esac