3 # Purpose: lock console
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 ################################################################################
11 [ -n "$USER" ] || USER=grml
13 if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
14 echo "${PN}: wrapper script to lock desktop
16 This script is a wrapper to lock your desktop session
17 through the vlock application.
19 Usage: just execute $PN without any further options."
22 if [ -r /etc/grml/script-functions ] ; then
23 . /etc/grml/script-functions
24 check4progs vlock sudo chpasswd dialog || { echo "Sorry, can't continue. Exiting.">&2 ; exit 1 }
27 if ! [ -r /etc/grml_version ] ; then
28 dialog --stdout --title "$PN" --msgbox "Warning: this system does not look like a grml (based) system
29 and therefore might not work as intended." 7 70
37 if sudo grep -q "$USER:\*:" /etc/shadow ; then
45 PASSWD1=$(dialog --stdout --title "$PN" --passwordbox "Set password (hidden typing):" 0 0)
46 PASSWD2=$(dialog --stdout --title "$PN" --passwordbox "Retype new password:" 0 0)
47 if [ "$PASSWD1" = "$PASSWD2" ] ; then
48 echo "$USER:$PASSWD2" | sudo chpasswd
50 dialog --stdout --title "$PN" --msgbox "Error: passwords to not match. Exiting." 0 0
56 dialog --stdout --title "$PN" --yesno "User $USER has no password set yet. Without a password you will not be able to log in again. Set password for user $USER?" 0 0
57 if [ "$?" -eq 0 ] ; then
67 is_passwd_set || askpwd
71 ## END OF FILE #################################################################