/[smeserver]/rpms/e-smith-base+ldap/sme8/e-smith-base-5.2.0-perform_restore-hal.patch
ViewVC logotype

Contents of /rpms/e-smith-base+ldap/sme8/e-smith-base-5.2.0-perform_restore-hal.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Mon Feb 1 05:24:20 2010 UTC (14 years, 9 months ago) by dungog
Branch: MAIN
CVS Tags: e-smith-base+ldap-5_2_0-13_el5_sme, e-smith-base+ldap-5_2_0-15_el5_sme, e-smith-base+ldap-5_2_0-16_el5_sme, e-smith-base+ldap-5_2_0-18_el5_sme, e-smith-base+ldap-5_2_0-17_el5_sme, e-smith-base+ldap-5_2_0-14_el5_sme, HEAD
Error occurred while calculating annotation data.
* Sun Jan 31 2010 Stephen Noble <support@dungog.net> 5.2.0-13.sme
- Fix usb console backup and restore [SME: 4909]

1 --- e-smith-base-5.2.0-old/root/usr/lib/perl5/site_perl/esmith/console/perform_restore.pm.orig 2008-03-26 17:49:00.000000000 +0100
2 +++ e-smith-base-5.2.0/root/usr/lib/perl5/site_perl/esmith/console/perform_restore.pm 2010-01-13 16:03:01.000000000 +0100
3 @@ -25,6 +25,7 @@
4 gettext("Do you wish to restore from backup?"),
5 );
6 return unless $rc == 0;
7 + mkdir("/mnt/bootstrap-console-backup");
8 system("/etc/init.d/messagebus", "start");
9 system("/etc/init.d/haldaemon", "start");
10 INITIATE_RESTORE:
11 @@ -39,19 +40,22 @@
12 unless ($rc == 0) {
13 system("/etc/init.d/haldaemon", "stop");
14 system("/etc/init.d/messagebus", "stop");
15 + rmdir("/mnt/bootstrap-console-backup");
16 return;
17 }
18 sleep(3);
19 my @dirs;
20 @dirs = ();
21 - open(FSTAB, "</etc/fstab");
22 - while (<FSTAB>)
23 - {
24 - next unless m:^(\S+)\s+(/media/\S+)\s+(\S+)\s+(\S+):;
25 - my ($dev, $mount, $filesys, $options) = ($1, $2, $3, $4);
26 - push @dirs, $mount;
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 }
37 - close FSTAB;
38 unless ($dirs[0])
39 {
40 ($rc, $choice) = $console->message_page
41 @@ -82,10 +86,10 @@
42 my %args_hash = ( @args );
43 $device = $args_hash{$choice};
44 }
45 - system("/bin/mount", "$device");
46 + system("/bin/mount", "$device", "/mnt/bootstrap-console-backup");
47 sleep(1);
48
49 - unless (-f "$device/smeserver.tgz")
50 + unless (-f "/mnt/bootstrap-console-backup/smeserver.tgz")
51 {
52 system("/bin/umount", "$device");
53 ($rc, $choice) = $console->message_page
54 @@ -98,14 +102,14 @@
55 goto INITIATE_RESTORE;
56 }
57 use File::stat;
58 - my $st = stat("$device/smeserver.tgz");
59 + my $st = stat("/mnt/bootstrap-console-backup/smeserver.tgz");
60 my $size = $st->size;
61
62 ($rc, $choice) = $console->yesno_page
63 (
64 title => gettext("Start restore from backup"),
65 text =>
66 - gettext("Backup file found:") . " $device/smeserver.tgz " .
67 + gettext("Backup file found:") . " smeserver.tgz ($device) " .
68 gettext("size") . " $size " . gettext("bytes") .
69 "\n\n" .
70 gettext("Do you wish to restore from this file?"),
71 @@ -115,7 +119,7 @@
72 goto INITIATE_RESTORE;
73 }
74 system("/sbin/e-smith/signal-event", "pre-restore");
75 - system("(cd / ; cat $device/smeserver.tgz |
76 + system("(cd / ; cat /mnt/bootstrap-console-backup/smeserver.tgz |
77 pv -n -s $size |
78 gunzip |
79 tar xf - > /dev/null ) 2>&1 |
80 @@ -124,6 +128,7 @@
81 system("/bin/umount", "$device");
82 system("/etc/init.d/haldaemon", "stop");
83 system("/etc/init.d/messagebus", "stop");
84 + rmdir("/mnt/bootstrap-console-backup");
85 }
86
87 #use esmith::console;

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed