themes: properly link themes with their archives
[fbsplash.git] / themes / makeshots.sh
blob1fac5c395b754c062c11e9cc3dc0a25126ccf832
1 #!/bin/bash
2 # A simple script to take screenshots of fbsplash themes.
3 # (c) 2007, Michal Januszewski <spock@gentoo.org>
5 # A temporary theme name. There should be no existing
6 # fbsplash theme
7 tmptheme="tmp123456"
9 splash_send() {
10 echo "$*" > /lib/splash/cache/.splash
13 # Save the original fb geometry
14 xres=$(fbset | grep geometry | awk '{print $2}')
15 yres=$(fbset | grep geometry | awk '{print $3}')
17 # Set a standard resolution on all consoles
18 sx=1024
19 sy=768
21 fbset -a -xres ${sx} -yres ${sy}
23 . /sbin/splash-functions.sh
24 splash_setup
26 for i in unpacked/* ; do
27 theme=${i//unpacked\//}
29 if [ ! -d "unpacked/${theme}" -o ! -e "unpacked/${theme}/metadata.xml" ]; then
30 continue
33 rm -rf "/etc/splash/${tmptheme}"
34 mkdir /etc/splash/${tmptheme}
35 cp -r unpacked/${theme}/* /etc/splash/${tmptheme}/
37 # Fix broken config files using absolute path names.
38 sed -i -re 's#/+etc/splash/+[^/]*/##' /etc/splash/${tmptheme}/*.cfg
40 export RUNLEVEL="S"
41 export SOFTLEVEL=""
42 export SPLASH_THEME="${tmptheme}"
43 export SPLASH_XRES=${sx}
44 export SPLASH_YRES=${sy}
46 if [ -x "/etc/splash/${tmptheme}/scripts/rc_init-pre" ]; then
47 /etc/splash/${tmptheme}/scripts/rc_init-pre sysinit
50 if [ -x "/etc/splash/${tmptheme}/scripts/rc_init-post" ]; then
51 /etc/splash/${tmptheme}/scripts/rc_init-post sysinit
54 fbsplashd -t ${tmptheme}
56 if [ "$?" != "0" ]; then
57 echo "Failed to load theme '${theme}'." >&2
58 fbset -xres ${xres} -yres ${yres}
59 exit 1
62 # FIXME: script event hooks should be used for update_svc below.
63 # Simulate the initial part of the boot sequence.
64 splash_send "set message Booting the system (\$progress%)..."
65 splash_send "progress 16390"
66 splash_send "update_svc clock svc_inactive_start"
67 splash_send "update_svc device-mapper svc_inactive_start"
68 splash_send "update_svc lvm svc_inactive_start"
69 splash_send "update_svc checkroot svc_inactive_start"
70 splash_send "update_svc modules svc_inactive_start"
71 splash_send "update_svc checkfs svc_inactive_start"
72 splash_send "update_svc localmount svc_inactive_start"
73 splash_send "update_svc hostname svc_inactive_start"
74 splash_send "update_svc hibernate-cleanup svc_inactive_start"
75 splash_send "update_svc bootmisc svc_inactive_start"
76 splash_send "update_svc alsasound svc_inactive_start"
77 splash_send "update_svc dbus svc_inactive_start"
78 splash_send "update_svc bluetooth svc_inactive_start"
79 splash_send "update_svc keymaps svc_inactive_start"
80 splash_send "update_svc consolefont svc_inactive_start"
81 splash_send "update_svc net.lo svc_inactive_start"
82 splash_send "update_svc net.eth0 svc_inactive_start"
83 splash_send "update_svc rmnologin svc_inactive_start"
84 splash_send "update_svc udev-postmount svc_inactive_start"
85 splash_send "update_svc urandom svc_inactive_start"
86 splash_send "update_svc syslog-ng svc_inactive_start"
87 splash_send "update_svc acpid svc_inactive_start"
88 splash_send "update_svc fbcondecor svc_inactive_start"
89 splash_send "update_svc gpm svc_inactive_start"
90 splash_send "update_svc xdm svc_inactive_start"
91 splash_send "update_svc cpufrequtils svc_inactive_start"
92 splash_send "update_svc hddtemp svc_inactive_start"
93 splash_send "update_svc net.wlan0 svc_inactive_start"
94 splash_send "update_svc spamd svc_inactive_start"
95 splash_send "update_svc postfix svc_inactive_start"
96 splash_send "update_svc sshd svc_inactive_start"
97 splash_send "update_svc vixie-cron svc_inactive_start"
98 splash_send "update_svc local svc_inactive_start"
99 splash_send "update_svc clock svc_started"
100 splash_send "update_svc device-mapper svc_started"
101 splash_send "update_svc lvm svc_started"
102 splash_send "update_svc bootmisc svc_started"
103 splash_send "update_svc alsasound svc_started"
104 splash_send "update_svc checkroot svc_started"
105 splash_send "update_svc hostname svc_started"
106 splash_send "update_svc modules svc_started"
107 splash_send "update_svc checkfs svc_started"
108 splash_send "update_svc localmount svc_started"
109 splash_send "update_svc keymaps svc_started"
110 splash_send "set mode silent"
111 splash_send "repaint"
113 sleep 1
114 fbgrab "shots/${sx}x${sy}-${theme}.png"
116 splash_send "exit"
118 export RUNLEVEL="3"
120 if [ -x "/etc/splash/${tmptheme}/scripts/rc_exit-pre" ]; then
121 /etc/splash/${tmptheme}/scripts/rc_exit-pre default
124 if [ -x "/etc/splash/${tmptheme}/scripts/rc_exit-post" ]; then
125 /etc/splash/${tmptheme}/scripts/rc_exit-post default
128 # Take a screenshot of the verbose splash (fbcondecor)
129 if [ -e /etc/splash/${tmptheme}/${sx}x${sy}.cfg -a \
130 -n "$(grep '^pic=' /etc/splash/${tmptheme}/${sx}x${sy}.cfg)" -o \
131 -n "$(grep '^jpeg=' /etc/splash/${tmptheme}/${sx}x${sy}.cfg)" ]; then
132 fbcondecor_ctl -t ${tmptheme} --tty=16 -c setcfg
133 fbcondecor_ctl -t ${tmptheme} --tty=16 -c on
134 chvt 16
135 sleep 1
136 top -n 1 >/dev/tty16
137 fbgrab "shots/${sx}x${sy}-${theme}-fbcondecor.png"
138 chvt 1
140 done
142 # Restore the initial resolution
143 fbset -a -xres ${xres} -yres ${yres}