blob: a19854d9b0b0005d3c99c4ef4989f3b3268a0dd0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/bin/ash
grep -q '\bsplash\b' /proc/cmdline || exit 0
screen_size="$(fbset | awk '$1 = /geometry/ {print $2" "$3}')"
screen_width="${screen_size%% *}"
screen_height="${screen_size#* }"
[ "$screen_width" -gt 0 ] || exit 0
[ "$screen_height" -gt 0 ] || exit 0
fbsplash_cfg="/tmp/fbsplash.cfg"
fbsplash_ppm="/opt/openslx/images/kexec-reboot.ppm"
if [ -s "$fbsplash_ppm" ]; then
ppm_size="$(sed -n 2p "$fbsplash_ppm")"
else
exit 0
fi
ppm_width="${ppm_size%% *}"
ppm_height="${ppm_size#* }"
ppm_height="${ppm_height%% *}" # make sure nothing weird is trailing
img_left="$(( ( screen_width - ppm_width ) / 2 ))"
img_top="$(( ( screen_height - ppm_height ) / 2 ))"
# just checking if nothing too weird is set
if [ -n "$img_left" ] && [ -n "$img_top" ] \
&& [ "$img_left" -ge 0 ] && [ "$img_left" -lt 8096 ] \
&& [ "$img_top" -ge 0 ] && [ "$img_top" -lt 8096 ]; then
printf "IMG_TOP=%d\nIMG_LEFT=%d\n" \
"$img_top" "$img_left" \
> "$fbsplash_cfg"
kill -SIGRTMIN+21 1
echo -e "\033[?25l" > /dev/console
clear > /dev/console
fbsplash -b -i "$fbsplash_cfg" -s "$fbsplash_ppm"
rm -f -- "$fbsplash_cfg"
fi
exit 0
|