summaryrefslogtreecommitdiffstats
path: root/rescue
diff options
context:
space:
mode:
Diffstat (limited to 'rescue')
-rw-r--r--rescue/devices.pl52
-rw-r--r--rescue/list21
-rwxr-xr-xrescue/make_rescue_img46
3 files changed, 80 insertions, 39 deletions
diff --git a/rescue/devices.pl b/rescue/devices.pl
new file mode 100644
index 000000000..9dbd90366
--- /dev/null
+++ b/rescue/devices.pl
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+
+@ARGV == 1 && chdir $ARGV[0] or die "usage: devices.pl <dir>\n";
+
+if ($>) { $sudo = "sudo"; $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; }
+
+foreach (<DATA>) {
+ chomp;
+ my ($typ, $maj, $min, @l) = split;
+ foreach (@l) {
+ my @l2 = do {
+ if (my ($prefix, $ini, $end) = /(.*)(\d+)-(\d+)$/) {
+ map { "$prefix$_" } $ini .. $end;
+ } else {
+ $_;
+ }
+ };
+ system("$sudo mknod $_ $typ $maj " . $min++) foreach @l2;
+ }
+}
+
+__DATA__
+c 5 1 console
+b 2 0 fd0-1
+c 0 0 initctl
+c 1 2 kmem
+b 7 0 loop0-15
+c 1 1 mem
+c 1 3 null
+c 1 4 port
+b 1 1 ram
+b 1 0 ram0-19
+b 1 0 ramdisk
+c 1 8 random
+b 11 0 scd0-7
+c 0 0 stderr
+c 0 0 stdin
+c 0 0 stdout
+c 5 0 tty
+c 4 0 tty0-9
+c 4 64 ttyS0-3
+c 1 9 urandom
+c 1 5 zero
+b 3 0 hda hda1-16
+b 3 64 hdb hdb1-16
+b 22 0 hdc hdc1-16
+b 22 64 hdd hdd1-16
+b 33 0 hde hde1-16
+b 33 64 hdf hdf1-16
+b 34 0 hdg hdg1-16
+b 34 64 hdh hdh1-16
+b 8 0 sda sda1-15 sdb sdb1-15 sdc sdc1-15 sdd sdd1-15 sde sde1-15 sdf sdf1-15 sdg sdg1-15 sdh sdh1-15
diff --git a/rescue/list b/rescue/list
index eea7dd1b9..e7e690567 100644
--- a/rescue/list
+++ b/rescue/list
@@ -42,27 +42,6 @@
/bin/touch
/bin/true
/bin/umount
-/dev/console
-/dev/fd[01]
-/dev/hd[a-h]*
-/dev/initctl
-/dev/kmem
-/dev/loop*
-/dev/mem
-/dev/null
-/dev/port
-/dev/ram*
-/dev/random
-/dev/scd*
-/dev/sd[a-h]*
-/dev/stderr
-/dev/stdin
-/dev/stdout
-/dev/tty
-/dev/ttyS[0-3]
-/dev/tty[0-9]
-/dev/urandom
-/dev/zero
/etc/inputrc
/etc/termcap
/lib/libnss_files-*
diff --git a/rescue/make_rescue_img b/rescue/make_rescue_img
index 2ef35061b..c049869c3 100755
--- a/rescue/make_rescue_img
+++ b/rescue/make_rescue_img
@@ -23,20 +23,32 @@ BEGIN { undef *_; }
sub __ { print @_, "\n"; system(@_); }
sub _ { __ @_; $? and die; }
-sub install_ {
- return if -e "$tmp$_[0]";
- my $d = dirname($_[0]);
- commands::mkdir_("-p", "$tmp$d") unless -d "$tmp$d";
- _ "$sudo cp $_[1] $_[0] $tmp$d";
+sub install_raw {
+ s|^/|| foreach @_;
+ _ "tar c -C / @_ | tar x -C $tmp" if @_;
+}
+sub install_lib {
+ s|^/|| foreach @_;
+ _ "tar c -C / --dereference @_ | tar x -C $tmp" if @_;
+}
+
+sub install_l {
+ my @l = @_;
+
+ @l = uniq(map { chomp_($_) } @l);
+ push @l,
+ `ldd @l 2>/dev/null | grep "=>" | sed -e 's/.*=> //' -e 's/ .*//'`;
+
+ @l = uniq(map { chomp_($_) } @l);
+ install_raw(grep { !/lib.*\.so/ } @l);
+ install_lib(grep { /lib.*\.so/ } @l);
}
-sub install_lib { install_($_[0], "") }
-sub install { grep {/lib\w+.so/} @_ and install_lib(@_) or install_($_[0], "-a") }
sub installown($$) {
my ($own, $dir) = @_;
return if -e "$tmp$dir$own";
commands::mkdir_("-p", "$tmp$dir") unless -d "$tmp$dir";
- _ "$sudo cp -a $own $tmp$dir";
+ _ "cp -a $own $tmp$dir";
}
_ "$sudo rm -rf $tmp" if -e $tmp;
@@ -48,22 +60,21 @@ foreach (cat_("dirs")) {
}
_ "cp -a tree/* $tmp";
_ "find $tmp -name 'CVS*' | xargs rm -rf";
+_ "perl devices.pl $tmp";
-foreach (keyboard::loadkeys_files) {
- install($_);
+install_raw(keyboard::loadkeys_files());
+foreach (keyboard::loadkeys_files()) {
+ # create the long name based on the short one (if needed)
symlink "$2.kmap.gz", "$tmp$1/$3.kmap.gz" if m|(.*)/((..).+)\.kmap\.gz|;
}
-unlink "$tmp/usr/lib/kbd/keymaps/i386/qwertz/fr.kmap.gz";
my $perl_version = join ".", unpack "C3", $^V;
@files = map { chomp; s/PERL_VERSION/$perl_version/g; $_ } (cat_("list"), cat_(`../tools/specific_arch list`));
-`ls @files`;
+@files = `ls -d @files`;
$? == 0 or exit 1;
-foreach (@files) {
- install($_);
- chomp, install_lib($_) foreach `ldd $_ 2>/dev/null | grep "=>" | sed -e 's/.*=> //' -e 's/ .*//'`;
-}
+install_l(@files);
+
foreach (cat_("aliases")) {
chomp; my ($f, $dest) = split;
symlink $dest, "$tmp$f";
@@ -77,8 +88,7 @@ _ "cp ../all.modules/$main/modules.dep $tmp/modules";
installown("drvinst", "/usr/bin");
installown("guessmounts", "/usr/bin");
-#_ "install -s kernel_read_part $tmp/sbin" if $arch =~ /i.86/;
-__ "$sudo strip $tmp/{lib,bin,sbin}/* $tmp/usr/{bin,sbin}/* 2>/dev/null";
+__ "strip $tmp/{lib,bin,sbin}/* $tmp/usr/{bin,sbin}/* 2>/dev/null";
exit 0 if $ARGV[0];