summaryrefslogtreecommitdiffstats
path: root/globetrotter/make_live
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2005-05-25 08:45:13 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2005-05-25 08:45:13 +0000
commit8dfdf773f0cf348ca61ab63558fe8eed29ce8f91 (patch)
treeddbc43aa5c63b8eb98beeaa973d49423763540b9 /globetrotter/make_live
parent8812c244d01914e263846e421e4a218df7541196 (diff)
downloaddrakx-backup-do-not-use-8dfdf773f0cf348ca61ab63558fe8eed29ce8f91.tar
drakx-backup-do-not-use-8dfdf773f0cf348ca61ab63558fe8eed29ce8f91.tar.gz
drakx-backup-do-not-use-8dfdf773f0cf348ca61ab63558fe8eed29ce8f91.tar.bz2
drakx-backup-do-not-use-8dfdf773f0cf348ca61ab63558fe8eed29ce8f91.tar.xz
drakx-backup-do-not-use-8dfdf773f0cf348ca61ab63558fe8eed29ce8f91.zip
unmount partitions even when failled
Diffstat (limited to 'globetrotter/make_live')
-rwxr-xr-xglobetrotter/make_live26
1 files changed, 22 insertions, 4 deletions
diff --git a/globetrotter/make_live b/globetrotter/make_live
index 1ef446e3a..0752165e7 100755
--- a/globetrotter/make_live
+++ b/globetrotter/make_live
@@ -298,6 +298,27 @@ sub config_X_proprietary_drivers() {
substInFile { $_ = '' if $_ eq 'nvidia' } "$::prefix/etc/modules";
}
+my $fstab;
+
+my $cleaner = before_leaving {
+ if (my $err = $@) {
+ print "\n>> an error happened: $err\n";
+ }
+ print "Cleaning on exiting\n";
+ print "- Umounting partitions:\n";
+ print "\tumounting /proc\n";
+ eval { fs::umount("$::prefix/proc") };
+ # fs::umount("$::prefix/$_") foreach 'mnt/packages', 'mnt/share', 'home', '';
+ if ($fstab) {
+ print "\tumounting everything else\n";
+ eval { fs::umount_all($fstab, $::prefix) } or system("umount $::prefix");
+ }
+ print "\tumounting /tmp\n";
+ eval { fs::umount("/tmp") } if $rescue;
+ print "Cleaning done\n";
+};
+
+
$::prefix = $ARGV[0] || '/tmp/live_tree';
-d $::prefix or mkdir $::prefix;
@@ -322,7 +343,7 @@ my ($root) = grep { $_->{mntpoint} eq "/" } @parts;
print "Root is $root->{device}\n";
run_program::run('tune2fs', '-L', "MDK-ROOT", "/dev/$root->{device}");
# fs::mount_part($root, $::prefix);
-my $fstab = [ fsedit::get_all_fstab($all_hds) ];
+$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;
@@ -480,7 +501,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');
-system("umount $::prefix/proc");
-eval { fs::umount_all($fstab, $::prefix) } or system("umount $::prefix");
-
my_exit("Your disk was succesfully restored!\nYou can now reboot your machine.");