Debian Codegraph @

sbin/drbl-autologin-home-reset

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 #
3 # drbl-autologin-home-reset: Reset autologin account's home directory as initial status. This script in usually run when client boots, i.e. make it as a service.
4 #
5 # Version: @(#) /etc/init.d/drbl-autologin-home-reset 1.0
6 #
7 # chkconfig: 35 99 99
8 # description: reset autologin account's home directory as initial status when system boot.
9 #
10 # For SuSE insserv
11 ### BEGIN INIT INFO
12 # Provides: drbl-autologin-home-reset
13 # Required-Start: nfs portmap
14 # Required-Stop: nfs portmap
15 # X-UnitedLinux-Should-Start:
16 # X-UnitedLinux-Should-Stop:
17 # Default-Start: 2 3 4 5
18 # Default-Stop: 0 1 2 6
19 # Description: Reset autologin account's home directory
20 ### END INIT INFO
21 #
22 # Author: Steven Shiau <steven _at_ clonezilla org>
23 # License: GPL
24 # Modified by Steven Shiau <steven _at_ clonezilla org> to be used in DRBL for RedHat
25
26 # Load DRBL setting and functions
27 DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
28
29 . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
30
31 #
32 check_if_root
33
34 # get the hostname and auto_login_id
35 # use client's hostname as the auto-login ID.
36 if [scip-shell system . . `[`. -e /etc/debian_versionscip-shell filesystem . . `/etc/debian_version`. ]; then
37 # Debian
38 auto_login_id="$(catscip-shell system . . cat. /etc/hostnamescip-shell filesystem . . `/etc/hostname`.)"
39 elif [scip-shell system . . `[`. -e /etc/SuSE-releasescip-shell filesystem . . `/etc/SuSE-release`. ]; then
40 # SuSE
41 # SuSE use hostname+domainname, like cat.suse.com.tw
42 auto_login_id="$(catscip-shell system . . cat. /etc/HOSTNAMEscip-shell filesystem . . `/etc/HOSTNAME`. | sedscip-shell system . . sed. -e "s/\..*//g")"
43 else
44 # RH-like
45 . /$SYSCONF_PATH/network
46 auto_login_id="$HOSTNAME"
47 fi
48 [scip-shell system . . `[`. -z "$auto_login_id" ] && echoscip-shell system . . echo. "No hostname, no autologin account... Program terminated!!!" && exit 1
49 # Thanks for Blake to prompt this. Since in client, we can not use /etc/passwd to get the account's home directory. It's NIS/YP.
50 USER_HOME_DIR=$(bashscip-shell system . . bash. -c "echo ~$auto_login_id")
51 auto_login_group="$(idscip-shell system . . id. -n -g $auto_login_id)"
52 if [scip-shell system . . `[`. -n "$USER_HOME_DIR" -a -d "$USER_HOME_DIR" ]; then
53 rsyncscip-shell system . . rsync. -a --delete --progress /etc/skel/scip-shell filesystem . . `/etc/skel/`. $USER_HOME_DIR/
54 chownscip-shell system . . chown. -R ${auto_login_id}:${auto_login_group} $USER_HOME_DIR/
55 fi