diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2000-04-20 20:58:03 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2000-04-20 20:58:03 +0000 |
commit | cea41ee6a61d844cde0b4dbd6d325f351dadf4b1 (patch) | |
tree | 01d6eb78d00ec94c885a33a757500193ef1e1d85 /rescue | |
parent | 448bd28d082118bf27c724df11b6a0a41bca9ca4 (diff) | |
download | drakx-cea41ee6a61d844cde0b4dbd6d325f351dadf4b1.tar drakx-cea41ee6a61d844cde0b4dbd6d325f351dadf4b1.tar.gz drakx-cea41ee6a61d844cde0b4dbd6d325f351dadf4b1.tar.bz2 drakx-cea41ee6a61d844cde0b4dbd6d325f351dadf4b1.tar.xz drakx-cea41ee6a61d844cde0b4dbd6d325f351dadf4b1.zip |
no_comment
Diffstat (limited to 'rescue')
-rw-r--r-- | rescue/.cvsignore | 1 | ||||
-rw-r--r-- | rescue/Makefile | 10 | ||||
-rw-r--r-- | rescue/aliases | 2 | ||||
-rw-r--r-- | rescue/list | 122 | ||||
-rwxr-xr-x | rescue/make_rescue_img | 78 | ||||
-rwxr-xr-x | rescue/tree/bin/insmod | 3 | ||||
-rwxr-xr-x | rescue/tree/bin/login | 2 | ||||
-rw-r--r-- | rescue/tree/etc/fstab | 4 | ||||
-rw-r--r-- | rescue/tree/etc/group | 1 | ||||
-rw-r--r-- | rescue/tree/etc/host.conf | 2 | ||||
-rw-r--r-- | rescue/tree/etc/hosts | 1 | ||||
-rw-r--r-- | rescue/tree/etc/inittab | 14 | ||||
-rw-r--r-- | rescue/tree/etc/issue | 25 | ||||
-rw-r--r-- | rescue/tree/etc/passwd | 3 | ||||
-rw-r--r-- | rescue/tree/etc/profile | 24 | ||||
-rwxr-xr-x | rescue/tree/etc/rc.reboot | 9 | ||||
-rwxr-xr-x | rescue/tree/etc/rc.sysinit | 28 | ||||
-rw-r--r-- | rescue/tree/etc/resolv.conf | 2 | ||||
-rwxr-xr-x | rescue/tree/sbin/modprobe | 39 |
19 files changed, 370 insertions, 0 deletions
diff --git a/rescue/.cvsignore b/rescue/.cvsignore new file mode 100644 index 000000000..13933b8b3 --- /dev/null +++ b/rescue/.cvsignore @@ -0,0 +1 @@ +rescue_stage2.gz diff --git a/rescue/Makefile b/rescue/Makefile new file mode 100644 index 000000000..4edae97bd --- /dev/null +++ b/rescue/Makefile @@ -0,0 +1,10 @@ +ROOTDEST = /export + +install: rescue_stage2.gz + cp -f $< $(ROOTDEST)/Mandrake/base + +rescue_stage2.gz: + ./make_rescue_img + +clean: + rm -f rescue_stage2.gz diff --git a/rescue/aliases b/rescue/aliases new file mode 100644 index 000000000..3a8d38e9a --- /dev/null +++ b/rescue/aliases @@ -0,0 +1,2 @@ +/bin/zcat gzip +/bin/gunzip gzip diff --git a/rescue/list b/rescue/list new file mode 100644 index 000000000..17c7ddb6c --- /dev/null +++ b/rescue/list @@ -0,0 +1,122 @@ +/bin/bash +/bin/cat +/bin/chmod +/bin/chown +/bin/cp +/bin/date +/bin/dd +/bin/df +/bin/dmesg +/bin/false +/bin/grep +/bin/gzip +/usr/bin/bzip2 +/usr/bin/bunzip2 +/usr/bin/bzcat +/usr/bin/extract_archive +/bin/hostname +/bin/kill +/bin/ln +/bin/loadkeys +/usr/bin/du +/usr/lib/kbd +/bin/ls +/bin/vi +/bin/mkdir +/bin/mknod +/bin/mount +/bin/mount +/bin/mv +/bin/ping +/bin/ps +/bin/pwd +/bin/rm +/bin/rmdir +/bin/setserial +/sbin/lsmod +/bin/cpio +/usr/bin/diff +/bin/sh +/bin/sleep +/bin/sync +/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/stderr +/dev/stdin +/dev/stdout +/dev/tty +/dev/ttyS[0-3] +/dev/tty[0-9] +/dev/urandom +/dev/zero +/etc/inputrc +/etc/termcap +/mnt/cdrom +/mnt/disk +/mnt/floppy +/sbin/debugfs +/sbin/e2fsck +/sbin/fdisk +/sbin/fsck.ext2 +/sbin/halt +/sbin/ifconfig +/sbin/init +/sbin/insmod +/sbin/ldconfig +/sbin/lilo +/sbin/mingetty +/sbin/mkdosfs +/sbin/mkfs.ext2 +/sbin/reboot +/sbin/rmmod +/usr/bin/strace +/sbin/route +/sbin/mkswap +/sbin/swapoff +/sbin/swapon +/sbin/tune2fs +/sbin/update +/usr/bin/cmp +/usr/bin/cut +/usr/bin/fdformat +/usr/bin/file +/usr/bin/find +/usr/bin/ftp +/usr/bin/head +/usr/bin/hexedit +/usr/bin/less +/usr/bin/loadkeys +/usr/bin/reset +/usr/bin/split +/usr/bin/tail +/usr/bin/tee +/usr/bin/telnet +/usr/bin/telnet +/usr/bin/tset +/usr/sbin/traceroute +/usr/share/magic +/usr/share/terminfo/l/linux +/var/run/utmp +/sbin/killall5 +/usr/bin/perl +/usr/bin/perl5 +/usr/bin/perl5.00503 +/usr/bin/extract_archive +/bin/sort +/usr/bin/md5sum +/etc/protocols +/sbin/lspci +/usr/share/pci.ids +/bin/rpm
\ No newline at end of file diff --git a/rescue/make_rescue_img b/rescue/make_rescue_img new file mode 100755 index 000000000..8b9c823f4 --- /dev/null +++ b/rescue/make_rescue_img @@ -0,0 +1,78 @@ +#!/usr/bin/perl + +use lib "../perl-install"; +use keyboard; +use common qw(:file); + +use Config; +Config->import; +my ($arch) = $Config{archname} =~ /(.*)-/; + +$tmp = "/tmp/rescue_tmp"; +$mnt = "/tmp/rescue_stage2_img"; +$mke2fs = "/sbin/mke2fs -q -m 0 -F -s 1"; +$rescue = "rescue_stage2"; + +if ($>) { + $sudo = "sudo"; + $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; +} + +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 -a $_[0] $tmp$d"; +} +sub install_lib { + _ "cp $_[0] $tmp$_[0]" unless -e "$tmp$_[0]"; +} + +_ "$sudo rm -rf $tmp" if -e $tmp; +_ "mkdir $tmp"; +_ 'find . -name "*~" | xargs rm -f'; +_ "cp -a tree/* $tmp"; +foreach (keyboard::loadkeys_files) { + install($_); + symlink "$2.kmap.gz", "$tmp$1/$3.kmap.gz" if m|(.*)/((..).+)\.kmap\.gz|; +} +unlink "$tmp/usr/lib/kbd/keymaps/i386/qwertz/fr.kmap.gz"; + +foreach (cat_("list")) { + chomp; + install($_); + chomp, install_lib($_) foreach `ldd $_ 2>/dev/null | grep "=>" | sed -e 's/.*=> //' -e 's/ .*//'`; +} +foreach (cat_("aliases")) { + chomp; my ($f, $dest) = split; + symlink $dest, "$tmp$f"; +} +_ "cp ../modules/modules.{cz*,dep} $tmp/modules"; + +__ "$sudo strip $tmp/{lib,bin,sbin}/* $tmp/usr/{bin,sbin}/* 2>/dev/null"; + +exit 0 if $ARGV[0]; + +$size = `du -s $tmp | cut -f1` + 2048; #- add 2MB of free space + +commands::mkdir_("-p", $mnt) if !-e $mnt; +__ "$sudo umount $rescue"; + +_ "dd if=/dev/zero of=$rescue bs=1k count=$size"; +_ "$mke2fs $rescue"; +_ "$sudo mount -t ext2 $rescue $mnt -o loop"; +_ "rmdir $mnt/lost+found"; + +_ "$sudo chown -R root.root $tmp"; +_ "$sudo cp -a $tmp/* $mnt"; +_ "$sudo rm -rf $tmp"; + +_ "$sudo umount $rescue"; +_ "rmdir $mnt"; + +_ "echo gzipping $rescue"; +_ "gzip -f -9 $rescue"; diff --git a/rescue/tree/bin/insmod b/rescue/tree/bin/insmod new file mode 100755 index 000000000..717dc39e1 --- /dev/null +++ b/rescue/tree/bin/insmod @@ -0,0 +1,3 @@ +#!/bin/sh +echo "Use modprobe instead" +echo "Or even better use autoprobe" diff --git a/rescue/tree/bin/login b/rescue/tree/bin/login new file mode 100755 index 000000000..4b2816926 --- /dev/null +++ b/rescue/tree/bin/login @@ -0,0 +1,2 @@ +#!/bin/sh +exec /bin/bash --login diff --git a/rescue/tree/etc/fstab b/rescue/tree/etc/fstab new file mode 100644 index 000000000..fbafb7801 --- /dev/null +++ b/rescue/tree/etc/fstab @@ -0,0 +1,4 @@ +/dev/ram3 / ext2 defaults 1 1 +/dev/fd0 /mnt/floppy auto defaults,noauto 0 0 +none /proc proc defaults,noauto,ro 0 0 +/dev/cdrom /mnt/cdrom auto defaults,noauto 0 0 diff --git a/rescue/tree/etc/group b/rescue/tree/etc/group new file mode 100644 index 000000000..5ba713c83 --- /dev/null +++ b/rescue/tree/etc/group @@ -0,0 +1 @@ +root::0:root diff --git a/rescue/tree/etc/host.conf b/rescue/tree/etc/host.conf new file mode 100644 index 000000000..1a8c1e151 --- /dev/null +++ b/rescue/tree/etc/host.conf @@ -0,0 +1,2 @@ +order hosts,bind +multi on diff --git a/rescue/tree/etc/hosts b/rescue/tree/etc/hosts new file mode 100644 index 000000000..a9bbdee7f --- /dev/null +++ b/rescue/tree/etc/hosts @@ -0,0 +1 @@ +127.0.0.1 mandrake-rescue diff --git a/rescue/tree/etc/inittab b/rescue/tree/etc/inittab new file mode 100644 index 000000000..0ee36784f --- /dev/null +++ b/rescue/tree/etc/inittab @@ -0,0 +1,14 @@ +#Inittab for Mandrake Rescue Disk +#Author: Daouda Lo <daouda@mandrakesoft.com> +id:3:initdefault: + +si::sysinit:/etc/rc.sysinit +re:6:wait:/etc/rc.reboot +ca:12345:ctrlaltdel:/sbin/init 6 + +1:12345:respawn:/bin/bash --login +2:23:respawn:/sbin/mingetty tty2 +3:23:respawn:/sbin/mingetty tty3 +4:23:respawn:/sbin/mingetty tty4 +5:23:respawn:/sbin/mingetty tty5 +6:23:respawn:/sbin/mingetty tty6 diff --git a/rescue/tree/etc/issue b/rescue/tree/etc/issue new file mode 100644 index 000000000..8c579e127 --- /dev/null +++ b/rescue/tree/etc/issue @@ -0,0 +1,25 @@ +[40m[40m +[2J[0;0H +[0;1;30;44m [40m [44m [40m +[1;44m [40m [44m [2C[47m [5C [1C [3C [1C [2C [1C [2C [40m +[1;30;44m [40m [47m [40m [47m [40m [44m [2C[47m [7C [3C [2C [1C [2C [2C [40m +[1;30;44m [40m [47m [40m [47m [40m [44m [2C[47m [7C [3C [1C [1C [2C [3C [40m +[1;30;44m [40m [43m [40m [44m [2C[47m [7C [3C [1C [1C [2C [2C [40m +[1;30;44m [40m [0;30;43m`----'[40m [1;44m [2C[47m [1C [1C [3C [2C [2C [2C [40m +[1;30;44m [40m [47m [37m [30m [40m [44m [40m +[1;30;44m [40m [47m [40m [44m [40m[2C[1;37;40m[0m +[1;30;44m [40m [47m [40m [44m [40m[2[1;37;4[0m +[1;30;44m [40m [47m [40m [30;44m [40m[2C[1;37;40m[0m +[1;30;44m [40m [47m [40m [2C[1;37;40m[0m +[1;30;44m [40m [47m [40m [2C[1;37;40mMandrake Rescue Disk[0m +[1;30;44m [43m [30;47m [43m [40m [2C[1;37;40m[0m +[1;30;44m [43m [47m [43m [40m [2C +[1;30;44m [43m [47m [43m [40m[2C +[1;30;44m [43m [40m [47m [40m [43m [40m[2C +[0m[255D + +Linux Mandrake release 7.0 (Air) + +Use [1;33;40mloadkeys[0m to change your keyboard layout (eg: loadkeys fr) +Use [1;33;40mmodprobe[0m to load modules + diff --git a/rescue/tree/etc/passwd b/rescue/tree/etc/passwd new file mode 100644 index 000000000..568451e4e --- /dev/null +++ b/rescue/tree/etc/passwd @@ -0,0 +1,3 @@ +root::0:0::/:/bin/bash +shutdown:*:6:0:shutdown:/sbin:/sbin/shutdown +halt:*:7:0:halt:/sbin:/sbin/halt diff --git a/rescue/tree/etc/profile b/rescue/tree/etc/profile new file mode 100644 index 000000000..ffd2b3174 --- /dev/null +++ b/rescue/tree/etc/profile @@ -0,0 +1,24 @@ +# /etc/profile +# (c) MandrakeSoft, Chmouel Boudjnah <chmouel@mandrakesoft.com> + +# System wide environment and startup programs +# Functions and aliases go in /etc/bashrc + +PROFILE_LOADED=1 + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin + +PS1="[root@rescue]\\$ " +ls () { /bin/ls --color=auto -F "$@";} +ll () { /bin/ls --color=auto -Fl "$@";} +d () { /bin/ls --color=auto -F "$@";} +s () { cd .. ;} +which () { type -p "$@" ;} +HOSTNAME=rescue +HISTSIZE=1000 +HISTFILESIZE=1000 + +INPUTRC=/etc/inputrc +export PATH PS1 USER HOSTNAME HISTSIZE HISTFILESIZE INPUTRC + +cat /etc/issue diff --git a/rescue/tree/etc/rc.reboot b/rescue/tree/etc/rc.reboot new file mode 100755 index 000000000..79318f1f7 --- /dev/null +++ b/rescue/tree/etc/rc.reboot @@ -0,0 +1,9 @@ +#!/bin/sh + +sleep 1 +/sbin/killall5 -9 + +umount -a -f -t noproc +mount -n -o remount,ro / + +reboot -i -d diff --git a/rescue/tree/etc/rc.sysinit b/rescue/tree/etc/rc.sysinit new file mode 100755 index 000000000..476c9bfe9 --- /dev/null +++ b/rescue/tree/etc/rc.sysinit @@ -0,0 +1,28 @@ +#!/bin/sh + +action() { echo $1; shift; $*; } + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin + +echo -e "\t\t\tWelcome to Linux \\033[1;36mMandrake\\033[0;39m" + +action "Mounting proc filesystem" mount -n -t proc /proc /proc +action "Remounting root filesystem in read-write mode" mount -n -o remount,rw / + +>/etc/mtab +mount -f / +mount -f /proc + +# Set the hostname. +action "Setting hostname rescue" hostname rescue +echo rescue > /etc/HOSTNAME + +load() { modprobe $* 2>/dev/null; } +load ide-mod +load ide-probe +load ide-disk +load ide-cd +load af_packet + +/sbin/ifconfig lo 127.0.0.1 netmask 255.0.0.0 +/sbin/route add 127.0.0.1 lo diff --git a/rescue/tree/etc/resolv.conf b/rescue/tree/etc/resolv.conf new file mode 100644 index 000000000..3822939b1 --- /dev/null +++ b/rescue/tree/etc/resolv.conf @@ -0,0 +1,2 @@ +search foo.com +nameserver 192.168.1.1 diff --git a/rescue/tree/sbin/modprobe b/rescue/tree/sbin/modprobe new file mode 100755 index 000000000..494f5b2a2 --- /dev/null +++ b/rescue/tree/sbin/modprobe @@ -0,0 +1,39 @@ +#!/usr/bin/perl + +sub cat_ { local *F; open F, $_[0] or $_[1] ? die "cat of file $_[0] failed: $!\n" : return; my @l = <F>; wantarray ? @l : join '', @l } + +sub read_already_loaded() { + foreach (cat_("/proc/modules")) { + my ($name) = split; + $conf{$name}{loaded} = 1; + } +} + +sub load_deps($) { + my ($file) = @_; + + local *F; + open F, $file or log::l("error opening $file: $!"), return 0; + foreach (<F>) { + my ($f, $deps) = split ':'; + push @{$deps{$f}}, split ' ', $deps; + } +} + +sub load { + my ($name, @options) = @_; + $name =~ s/\.o//; + + $conf{$name}{loaded} and return; + eval { load($_, 'prereq') } foreach @{$deps{$name}}; + + system("extract_archive /modules/modules.cz* /tmp $name.o >/dev/null"); + -r "/tmp/$name.o" or die "can't find module $name\n"; + system("/sbin/insmod -f /tmp/$name.o"); $? and die("insmod $name failed"); +} + +!@ARGV || $ARGV[0] =~ /-h/ and die "usage: modprobe <module> [<options...>]\n"; + +read_already_loaded(); +load_deps("/modules/modules.dep"); +load(@ARGV); |