Debian Codegraph @

sbin/drbl-autologin-env-reset

raw symbols SCIP
1 #!/bin/bash
2 #
3 # description: reset autologin account's home directory as initial status.
4 #
5 # Author: Steven Shiau <steven _at_ clonezilla org>
6 # License: GPL
7
8 # Load DRBL setting and functions
9 DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
10
11 . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
12
13 #
14 check_if_root
15 #
16 usage() {
17 echo "Turn on/off the drbl-autologin-home-reset service."
18 echo "Usage: $0 [OPTION] [on|off]"
19 echo "Options:"
20 echo "-v, --verbose: verbose mode."
21 echo "-h, --host IP_ADDRESS: set only for the host with IP_ADDRESS instead of all DRBL clients"
22 }
23
24 # main
25 while [ $# -gt 0 ]; do
26 case "$1" in
27 -h|--host)
28 shift; specified_host="$1"
29 shift
30 ;;
31 -v|--verbose)
32 shift; verbose="on"
33 ;;
34 -*) echo "${0}: ${1}: invalid option" >&2
35 usage >& 2
36 exit 2 ;;
37 *) break ;;
38 esac
39 done
40
41 #
42 switch=$1
43
44 check_switch_on_off $switch
45
46 [ -n "$specified_host" ] && HOST_OPT="-h $specified_host"
47 #
48 case "$switch" in
49 on)
50 # copy drbl-autologin-home-reset to all clients.
51 drbl-cp-host $DRBL_SCRIPT_PATH/sbin/drbl-autologin-home-reset /etc/init.d/
52 # add it then turn on it.
53 drbl-client-service $HOST_OPT drbl-autologin-home-reset add
54 drbl-client-service $HOST_OPT drbl-autologin-home-reset on
55 ;;
56 off)
57 # delete it
58 drbl-client-service $HOST_OPT drbl-autologin-home-reset off
59 drbl-client-service $HOST_OPT drbl-autologin-home-reset del
60 ;;
61 *)
62 usage && exit 1
63 ;;
64 esac