aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/detect-resolution60
-rwxr-xr-xscripts/make-boot-splash2
-rwxr-xr-xscripts/rewritejpeg22
3 files changed, 61 insertions, 23 deletions
diff --git a/scripts/detect-resolution b/scripts/detect-resolution
index 4155613..9ea3519 100755
--- a/scripts/detect-resolution
+++ b/scripts/detect-resolution
@@ -6,14 +6,21 @@
#
# Detect vga resolution we want.
#
+# add better detection thanks to Olivier Blin idea to use argument from
+# make_boot_splash.
#use strict;
-my (%main, %entry);
+my (%main, %entry, $vga, $initrd);
-my $vga = detect_from_cmdline(cat_('/proc/cmdline'));
-undef $vga if $vga =~ /x/; #lilo cmdline can't convert
+if ($ARGV[0]) {
+ $initrd = $ARGV[0];
+ $initrd =~ s,.*/,,
+} else {
+ $vga = detect_from_cmdline(cat_('/proc/cmdline'));
+ undef $vga if $vga =~ /x/; #lilo cmdline can't convert
+}
-detect_from_loader() if not $vga;
+detect_from_loader() if !$vga;
if ($vga) {
chomp $vga;
$vga =~ s/vga=//;
@@ -26,17 +33,21 @@ sub detect_from_loader {
my $loader = `detectloader -q`;chomp $loader;
if ($loader =~ m/lilo/i ) {
parse_lilo_conf();
- $vga = $entry{$main{default}}{vga};
- $vga = $main{vga} if not $vga;
} elsif ($loader =~ /grub/i ) {
parse_grub_conf();
- $vga = detect_from_cmdline($entry{$main{default}}{options});
}
+ if ($initrd) {
+ $vga = $main{initrd}{$initrd}
+ }
+ $vga ||= $entry{$main{default}}{vga};
+ $vga ||= $main{vga}
+ print "VGA ($vga) main $main{vga} initrd $initrd ($main{initrd}{$initrd})\n";
}
sub parse_grub_conf {
my ($title);
my $cnt = 0;
my $grub_conf = "/boot/grub/menu.lst";
+ my $vga;
return if not -f $grub_conf;
open F, $grub_conf or die "Can't open $grub_conf\n";
@@ -44,20 +55,20 @@ sub parse_grub_conf {
next if /^\s*#/;
$main{default} = $1 if /^default (\d+)/;
if (/^title\s+(.*)/) {
+ $vga=0;
$title=$1;
- $entry{$title}{title} = $title;
$entry{$title}{cnt} = $cnt;
$main{default} = $title if $entry{$title}{cnt} eq $main{default};
$cnt++;
}
- if (m/kernel\s+(\(.*\))([^\s]+)\s+(.*)/) {
- $entry{$title}{partition} = $1;
- $entry{$title}{kernel} = $2;
- $entry{$title}{options} = $3;
+ if (m/kernel\s+\(.*\)[^\s]+/) {
$vga = $1 if /vga=(.*)/;
- $entry{$title}{vga} = $vga if ($label and $vga);
+ $entry{$title}{vga} = $vga if ($title and $vga);
+ }
+ if (m,initrd\s+\(.*\)(?:.*/)?([^\s]+),){
+ $entry{$title}{initrd} = $1;
+ $main{initrd}{$1} = $entry{$title}{vga}
}
- $entry{$title}{initrd} = $1 if m/\s*initrd.*\)(.*)/;
}
close F;
}
@@ -72,9 +83,24 @@ sub parse_lilo_conf {
$main{default} = $1 if m/^default=(.*)/;
$main{vga} = $1 if m/^vga=(.*)/;
$vga = $1 if /vga=(.*)/;
- $label=$1 if /label=(.*)/;
- $entry{$label}{vga} = $vga if ($label and $vga);
- undef $vga if (/image=/ and $vga);
+ $label = $1 if /label=(.*)/;
+ $loc_initrd = $1 if m,initrd=(?:.*/)?(.*),;
+ $entry{$label}{vga} = $vga if ($label && $vga);
+ if (/image/) {
+ undef $vga,$label;
+ if ($loc_initrd && $label && $vga) {
+ $entry{$label}{initrd} = $loc_initrd;
+ if (!$main{initrd}{$loc_initrd} || $main{default} eq $label) {
+ $main{initrd}{$loc_initrd} = $vga
+ }
+ }
+ }
+ }
+ if ($loc_initrd && $label && $vga) {
+ $entry{$label}{initrd} = $loc_initrd;
+ if (!$main{initrd}{$loc_initrd} || $main{default} eq $label) {
+ $main{initrd}{$loc_initrd} = $vga
+ }
}
close F;
}
diff --git a/scripts/make-boot-splash b/scripts/make-boot-splash
index df0de03..9a4b4c2 100755
--- a/scripts/make-boot-splash
+++ b/scripts/make-boot-splash
@@ -21,7 +21,7 @@ initrd_file=$1
vgamode=$2
if [[ -z $vgamode || $vgamode == auto ]];then
- vgamode=$( $splash_dir/scripts/detect-resolution )
+ vgamode=$( $splash_dir/scripts/detect-resolution $initrd_file)
fi
if [[ $vgamode == 640* ]];then
diff --git a/scripts/rewritejpeg b/scripts/rewritejpeg
index b2e36ea..21822c7 100755
--- a/scripts/rewritejpeg
+++ b/scripts/rewritejpeg
@@ -6,6 +6,11 @@
#
# Take a Jpeg and reconvert it via ppm-tools to make sure is
# compatible for boot logo
+#
+# Modified by Olivier Blin on October 30, 2003.
+# grayscale jpeg support.
+# it's perhaps better to use "convert -type TrueColor"
+#
# $Id$
files="$@"
@@ -20,10 +25,17 @@ for file in $files;do
echo "$file is not a jpeg"
continue;
}
- echo "Converting $file"
- tmp=${file/.jpg/.ppm}
- jpegtopnm $file > $tmp
- ppmtojpeg $tmp > $file
- rm -f $tmp
+ tmp_ppm=${file/.jpg/.ppm}
+ output=`jpegtopnm $file 2>&1 > $tmp_ppm`
+ echo $output
+ if [[ $output == *PGM* ]]; then
+ tmp_pgm=${file/.jpg/.pgm}
+ mv $tmp_ppm $tmp_pgm
+ echo "(converting PGM file into PPM file)"
+ pgmtoppm grey $tmp_pgm > $tmp_ppm
+ rm -f $tmp_pgm
+ fi
+ ppmtojpeg $tmp_ppm > $file
+ rm -f $tmp_ppm
done