2007-10-31 09:20:03 -01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# lh_chroot_devpts(1) - mount /dev/pts
|
2010-03-04 11:43:04 -01:00
|
|
|
# Copyright (C) 2006-2010 Daniel Baumann <daniel@debian.org>
|
2007-10-31 09:20:03 -01:00
|
|
|
#
|
|
|
|
# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
|
|
|
|
# This is free software, and you are welcome to redistribute it
|
|
|
|
# under certain conditions; see COPYING for details.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Including common functions
|
2010-07-24 15:06:14 +00:00
|
|
|
. "${LH_BASE:-/usr/share/live-helper}"/scripts/build.sh
|
2007-10-31 09:20:03 -01:00
|
|
|
|
|
|
|
# Setting static variables
|
2009-01-15 01:37:42 -01:00
|
|
|
DESCRIPTION="$(Echo 'mount /dev/pts')"
|
2007-10-31 09:20:03 -01:00
|
|
|
HELP=""
|
|
|
|
USAGE="${PROGRAM} {install|remove} [--force]"
|
|
|
|
|
|
|
|
Arguments "${@}"
|
|
|
|
|
|
|
|
# Ensure that a system is built as root
|
2009-10-20 18:40:09 +00:00
|
|
|
lh testroot
|
2007-10-31 09:20:03 -01:00
|
|
|
|
|
|
|
# Reading configuration files
|
2008-10-28 14:26:17 -01:00
|
|
|
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
|
2007-10-31 09:20:03 -01:00
|
|
|
Set_defaults
|
|
|
|
|
|
|
|
# Requiring stage file
|
2008-10-14 19:32:50 +00:00
|
|
|
Require_stagefile .stage/config .stage/bootstrap
|
2007-10-31 09:20:03 -01:00
|
|
|
|
|
|
|
case "${1}" in
|
|
|
|
install)
|
2007-11-13 10:49:43 -01:00
|
|
|
Echo_message "Begin mounting /dev/pts..."
|
|
|
|
|
2007-10-31 09:20:03 -01:00
|
|
|
# Checking stage file
|
|
|
|
Check_stagefile .stage/chroot_devpts
|
|
|
|
|
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
2009-12-13 19:17:45 -01:00
|
|
|
if [ "${LH_USE_FAKEROOT}" != "true" ]
|
2007-11-11 21:05:55 -01:00
|
|
|
then
|
|
|
|
# Creating mountpoint
|
|
|
|
mkdir -p chroot/dev/pts
|
2007-10-31 09:20:03 -01:00
|
|
|
|
2007-11-11 21:05:55 -01:00
|
|
|
# Mounting /dev/pts
|
2008-02-20 12:11:22 -01:00
|
|
|
${LH_ROOT_COMMAND} mount devpts-live -t devpts chroot/dev/pts || true
|
2007-11-11 21:05:55 -01:00
|
|
|
fi
|
2007-10-31 09:20:03 -01:00
|
|
|
|
|
|
|
# Creating stage file
|
|
|
|
Create_stagefile .stage/chroot_devpts
|
|
|
|
;;
|
|
|
|
|
|
|
|
remove)
|
2007-11-13 10:49:43 -01:00
|
|
|
Echo_message "Begin unmounting /dev/pts..."
|
|
|
|
|
2007-10-31 09:20:03 -01:00
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
|
|
|
# Unmounting /dev/pts
|
2009-12-13 19:17:45 -01:00
|
|
|
if [ "${LH_USE_FAKEROOT}" != "true" ]
|
2007-11-11 19:33:43 -01:00
|
|
|
then
|
2009-12-23 20:27:18 -01:00
|
|
|
if grep -qs "$(pwd)/chroot/dev/pts" /proc/mounts || Find_files chroot/dev/pts/*
|
2007-11-11 21:05:55 -01:00
|
|
|
then
|
|
|
|
${LH_ROOT_COMMAND} umount chroot/dev/pts
|
2009-12-23 20:27:18 -01:00
|
|
|
else
|
|
|
|
${LH_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true
|
2007-11-11 21:05:55 -01:00
|
|
|
fi
|
2007-11-11 19:33:43 -01:00
|
|
|
fi
|
2007-10-31 09:20:03 -01:00
|
|
|
|
|
|
|
# Removing stage file
|
|
|
|
rm -f .stage/chroot_devpts
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
Usage
|
|
|
|
;;
|
|
|
|
esac
|