usr_share/run-screen: Fix a couple of shellcheck warnings
[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 # shellcheck disable=SC1091
10 . /etc/grml/sh-lib
11
12 [ -r /etc/grml_version ] && GRMLVERSION=$(cat /etc/grml_version) || GRMLVERSION='(no version information available)'
13 PATH=$HOME/bin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/usr/games:/home/grml/bin
14 CMDLINE=$(cat /proc/cmdline)
15 [ -n "$distri" ] || distri="grml"
16
17 # welcome beep
18 case "$CMDLINE" in
19   *\ nobeep*)
20     ;;
21   *)
22     (for f in 1000 2000 1500 1750; do beep -f $f -l 150; done) &
23     ;;
24 esac
25
26 case "$CMDLINE" in
27    # allow customized startup via bootoption startup:
28    *startup=*)
29        script="$(getBootParam startup)"
30        if [ -x "$(command -v "$script")" ] ; then
31           $script
32        fi
33        ;;
34
35    # do nothing if booting with bootoption noquick:
36    *\ noquick*)
37       ;;
38    *) # by default run grml-quickconfig, but only if running as root
39       if [ "$(id -u)" = "0" ] ; then
40          command -v grml-quickconfig &>/dev/null && grml-quickconfig
41       fi
42 esac
43
44 # just print out an empty line if bootoption "nowelcome" is present
45 if grep -q nowelcome /proc/cmdline 2>/dev/null ; then
46   echo
47 # ... otherwise allow customized release information
48 elif [ -r /etc/release_info ] ; then
49   cat /etc/release_info
50 else # ... or finally fall back to grml's default
51   # display version information depending on the version:
52   if grep -q -- '-rc[0-9]' /etc/grml_version 2>/dev/null ; then
53      echo
54      echo
55      echo 'NOTICE: This is a release candidate version!'
56      echo 'Please notice that this is not yet a stable release.'
57      echo 'Please report any bugs you notice: http://grml.org/bugs/'
58      echo
59   fi
60
61   if grep -q 'grml-live-autobuild' /etc/grml_version 2>/dev/null ; then
62      echo
63      echo
64      echo 'NOTICE: This is a daily snapshot version!'
65      echo 'Please notice that this is not yet a stable release.'
66      echo 'See http://daily.grml.org/ for more details.'
67      echo 'Please report any bugs you notice: http://grml.org/bugs/'
68      echo
69   fi
70
71   echo "
72 Welcome to ${GRMLVERSION}!
73
74 New to ${distri}? Want to read some documentation?
75 Start via running 'grml-info'.
76 Get tips and hints via 'grml-tips \$KEYWORD'.
77 New to zsh? Run 'zsh-help'.
78
79 Switch to other consoles via alt-F<number> keys.
80
81 Happy hacking!               http://grml.org/
82 "
83 fi
84
85 exec /bin/zsh -l
86
87 ## END OF FILE #################################################################