4 trap : HUP INT QUIT TSTP
6 VLOCK_ALL
=%PREFIX
%/sbin
/vlock-all
7 VLOCK_NEW
=%PREFIX
%/sbin
/vlock-new
8 VLOCK_NOSYSRQ
=%PREFIX
%/sbin
/vlock-nosysrq
9 VLOCK_CURRENT
=%PREFIX
%/sbin
/vlock-current
10 VLOCK_VERSION
=%VLOCK_VERSION
%
13 echo >&2 "vlock: locks virtual consoles, saving your current session."
14 echo >&2 "Usage: vlock [options]"
15 echo >&2 " Where [options] are any of:"
16 echo >&2 "-c or --current: lock only this virtual console, allowing user to"
17 echo >&2 " switch to other virtual consoles."
18 echo >&2 "-a or --all: lock all virtual consoles by preventing other users"
19 echo >&2 " from switching virtual consoles."
20 echo >&2 "-n or --new: allocate a new virtual console before locking,"
21 echo >&2 " implies --all."
22 echo >&2 "-s or --disable-sysrq: disable sysrq while consoles are locked to"
23 echo >&2 " prevent killing vlock with SAK, requires --all."
24 echo >&2 "-v or --version: Print the version number of vlock and exit."
25 echo >&2 "-h or --help: Print this help message and exit."
30 if [ -f "$1" ] && [ ! -x "$1" ] ; then
31 echo >&2 "vlock: cannot execute \`$1': Permission denied"
32 echo >&2 "Please check the documentation for more information."
40 local opts lock_all lock_new nosysrq
42 opts
=`getopt -o acnsvh --long current,all,new,disable-sysrq,version,help \
45 if [ $?
-ne 0 ] ; then
78 echo "vlock version $VLOCK_VERSION" >&2
83 echo "getopt error: $1" >&2
89 if [ $lock_new -ne 0 ] ; then
90 # work around an annoying X11 bug
94 if [ $lock_all -ne 0 ] ; then
96 The entire console display is now completely locked.
97 You will not be able to switch to another virtual console.
101 if [ $nosysrq -ne 0 ] ; then
102 if [ $lock_new -ne 0 ] ; then
108 checked_exec
"$VLOCK_NOSYSRQ"
109 elif [ $lock_new -ne 0 ] ; then
110 checked_exec
"$VLOCK_NEW"
112 checked_exec
"$VLOCK_ALL"
115 VLOCK_MESSAGE
="This TTY is now locked."
118 checked_exec
"$VLOCK_CURRENT"