network: don't use "ifup -m"
[dracut.git] / modules.d / 50gensplash / module-setup.sh
blobd2fccc26bb2225b0b98a316b959f419af5affd69
1 #!/bin/bash
3 # called by dracut
4 check() {
5 # TODO: splash_geninitramfs
6 # TODO: /usr/share/splashutils/initrd.splash
7 return 255
10 # called by dracut
11 depends() {
12 return 0
15 # called by dracut
16 install() {
17 local _opts
18 local _splash_theme
19 local _splash_res
21 call_splash_geninitramfs() {
22 local _out _ret
24 _out=$(splash_geninitramfs -c "$1" ${@:2} 2>&1)
25 _ret=$?
27 if [[ ${_out} ]]; then
28 local IFS='
30 for line in ${_out}; do
31 if [[ ${line} =~ ^Warning ]]; then
32 dwarn "${line}"
33 else
34 derror "${line}"
35 (( $_ret == 0 )) && _ret=1
37 done
40 return ${_ret}
43 type -P splash_geninitramfs >/dev/null || return 1
45 _opts=''
46 if [[ ${DRACUT_GENSPLASH_THEME} ]]; then
47 # Variables from the environment
48 # They're supposed to be set up by e.g. Genkernel in basis of cmdline args.
49 # If user set them he/she would expect to be included only given theme
50 # rather then all even if we're building generic initramfs.
51 _splash_theme=${DRACUT_GENSPLASH_THEME}
52 _splash_res=${DRACUT_GENSPLASH_RES}
53 elif [[ ${hostonly} ]]; then
54 # Settings from config only in hostonly
55 [[ -e /etc/conf.d/splash ]] && source /etc/conf.d/splash
56 [[ ! ${_splash_theme} ]] && _splash_theme=default
57 [[ ${_splash_res} ]] && _opts+=" -r ${_splash_res}"
58 else
59 # generic
60 _splash_theme=--all
63 dinfo "Installing Gentoo Splash (using the ${_splash_theme} theme)"
65 pushd "${initdir}" >/dev/null
66 mv dev dev.old
67 call_splash_geninitramfs "${initdir}" ${_opts} ${_splash_theme} || {
68 derror "Could not build splash"
69 return 1
71 rm -rf dev
72 mv dev.old dev
73 popd >/dev/null
75 inst_multiple chvt
76 inst /usr/share/splashutils/initrd.splash /lib/gensplash-lib.sh
77 inst_hook pre-pivot 90 "${moddir}"/gensplash-newroot.sh
78 inst_hook pre-trigger 10 "${moddir}"/gensplash-pretrigger.sh
79 inst_hook emergency 50 "${moddir}"/gensplash-emergency.sh