Always execute grml-quickconfig if available.
[grml-scripts.git] / usr_bin / zsh-login
1 #!/bin/bash
2 # Filename:      zsh-login
3 # Purpose:       customized zsh login welcome screen for use at grml
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 ################################################################################
8
9 . /etc/grml/sh-lib
10
11 [ -r /etc/grml_version ] && GRMLVERSION=$(cat /etc/grml_version) || GRMLVERSION='(no version information available)'
12 PATH=$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/games:/home/grml/bin
13 CMDLINE=$(cat /proc/cmdline)
14 [ -n "$distri" ] || distri="grml"
15
16 # Activate unicode console if running within utf8 environment
17 # Dirty hack to fix unicode issue on amd64...
18 # unicode_start during bootprocess just does not work reliable :(
19 NUM_CONSOLES=12
20 if [ -r /etc/default/locale ] ; then
21    if grep -q "LANG=.*UTF" /etc/default/locale ; then
22        for vc in `seq 1 ${NUM_CONSOLES}` ; do
23            echo -n -e '\033%G' > /dev/tty${vc}
24        done
25        kbd_mode -u
26        dumpkeys | loadkeys --unicode > /dev/null
27    fi
28 fi
29
30 case "$CMDLINE" in
31    # allow customized startup via bootoption startup:
32    *startup=*)
33        script="$(getBootParam startup)"
34        if [ -x $(which $script) ] ; then
35           $script
36        fi
37        ;;
38    # turn on speakers for accessibility users:
39    *\ swspeak*|*blind*|*brltty*|*speakup*)
40       if [ $(which flite) ] ; then
41          flite -o play -t "Finished booting"
42       fi
43       ;;
44
45    # do nothing if booting with bootoption noquick:
46    *\ noquick*)
47       ;;
48    *) # by default run grml-quickconfig, but only if running as root
49       if [ "$(id -u)" = "0" ] ; then
50          which grml-quickconfig &>/dev/null && grml-quickconfig
51       fi
52 esac
53
54 # just print out an empty line if bootoption "nowelcome" is present
55 if grep -q nowelcome /proc/cmdline 2>/dev/null ; then
56   echo
57 # ... otherwise allow customized release information
58 elif [ -r /etc/release_info ] ; then
59   cat /etc/release_info
60 else # ... or finally fall back to grml's default
61   # display version information depending on the version:
62   if grep -q -- '-rc[0-9]' /etc/grml_version 2>/dev/null ; then
63      echo
64      echo
65      echo 'NOTICE: This is a release candidate version!'
66      echo 'Please notice that this is not yet a stable release.'
67      echo 'See http://wiki.grml.org/doku.php?id=release_candidate for known issues.'
68      echo 'Please report any bugs you notice: bugs@grml.org'
69      echo
70   fi
71
72   if grep -q 'grml-live-autobuild' /etc/grml_version 2>/dev/null ; then
73      echo
74      echo
75      echo 'NOTICE: This is a daily snapshot version!'
76      echo 'Please notice that this is not yet a stable release.'
77      echo 'See http://daily.grml.org/ for more details.'
78      echo 'Please report any bugs you notice: daily@grml.org'
79      echo
80   fi
81
82   echo "
83 Welcome to ${GRMLVERSION}!
84
85 New to ${distri}? Want to read some documentation?
86 Start via running 'grml-info'.
87 Get tips and hints via 'grml-tips \$KEYWORD'.
88 New to zsh? Run 'zsh-help'.
89
90 Switch to other consoles via alt-F<number> keys.
91
92 Happy hacking!               http://grml.org/
93 "
94 fi
95
96 exec /bin/zsh -l
97
98 ## END OF FILE #################################################################