1
+ #! /bin/sh
2
+
3
+ # # live-build(7) - System Build Scripts
4
+ # # Copyright (C) 2006-2012 Daniel Baumann <[email protected] >
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
+
11
+ set -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
17
+ DESCRIPTION=" $( Echo ' mount /dev/pts' ) "
18
+ HELP=" "
19
+ USAGE=" ${PROGRAM} {install|remove} [--force]"
20
+
21
+ Arguments " ${@ } "
22
+
23
+ # Ensure that a system is built as root
24
+ lb testroot
25
+
26
+ # Reading configuration files
27
+ Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
28
+ Set_defaults
29
+
30
+ # Requiring stage file
31
+ Require_stagefile .build/config .build/bootstrap
32
+
33
+ case " ${1} " in
34
+ install)
35
+ Echo_message " Begin mounting /dev/pts..."
36
+
37
+ # Checking stage file
38
+ Check_stagefile .build/chroot_devpts
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/dev/pts
50
+
51
+ # Mounting /dev/pts
52
+ ${LB_ROOT_COMMAND} mount --bind chroot chroot || true
53
+ ${LB_ROOT_COMMAND} mount devpts-live -t devpts -o gid=5,mode=620 chroot/dev/pts || true
54
+ fi
55
+
56
+ # Creating stage file
57
+ Create_stagefile .build/chroot_devpts
58
+ ;;
59
+
60
+ remove)
61
+ Echo_message " Begin unmounting /dev/pts..."
62
+
63
+ # Checking lock file
64
+ Check_lockfile .lock
65
+
66
+ # Creating lock file
67
+ Create_lockfile .lock
68
+
69
+ # Unmounting /dev/pts
70
+ if [ " ${LB_USE_FAKEROOT} " != " true" ]
71
+ then
72
+ if grep -qs " $( pwd) /chroot/dev/pts" /proc/mounts || Find_files chroot/dev/pts/*
73
+ then
74
+ ${LB_ROOT_COMMAND} umount chroot/dev/pts
75
+ else
76
+ ${LB_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true
77
+ fi
78
+ if grep -qs " $( pwd) /chroot" /proc/mounts || Find_files chroot/*
79
+ then
80
+ ${LB_ROOT_COMMAND} umount chroot/
81
+ else
82
+ ${LB_ROOT_COMMAND} umount -f chroot/ > /dev/null 2>&1 || true
83
+ fi
84
+ fi
85
+
86
+ # Removing stage file
87
+ rm -f .build/chroot_devpts
88
+ ;;
89
+
90
+ * )
91
+ Usage
92
+ ;;
93
+ esac
0 commit comments