source: live-build/trunk/fuentes/scripts/build/lb_chroot_devpts @ 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.9 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 /dev/pts')"
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 /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 devpts-live -t devpts -o gid=5,mode=620 chroot/dev/pts || true
53                fi
54
55                # Creating stage file
56                Create_stagefile .build/chroot_devpts
57                ;;
58
59        remove)
60                Echo_message "Begin unmounting /dev/pts..."
61
62                # Checking lock file
63                Check_lockfile .lock
64
65                # Creating lock file
66                Create_lockfile .lock
67
68                # Unmounting /dev/pts
69                if [ "${LB_USE_FAKEROOT}" != "true" ]
70                then
71                        if grep -qs "$(pwd)/chroot/dev/pts" /proc/mounts || Find_files chroot/dev/pts/*
72                        then
73                                ${LB_ROOT_COMMAND} umount chroot/dev/pts
74                        else
75                                ${LB_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true
76                        fi
77                fi
78
79                # Removing stage file
80                rm -f .build/chroot_devpts
81                ;;
82
83        *)
84                Usage
85                ;;
86esac
Note: See TracBrowser for help on using the repository browser.