aboutsummaryrefslogtreecommitdiffstats
path: root/gotrc-examples/commands
blob: 9bcf6697de972bf5c54d288eadefb22d4ef81561 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- shell-script -*-

# The module allows you to launch a few programs without even logging in


login_function_commands=$login_function
login_function=_login_commands

_login_commands ()
{
    if [ ! "${user}" = "" ] && [ "${user%%+*}" = "" ]; then
	if [ "${user}" = "+shutdown" ]; then
	    shutdown -h now
	elif [ "${user}" = "+reboot" ]; then
	    reboot
	elif [ "${user}" = "+time" ]; then
	    echo
	    date +%Y-\(%m\)%b-%d\ %T,\ %a\ w%W/%V,\ %Z
	    read __
	elif [ "${user}" = "+battery" ]; then
	    echo
	    acpi -V
	    read __
	elif [ "${user}" = "+backlight" ]; then
	    if [ "${LANG%UTF-8*}" = "${LANG}" ]; then
		export LANG="en_GB.UTF-8"
	    fi
	    adjbacklight
	else
	    cat <<EOF
Command is not recognised.
Recognised commands include:

+shutdown     Shutdown the computer
+reboot       Reboot the computer
+backlight    Adjust the backlight
EOF
	    read __
	fi
    else
	$login_function_commands
    fi
}