]> git.pld-linux.org Git - projects/geninitrd.git/blob - mod-bootsplash.sh
no need to mess with magic values, let the "magic" be value
[projects/geninitrd.git] / mod-bootsplash.sh
1 #!/bin/sh
2 BOOTSPLASH_RCSID='$Revision$ $Date::                            $'
3
4 # geninitrd mod: bootsplash
5 BOOT_SPLASH=${BOOT_SPLASH:-no}
6
7 # requires bootsplash package to operate
8
9 # setup geninitrd module
10 # @access       public
11 setup_mod_bootsplash() {
12         bootsplash_geninitramfs=$(find_tool /bin/splash.bin)
13         if [ ! -x "$bootsplash_geninitramfs" ]; then
14                 BOOT_SPLASH=no
15         fi
16
17         # NOTE: this check must be also in fbsplash module as the order of module load may change
18         if is_yes "$FB_SPLASH"  && is_yes "$BOOT_SPLASH"; then
19                 warn "bootsplash and fbsplash are exclusive!"
20         fi
21 }
22
23 # generate initrd fragment
24 # @access       public
25 initrd_gen_bootsplash() {
26         if ! is_yes "$BOOT_SPLASH"; then
27                 return
28         fi
29         local target="$1"
30
31         debug "Generating bootsplash"
32
33         if [ ! -x /bin/splash.bin ]; then
34                 warn "Failed to execute /bin/splash.bin. Is bootsplash package installed?"
35                 return
36         fi
37
38         if [ -r /etc/sysconfig/bootsplash ]; then
39                 . /etc/sysconfig/bootsplash
40         fi
41
42         if [ -z "$THEME" ]; then
43                 warn "Please configure your /etc/sysconfig/bootsplash first."
44                 warn "Generating bootsplashes skipped."
45                 return
46         fi
47
48         if [ -z "$BOOT_SPLASH_RESOLUTIONS" ]; then
49                 warn "No BOOT_SPLASH_RESOLUTIONS specified in /etc/sysconfig/bootsplash."
50                 warn "Not adding bootsplash to initrd."
51         fi
52
53         local res
54         for res in $BOOT_SPLASH_RESOLUTIONS; do
55                 if [ -f "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" ]; then
56                         $bootsplash_geninitramfs -s -f "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg" >> "$target" && \
57                         debug "Added $res $THEME theme to initrd."
58                 else
59                         warn "/etc/bootsplash/themes/$THEME/config/bootsplash-$res.cfg doesn't exist, skipped"
60                 fi
61         done
62 }
This page took 0.031661 seconds and 3 git commands to generate.