Merge branch 'master' of git+ssh://repo.or.cz/srv/git/fbsplash
[fbsplash.git] / gentoo / initrd.splash
blob2aa4225cf7b20af7bd75f2488dc6c438aeab8691
1 # Copyright 1999-2005 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # Author: Michal Januszewski <spock@gentoo.org>
5 # Maintainer: Michal Januszewski <spock@gentoo.org>
7 # This file is a part of splashutils.
9 # NOTE: The code here has to be compatible with ash and with the busybox
10 #       versions of all the standard system utilities. That means: no
11 #       extended regular expressions, no pattern substitution in variables,
12 #       and no fancy GNU command line options.
14 splash() {
15         local cmd="$1"
16         splash_setup
18         [ ! -x /sbin/fbcondecor_helper ] && return
19         [ "${SPLASH_MODE_REQ}" != 'silent' ] && return
21         case "${cmd}" in
22                 set_msg)
23                         export BOOT_MSG="$2"
24                         /sbin/fbcondecor_helper 2 'repaint'
25                         ;;
26                 init)
27                         if [ -n "$2" ]; then
28                                 export BOOT_MSG="$2"
29                         elif [ "${CDROOT}" -eq '1' ]; then
30                                 export BOOT_MSG="Preparing the LiveCD environment... Press Alt+F1 for verbose mode."
31                         else
32                                 export BOOT_MSG="Preparing the system for boot... Press Alt+F1 for verbose mode."
33                         fi
34                         /sbin/fbcondecor_helper 2 'repaint'
35                         ;;
36                 verbose)
37                         if [ -x /bin/chvt ]; then
38                                 /bin/chvt 1
39                         elif [ -x /bin/busybox ]; then
40                                 /bin/busybox chvt 1
41                         fi
42                         ;;
43         esac
46 splash_setup() {
47         # If it's already set up, let's not waste time on parsing the config
48         # files again
49         if [ "${SPLASH_THEME}" != '' -a "${SPLASH_TTY}" != '' -a "$1" != 'force' ]; then
50                 return 0
51         fi
53         export SPLASH_MODE_REQ="off"
54         export SPLASH_THEME="default"
55         export SPLASH_TTY="16"
56         export SPLASH_KDMODE="TEXT"
58         if [ -f /proc/cmdline ]; then
59                 options=$(sed -e 's/.*splash=\([^ ]*\).*/\1/' -e 's/,/ /g' /proc/cmdline)
61                 for i in ${options} ; do
62                         case ${i%:*} in
63                                 theme)          SPLASH_THEME=${i#*:} ;;
64                                 tty)            SPLASH_TTY=${i#*:} ;;
65                                 verbose)        SPLASH_MODE_REQ="verbose" ;;
66                                 silent)         SPLASH_MODE_REQ="silent" ;;
67                                 kdgraphics)     SPLASH_KDMODE="GRAPHICS" ;;
68                         esac
69                 done
70         fi