3 # bootsplash2fbsplash -- theme conversion utility
4 # (c) 2004-2005 Michal Januszewski <spock@gentoo.org>
6 # Usage: bootsplash2fbsplash [--remove-comments] <theme_name>
9 $path_bp = "@sysconfdir@/bootsplash/";
10 $path_fbspl = "@themedir@";
16 print "bootsplash2fbsplash theme converter / splashutils-@PACKAGE_VERSION@\n";
17 print '(c) 2004-2005 Michal Januszewski <spock@gentoo.org>'."\n\n";
18 print "Usage: bootsplash2fbsplash [--remove-comments] <theme_name>\n";
23 while ($arg = shift @args) {
24 if ($arg eq "--remove-comments") {
26 } elsif ($arg eq "--bootsplash-path") {
27 $path_bp = shift @args;
28 } elsif ($arg eq "--fbsplash-path") {
29 $path_fbspl = shift @args;
35 if ($#ARGV < 0 || $theme eq "") {
41 $path_fbspl =~ s
#//#/#g;
43 $cfgroot = "$path_bp/$theme/config";
44 $fbspl_images = "$path_fbspl/$theme/images";
46 opendir(DIR
, "$cfgroot") || die "Can't open $cfgroot: $!";
47 @configs = grep { /\.cfg$/ && /bootsplash/ && -f
"$cfgroot/$_" } readdir(DIR
);
50 foreach $cfg (@configs) {
51 $cfg =~ /(\d+)x(\d+)/;
55 `mkdir -p $fbspl_images`;
57 open(IN
, "<$cfgroot/$cfg");
58 open(OUT
, ">$path_fbspl/$theme/${xres}x${yres}.cfg");
60 @known_keyw = ("bgcolor", "tx", "ty", "tw", "th", "text_x", "text_y",
61 "text_size", "text_color");
64 while ($line = <IN
>) {
66 if ($line =~ /^\s*#/ || $line =~ /^\s*$/ || $line =~ /^\s*box /) {
68 } elsif ($line =~ /(silent)?jpeg=(.*)$/) {
78 $t = "$fbspl_images/$t-${xres}x${yres}.jpg";
82 `cp -fp -H "$2" "$t"`;
84 print "Error: $2 not found!\n"
87 foreach $key (@known_keyw) {
88 if ($line =~ /^\s*$key=/) {
97 if ($line =~ /^\s*#/) {
99 } elsif ($line =~ /^\s*$/) {
111 $a = `md5sum "$fbspl_images/silent-${xres}x${yres}.jpg" 2>/dev/null | cut -f1 -d' '`;
112 $b = `md5sum "$fbspl_images/verbose-${xres}x${yres}.jpg" 2>/dev/null | cut -f1 -d' '`;
118 `rm -f "$fbspl_images/silent-${xres}x${yres}.jpg"`;
119 `ln -s "$fbspl_images/verbose-${xres}x${yres}.jpg" "$fbspl_images/silent-${xres}x${yres}.jpg"`;
125 print "o Parsed $cfg (${xres}x${yres})\n";