aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/remove-boot-splash
blob: 07a9982f762232a63245de7aa55b78258dff02f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

@ARGV == 1 or die "usage: remove-splash <initrd>\n";

my ($initrd) = @ARGV;

# FIXME it must have a clear way to do that in perl
if (!system("/bin/zcat $initrd 2> /dev/null | /bin/cpio -t &> /dev/null")) {
    print STDERR "remove-boot-splash: initrd in initramfs format\n";
    chomp(my $tmp_dir = `mktemp -d`);
    chdir $tmp_dir;
    system("/bin/zcat $initrd 2>/dev/null | /bin/cpio -id 2>/dev/null");
    if (-d "$tmp_dir/usr/share/plymouth") {
	system("rm -fr $tmp_dir/usr/share/plymouth $tmp_dir/usr/lib/plymouth $tmp_dir/usr/lib/libply* $tmp_dir/lib/libply* $tmp_dir/bin/plymouthd $tmp_dir/bin/plymouth $tmp_dir/etc/splashy $tmp_dir/usr/share/splashy");
	print STDERR "remove-boot-splash: removing plymouth from initrd\n";
	system("/bin/find . -print | /bin/cpio --quiet -c -o 2> /dev/null | gzip -c > $initrd")
    } else {
	print STDERR "ERROR remove-boot-splash: plymouth not found in $initrd\n"
    }
    system("rm -rf $tmp_dir");
    exit
}

warn "remove-splash: format of $initrd not recognized\n";