7 trap : HUP INT QUIT TSTP
9 VLOCK_ALL
=%PREFIX
%/sbin
/vlock-all
10 VLOCK_NEW
=%PREFIX
%/sbin
/vlock-new
11 VLOCK_NOSYSRQ
=%PREFIX
%/sbin
/vlock-nosysrq
12 VLOCK_CURRENT
=%PREFIX
%/sbin
/vlock-current
13 VLOCK_VERSION
=%VLOCK_VERSION
%
16 echo >&2 "vlock: locks virtual consoles, saving your current session."
17 echo >&2 "Usage: vlock [options]"
18 echo >&2 " Where [options] are any of:"
19 echo >&2 "-c or --current: lock only this virtual console, allowing user to"
20 echo >&2 " switch to other virtual consoles."
21 echo >&2 "-a or --all: lock all virtual consoles by preventing other users"
22 echo >&2 " from switching virtual consoles."
23 echo >&2 "-n or --new: allocate a new virtual console before locking,"
24 echo >&2 " implies --all."
25 echo >&2 "-s or --disable-sysrq: disable sysrq while consoles are locked to"
26 echo >&2 " prevent killing vlock with SAK, requires --all."
27 echo >&2 "-v or --version: Print the version number of vlock and exit."
28 echo >&2 "-h or --help: Print this help message and exit."
33 if [ -f "$1" ] && [ ! -x "$1" ] ; then
34 echo >&2 "vlock: cannot execute \`$1': Permission denied"
35 echo >&2 "Please check the documentation for more information."
43 local opts lock_all lock_new nosysrq
45 ( getopt
-T >/dev
/null
)
47 if [ $?
-eq 4 ] ; then
49 opts
=`getopt -o acnsvh --long current,all,new,disable-sysrq,version,help \
52 opts
=`getopt acnsvh "$@"`
55 if [ $?
-ne 0 ] ; then
88 echo "vlock version $VLOCK_VERSION" >&2
93 echo "getopt error: $1" >&2
99 if [ $lock_new -ne 0 ] && [ -n "$DISPLAY" ] ; then
100 # work around an annoying X11 bug
104 if [ $lock_all -ne 0 ] ; then
105 : $
{VLOCK_MESSAGE
:="\
106 The entire console display is now completely locked.
107 You will not be able to switch to another virtual console.
109 Please press [ENTER] to unlock."}
112 if [ $nosysrq -ne 0 ] ; then
113 if [ $lock_new -ne 0 ] ; then
119 checked_exec
"$VLOCK_NOSYSRQ"
120 elif [ $lock_new -ne 0 ] ; then
121 checked_exec
"$VLOCK_NEW"
123 checked_exec
"$VLOCK_ALL"
126 : $
{VLOCK_MESSAGE
:="\
127 This TTY is now locked.
129 Please press [ENTER] to unlock."}
132 checked_exec
"$VLOCK_CURRENT"