summaryrefslogtreecommitdiffstats
path: root/globetrotter/make_live
diff options
context:
space:
mode:
Diffstat (limited to 'globetrotter/make_live')
-rwxr-xr-xglobetrotter/make_live87
1 files changed, 68 insertions, 19 deletions
diff --git a/globetrotter/make_live b/globetrotter/make_live
index 4f5a6e2ef..00c560c78 100755
--- a/globetrotter/make_live
+++ b/globetrotter/make_live
@@ -31,6 +31,13 @@ foreach (@ARGV) {
}
}
+my $rescue;
+
+if ($0 =~ /restore_globetrotter/) {
+ %options = (install => 1, post => 1);
+ $rescue = 1;
+}
+
@ARGV = @new_ARGV;
my @suggestions = (
@@ -95,15 +102,29 @@ sub formatdisk {
run_program::get_stdout('service', 'usb', 'start');
}
+my $pkg_dev;
+if ($rescue) {
+ system("mount -t tmpfs none /tmp");
+ # let be able to see USB devices:
+ system("mount -t usbfs none /proc/bus/usb");
+ system("modprobe usb-storage; modprobe sd_mod");
+ # let be able to detect SCSI hds:
+ mkdir("/sys");
+ system("mount -t sysfs none /sys");
-my $kernel_version = do {
- #my @l = glob_('/export/Mandrake/RPMS/kernel-enterprise-2.6*');
- my @l = glob_('/export/Mandrake/RPMS/kernel-2.6*');
- @l >= 1 or die "can't find kernel";
- @l <= 1 or die "too many kernels";
- first(`rpm -qp --qf '%{name}' $l[0]` =~ /kernel-(.*)/);
-};
+ my ($all_hds, $hd, $other) = get_hds();
+ print "Looking for the package partition\n";
+ my @parts = partition_table::get_normal_parts($hd);
+ my $pkg_dev = find { member(fs::type2fs($_), qw(ext2 ext3)) && chomp_(`e2label /dev/$_->{device} 2>/dev/root`) eq "MDK-PKGS" } @parts;
+ die "I cannot find the package partition which is needed in order to restore the system!" if is_empty_hash_ref($pkg_dev) || !$pkg_dev->{device};
+ my $root = find { member(fs::type2fs($_), qw(ext2 ext3)) && chomp_(`e2label /dev/$_->{device} 2>/dev/root`) eq "MDK-ROOT" } @parts;
+ $root = find { $_->{device} eq "sda1" } @parts if is_empty_hash_ref($root);
+ die "I cannot find any hard disk to restore!" if is_empty_hash_ref($root) || !$root->{device};
+ print "Please wait, disk reinstallation is in progress, this can take quite some time\n";
+ print "Formating $root->{device}\n";
+ system("mkfs.ext2 /dev/$root->{device} > /dev/null\n");
+}
sub installPackages() {
local $::testing = undef;
@@ -140,7 +161,15 @@ sub installPackages() {
};
undef *c::kernel_version;
- *c::kernel_version = sub { $kernel_version };
+ *c::kernel_version = sub {
+ #my @l = glob_('/export/Mandrake/RPMS/kernel-enterprise-2.6*');
+ my @l = glob_('/export/Mandrake/RPMS/kernel-2.6*');
+ @l >= 1 or die "can't find kernel";
+ @l <= 1 or die "too many kernels";
+ first(`rpm -qp --qf '%{name}' $l[0]` =~ /kernel-(.*)/);
+ };
+
+ my $kernel_version = c::kernel_version();
print "INSTALLING\n";
install_any::setPackages(my $o = $::o =
@@ -148,6 +177,8 @@ sub installPackages() {
prefix => $::prefix,
meta_class => 'desktop',
default_packages => [
+ #- for screenshots:
+ qw(fb2png),
qw(XFree86-server XFree86-xfs XFree86-FBDev),
qw(openssh-server), #- fred wants it
qw(alsa-utils cdialog newt),
@@ -156,6 +187,7 @@ sub installPackages() {
qw(acpi acpid), #- so that removing acpi=ht will work
qw(mountloop), #- crypted folders
qw(mandrake-doc-en mandrake-doc-fr mandrake-doc-drakxtools-en mandrake-doc-drakxtools-fr),
+ qw(autologin),
qw(synaptics),
#- network conf:
qw(wireless-tools pcmcia-cs),
@@ -190,7 +222,7 @@ sub installPackages() {
qw(devfsd dynamic harddrake hotplug magicdev mandrake-globetrotter netprofile),
qw(gnome2),
qw(alsa-utils),
- qw(ipw2100 ipw2100_kernel), # ipw2100_kernel-$kernel_version,
+ qw(ipw2100 ipw2100_kernel ipw2100_kernel-2.6.3.13mdk), # ipw2100_kernel-$kernel_version,
#- fonts:
qw(XFree86-100dpi-fonts XFree86-75dpi-fonts),
qw(fonts-bitmap-tscii fonts-hebrew-elmar),
@@ -204,18 +236,21 @@ sub installPackages() {
$compssUsersChoice{qq(LOCALES"$_")} = 1 foreach lang::langsLANGUAGE({ all => 1 });
pkgs::setSelectedFromCompssList($o->{packages}, \%compssUsersChoice, 4, 0);
- use Data::Dumper;
- output("/tmp/pkgs1", Dumper($o->{packages}));
+
+ my $unselect = sub {
+ my ($pkg) = @_;
+ my $p = pkgs::packageByName($o->{packages}, $pkg);
+ pkgs::unselectPackage($o->{packages}, $p) if $p;
+ };
# unselect some packages whose services fsck up the box and whose services are not enabled by appropriate tools:
# (shorewall must be deselected before iptables is)
- foreach (qw(at hpoj shorewall iptables ntp tmdns zcip )) {
- my $p = pkgs::packageByName($o->{packages}, $_);
- pkgs::unselectPackage($o->{packages}, $p) if $p;
- }
+ $unselect->($_) foreach qw(at hpoj shorewall iptables ntp tmdns zcip );
+
+ # unselect uim since uim IM break first time wizard when selecting english:
+ $unselect->($_) foreach qw(uim-applet uim libuim0);
my @toInstall = pkgs::packagesToInstall($o->{packages});
- output("/tmp/pkgs2", Dumper([ map { $_->name } @toInstall ]));
local $ENV{DURING_INSTALL} = 1;
$ENV{LD_LIBRARY_PATH} = "/lib:/usr/lib:/usr/X11R6/lib:/usr/lib/qt3/lib";
pkgs::install($::prefix, 0, \@toInstall, $o->{packages});
@@ -268,6 +303,7 @@ my $fstab = [ fsedit::get_all_fstab($all_hds) ];
# we need to mount every fs we want to see into /etc/fstab !!!
fs::mount_part($_, $::prefix) foreach sort { $a->{mntpoint} cmp $b->{mntpoint} } @$fstab;
+symlink("$::prefix/mnt/packages", "/export") if $rescue;
eval {
print "Installing packages\n";
@@ -288,6 +324,19 @@ fs::write_fstab($all_hds, $::prefix);
append_to_file("$::prefix/etc/fstab", "none /dev/pts devpts mode=0620 0 0");
doRootSubst("$::prefix/etc/fstab");
+my ($home) = grep { $_->{mntpoint} eq "/home" } @parts;
+my ($mnt_pkgs) = grep { $_->{mntpoint} eq "/mnt/packages" } @parts;
+run_program::run('tune2fs', '-L', "MDK-HOME", "/dev/$home->{device}") if $home;
+run_program::run('tune2fs', '-L', "MDK-PKGS", "/dev/$mnt_pkgs->{device}") if $mnt_pkgs;
+
+substInFile {
+ s!defaults\s!defaults,ro ! if m!/mnt/packages!;
+ s!defaults\s!defaults,umask=0000 ! if m!/mnt/share!;
+ s!/dev/$home->{device}!LABEL=MDK-HOME!g;
+ s!/dev/$mnt_pkgs->{device}!LABEL=MDK-PKGS!g;
+} "$::prefix/etc/fstab";
+
+
#-------------------------------------------------------------------
#- Bootloader
print "Configuring bootloader\n";
@@ -352,7 +401,7 @@ if ($options{post}) {
push @files, (map { "/etc/X11/$_" } qw(XF86Config XF86Config-4)),
(map { "/etc/sysconfig/$_" } qw(keyboard harddrake2/previous_hw harddisks)),
(map { "/etc/$_" } qw(modprobe.conf modprobe.devfs modprobe.preload modules modules.conf modules.devfs)),
- qw(/etc/asound.state /etc/fstab /etc/ld.so.conf/GL.conf);
+ qw(/etc/asound.state /etc/fstab /etc/ld.so.conf/GL.conf /etc/shorewall/);
output($prof_cfg, join("\n", sort @files));
@@ -399,7 +448,7 @@ unlink $_ foreach glob("$::prefix/core.*");
#
-system("rsync -rvltp /export/ $::prefix/mnt/packages/");
+system("rsync -rvltp /export/ $::prefix/mnt/packages/") if !$rescue;
unlink $_ foreach glob("$::prefix/var/lib/urpmi/*");
run_program::rooted($::prefix, 'urpmi.addmedia', '-h', 'main', 'file:///mnt/packages/Mandrake/RPMS');
run_program::rooted($::prefix, 'urpmi.addmedia', '-h', 'contrib', 'file:///mnt/packages/Mandrake/RPMS2');
@@ -407,4 +456,4 @@ run_program::rooted($::prefix, 'urpmi.addmedia', '-h', 'contrib', 'file:///mnt/p
# for fast test replaying:
run_program::rooted($::prefix, 'tar', 'cfj', '/root/etc.tar.bz2', '/etc');
-fs::umount_all($fstab, $::prefix);
+eval { fs::umount_all($fstab, $::prefix) } or system("umount $::prefix");