1 |
diff -urN e-smith-base-5.2.0.po/root/usr/lib/perl5/site_perl/esmith/console/perform_backup.pm e-smith-base-5.2.0.new/root/usr/lib/perl5/site_perl/esmith/console/perform_backup.pm |
2 |
--- e-smith-base-5.2.0.po/root/usr/lib/perl5/site_perl/esmith/console/perform_backup.pm 2010-01-30 01:59:07.000000000 +1100 |
3 |
+++ e-smith-base-5.2.0.new/root/usr/lib/perl5/site_perl/esmith/console/perform_backup.pm 2010-01-31 15:40:39.000000000 +1100 |
4 |
@@ -57,7 +57,7 @@ |
5 |
close DU; |
6 |
|
7 |
open(OLDSTDOUT, ">&STDOUT"); |
8 |
- unless (open(STDOUT, ">/$device/smeserver.tgz")) |
9 |
+ unless (open(STDOUT, ">/mnt/bootstrap-console-backup/smeserver.tgz")) |
10 |
{ |
11 |
return gettext("Could not create backup file on device").": $!\n"; |
12 |
} |
13 |
@@ -150,16 +150,25 @@ |
14 |
); |
15 |
return unless $rc == 0; |
16 |
sleep(3); |
17 |
- my @dirs; |
18 |
- @dirs = (); |
19 |
- open(FSTAB, "</etc/fstab"); |
20 |
- while (<FSTAB>) |
21 |
- { |
22 |
- next unless m:^(\S+)\s+(/media/\S+)\s+(\S+)\s+(\S+):; |
23 |
- my ($dev, $mount, $filesys, $options) = ($1, $2, $3, $4); |
24 |
- push @dirs, $mount unless $mount =~ m{/floppy|/cd|/dvd}; |
25 |
+ my @dirs = (); |
26 |
+ my @labels = (); |
27 |
+ foreach my $udi (qx(hal-find-by-property --key volume.fsusage --string filesystem)) { |
28 |
+ $udi =~ m/^(\S+)/; |
29 |
+ my $is_mounted = qx(hal-get-property --udi $1 --key volume.is_mounted); |
30 |
+ |
31 |
+ if ($is_mounted eq "false\n") { |
32 |
+ my $blkdev = qx(hal-get-property --udi $1 --key block.device); |
33 |
+ $blkdev =~ m/^(\S+)/; |
34 |
+ push @dirs, $1; |
35 |
+ } |
36 |
+ if ($is_mounted eq "false\n") { |
37 |
+ my $vollbl = qx(hal-get-property --udi $1 --key volume.label); |
38 |
+ $vollbl =~ m/^(\S+)/; |
39 |
+ if ($vollbl =~ /^\s/) {$vollbl = 'nolabel';} |
40 |
+ chomp $vollbl; |
41 |
+ push @labels, lc($vollbl); |
42 |
+ } |
43 |
} |
44 |
- close FSTAB; |
45 |
unless ($dirs[0]) |
46 |
{ |
47 |
($rc, $choice) = $console->message_page |
48 |
@@ -171,6 +180,8 @@ |
49 |
); |
50 |
goto INITIATE_BACKUP; |
51 |
} |
52 |
+ mkdir("/mnt/bootstrap-console-backup"); |
53 |
+ |
54 |
my $device = $dirs[0]; |
55 |
if (defined $dirs[1]) |
56 |
{ |
57 |
@@ -180,7 +191,7 @@ |
58 |
my ($rc, $choice) = $console->menu_page |
59 |
( |
60 |
title => gettext("Choose device to use for backup"), |
61 |
- text => gettext("Please select which device should be used for the backup file."), |
62 |
+ text => ("@dirs \n @labels"), |
63 |
argsref => \@args, |
64 |
left => gettext("Cancel"), |
65 |
right => gettext("OK"), |
66 |
@@ -189,9 +200,10 @@ |
67 |
my %args_hash = ( @args ); |
68 |
$device = $args_hash{$choice}; |
69 |
} |
70 |
- system("/bin/mount", "$device"); |
71 |
+ system("/bin/mount", "$device", "/mnt/bootstrap-console-backup"); |
72 |
+ |
73 |
use File::stat; |
74 |
- my $st = stat("$device/smeserver.tgz"); |
75 |
+ my $st = stat("/mnt/bootstrap-console-backup/smeserver.tgz"); |
76 |
if ($st) |
77 |
{ |
78 |
# TODO |
79 |
@@ -219,9 +231,10 @@ |
80 |
} |
81 |
close DU; |
82 |
|
83 |
- $console->gauge(make_backup_callback($device), 'title' => gettext("Creating backup file")); |
84 |
+ $console->gauge(make_backup_callback("/mnt/bootstrap-console-backup"), 'title' => gettext("Creating backup file")); |
85 |
|
86 |
- system("/bin/umount", "$device"); |
87 |
+ system("/bin/umount", "/mnt/bootstrap-console-backup"); |
88 |
+ rmdir("/mnt/bootstrap-console-backup"); |
89 |
system("/sbin/e-smith/signal-event", "post-backup"); |
90 |
($rc, $choice) = $console->message_page |
91 |
( |