]> git.pld-linux.org Git - packages/bootsplash.git/blob - bootsplash-bootanim.script
- new
[packages/bootsplash.git] / bootsplash-bootanim.script
1 #!/bin/bash
2 #
3 # bootanim - boot animation wrapper script for fbmngplay
4
5 # This program parses /etc/bootsplash/[THEME]/config/bootsplash-XxY.cfg
6 # to determine the correct animation position.
7
8 # This program is free software; you may redistribute it under the terms 
9 # of the GNU General Public License. This program has absolutely no warranty.
10 #
11 # (C) 2002,2003 SuSE Linux AG. Written by Stefan Reinauer <stepan@suse.de>
12 #
13 # See http://www.bootsplash.org/ for more information.
14 #
15
16 usage()
17 {
18     echo "usage: $0 [start|stop|kill|next] -m [-r XxY] [-d dir] mng1 [mng2..]"
19     cat << EOF
20
21   Available commands:
22         start           starts given animation
23         stop            fades out all running animations
24         kill            immediately stops all animations
25         next            continue to next animation.
26
27   Options for use with start command:
28         -r XxY          screen resolution to use if unable to autodetect.
29         -d dir          directory containing the animation files
30         -m              play multiple animations
31         mng1|mng2       animation filename(s). Specify -m if multiple.
32
33 EOF
34
35 }
36
37 if [ "$UID" -ne "0" ]; then
38     echo "$0 must be started as user root!!!"
39     echo "Exiting..."
40     exit 1
41 fi
42
43 THEME="No theme selected"
44 test -f /etc/sysconfig/bootsplash && . /etc/sysconfig/bootsplash
45
46 if [ ! -d /etc/bootsplash/themes/$THEME ]
47 then
48   echo "$0: could not find theme $THEME in /etc/bootsplash/themes."
49   exit 0
50 fi
51
52 MODE=`/sbin/fbresolution 2>/dev/null`
53 DIRECTORY=/etc/bootsplash/themes/$THEME/animations
54 OPTIONS="-b -c 1"
55 FILES=""
56
57 case "$1" in
58 start)
59         # echo "$0 start"
60         # We fall through here.
61         ;;
62 stop)
63         # echo "$0 stop"
64         killall -q -2 fbmngplay
65         exit 0
66         ;;
67 kill)
68         # echo "$0 kill"
69         killall -q fbmngplay
70         exit 0
71         ;;
72 next) 
73         # echo "$0 next"
74         killall -q -USR1 fbmngplay
75         exit 0
76         ;;
77 *)
78         usage;
79         echo "  Error: illegal parameter.";
80         exit 1
81         ;;
82 esac
83
84 shift
85
86 # We end up in bootanim start 
87
88 TEMP=`getopt -o mr:d:  -- "$@"`
89 eval set -- "$TEMP"
90
91 while true ; do
92         # echo "loop: $*"
93         case "$1" in
94         -d) # directory
95                 shift
96                 if [ ! -d "$1" ]; then
97                         echo "Not a valid directory."
98                         exit 1
99                 fi
100                 DIRECTORY=$1
101                 shift
102                 ;;
103         -r) # resolution 
104                 shift
105                 MODE=$1;
106                 shift
107                 ;;
108         -m) # multiple files
109                 shift
110                 OPTIONS="$OPTIONS -s"
111                 ;;
112         --) # end
113                 shift
114                 break;;
115         *) # Weird
116                 echo "Internal Error."
117                 exit 1
118                 ;;
119         esac
120 done
121
122 function box() { true; } # ignore box descriptions in the config file
123
124 # Sourcing config file
125 if [ -f /etc/bootsplash/themes/$THEME/config/bootsplash-$MODE.cfg ]; then
126     . /etc/bootsplash/themes/$THEME/config/bootsplash-$MODE.cfg
127 else
128     echo "$0: No config file found for theme $THEME ($MODE)."
129     exit 1
130 fi
131
132 # echo "Dir:   $DIRECTORY"
133 # echo "Files: $*"
134 # echo "Mode:  $MODE"
135 # echo "Pos:  $ax,$ay"
136 # echo "options: $OPTIONS"
137
138 CMDLINE="fbmngplay -x $ax -y $ay $OPTIONS"
139 for i in $*; do
140     CMDLINE="$CMDLINE $DIRECTORY/$i"
141 done
142
143 eval "$CMDLINE &"
This page took 0.083866 seconds and 3 git commands to generate.