6168284d000cb432feffd439b9dc567b21821ea9
[grml-scripts.git] / usr_share / run-welcome
1 #!/bin/bash
2 # Filename:      run-welcome
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/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 # welcome beep
31 case "$CMDLINE" in
32   *\ nobeep*)
33     ;;
34   *)
35     (for f in 1000 2000 1500 1750; do beep -f $f -l 150; done) &
36     ;;
37 esac
38
39 case "$CMDLINE" in
40    # allow customized startup via bootoption startup:
41    *startup=*)
42        script="$(getBootParam startup)"
43        if [ -x $(which $script) ] ; then
44           $script
45        fi
46        ;;
47
48    # do nothing if booting with bootoption noquick:
49    *\ noquick*)
50       ;;
51    *) # by default run grml-quickconfig, but only if running as root
52       if [ "$(id -u)" = "0" ] ; then
53          which grml-quickconfig &>/dev/null && grml-quickconfig
54       fi
55 esac
56
57 # just print out an empty line if bootoption "nowelcome" is present
58 if grep -q nowelcome /proc/cmdline 2>/dev/null ; then
59   echo
60 # ... otherwise allow customized release information
61 elif [ -r /etc/release_info ] ; then
62   cat /etc/release_info
63 else # ... or finally fall back to grml's default
64   # display version information depending on the version:
65   if grep -q -- '-rc[0-9]' /etc/grml_version 2>/dev/null ; then
66      echo
67      echo
68      echo 'NOTICE: This is a release candidate version!'
69      echo 'Please notice that this is not yet a stable release.'
70      echo 'Please report any bugs you notice: http://grml.org/bugs/'
71      echo
72   fi
73
74   if grep -q 'grml-live-autobuild' /etc/grml_version 2>/dev/null ; then
75      echo
76      echo
77      echo 'NOTICE: This is a daily snapshot version!'
78      echo 'Please notice that this is not yet a stable release.'
79      echo 'See http://daily.grml.org/ for more details.'
80      echo 'Please report any bugs you notice: http://grml.org/bugs/'
81      echo
82   fi
83
84   echo "
85 Welcome to ${GRMLVERSION}!
86
87 New to ${distri}? Want to read some documentation?
88 Start via running 'grml-info'.
89 Get tips and hints via 'grml-tips \$KEYWORD'.
90 New to zsh? Run 'zsh-help'.
91
92 Switch to other consoles via alt-F<number> keys.
93
94 Happy hacking!               http://grml.org/
95 "
96 fi
97
98 exec /bin/zsh -l
99
100 ## END OF FILE #################################################################