/[smeserver]/rpms/e-smith-base/sme9/e-smith-base-5.4.0-performRestoreNonCode.patch
ViewVC logotype

Contents of /rpms/e-smith-base/sme9/e-smith-base-5.4.0-performRestoreNonCode.patch

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


Revision 1.1 - (show annotations) (download)
Fri Mar 7 06:45:08 2014 UTC (10 years, 8 months ago) by wellsi
Branch: MAIN
CVS Tags: e-smith-base-5_4_0-62_el6_sme, e-smith-base-5_4_0-60_el6_sme, e-smith-base-5_4_0-61_el6_sme, e-smith-base-5_4_0-58_el6_sme, e-smith-base-5_4_0-59_el6_sme
* Thu Mar 6 2014 Ian Wells <esmith@wellsi.com> 5.4.0-58.sme
- Add restore backup as a console item for freshly installed servers [SME: 8259]
- Non-code changes to perform_restore.pm

1 diff -ruN e-smith-base-5.4.0.two/root/usr/share/perl5/vendor_perl/esmith/console/perform_restore.pm e-smith-base-5.4.0/root/usr/share/perl5/vendor_perl/esmith/console/perform_restore.pm
2 --- e-smith-base-5.4.0.two/root/usr/share/perl5/vendor_perl/esmith/console/perform_restore.pm 2014-03-06 21:05:43.000000000 -0800
3 +++ e-smith-base-5.4.0/root/usr/share/perl5/vendor_perl/esmith/console/perform_restore.pm 2014-03-06 21:51:02.000000000 -0800
4 @@ -33,7 +33,7 @@
5 my ($rc, $choice) = $console->yesno_page
6 (
7 title => gettext("Restore From Backup"),
8 - defaultno => 1,
9 + defaultno => 1,
10 text =>
11 gettext("Do you wish to restore from backup?"),
12 );
13 @@ -71,31 +71,31 @@
14 }
15 unless ($dirs[0])
16 {
17 - ($rc, $choice) = $console->message_page
18 - (
19 - title => gettext("Backup medium not found"),
20 - right => "Try again",
21 - text =>
22 - gettext("No removable media or device found"),
23 - );
24 - goto INITIATE_RESTORE;
25 + ($rc, $choice) = $console->message_page
26 + (
27 + title => gettext("Backup medium not found"),
28 + right => "Try again",
29 + text =>
30 + gettext("No removable media or device found"),
31 + );
32 + goto INITIATE_RESTORE;
33 }
34 my $device = $dirs[0];
35 if (defined $dirs[1])
36 {
37 - my $count=1;
38 -# FIXME use better regexp
39 - my @args = map { /(.*)/; $count++ . '.' => $1 } @dirs;
40 -
41 - my ($rc, $choice) = $console->menu_page
42 - (
43 - title => gettext("Choose device to restore from"),
44 - text => gettext("Please select which device contains the backup file you wish to restore from."),
45 - argsref => \@args,
46 - left => gettext("Cancel"),
47 - right => gettext("OK"),
48 + my $count=1;
49 + # FIXME use better regexp
50 + my @args = map { /(.*)/; $count++ . '.' => $1 } @dirs;
51 +
52 + my ($rc, $choice) = $console->menu_page
53 + (
54 + title => gettext("Choose device to restore from"),
55 + text => gettext("Please select which device contains the backup file you wish to restore from."),
56 + argsref => \@args,
57 + left => gettext("Cancel"),
58 + right => gettext("OK"),
59 );
60 - goto INITIATE_RESTORE unless ($rc == 0);
61 + goto INITIATE_RESTORE unless ($rc == 0);
62 my %args_hash = ( @args );
63 $device = $args_hash{$choice};
64 }
65 @@ -105,14 +105,14 @@
66 unless (-f "/mnt/bootstrap-console-backup/smeserver.tgz")
67 {
68 system("/bin/umount", "$device");
69 - ($rc, $choice) = $console->message_page
70 - (
71 - title => gettext("Backup file not found"),
72 - right => "Try again",
73 - text =>
74 - gettext("No backup file found"),
75 - );
76 - goto INITIATE_RESTORE;
77 + ($rc, $choice) = $console->message_page
78 + (
79 + title => gettext("Backup file not found"),
80 + right => "Try again",
81 + text =>
82 + gettext("No backup file found"),
83 + );
84 + goto INITIATE_RESTORE;
85 }
86 use File::stat;
87 my $st = stat("/mnt/bootstrap-console-backup/smeserver.tgz");
88 @@ -133,23 +133,25 @@
89 }
90 system("/sbin/e-smith/signal-event", "pre-restore");
91 system("(cd / ; cat /mnt/bootstrap-console-backup/smeserver.tgz |
92 - pv -n -s $size |
93 - gunzip |
94 - tar xf - > /dev/null ) 2>&1 |
95 - dialog --backtitle 'Restoring data' --guage 'Progress' 7 70");
96 + pv -n -s $size |
97 + gunzip |
98 + tar xf - > /dev/null ) 2>&1 |
99 + dialog --backtitle 'Restoring data' --guage 'Progress' 7 70");
100 $db->set_prop("bootstrap-console", "ForceSave", "yes");
101 system("/bin/umount", "$device");
102 system("/etc/init.d/haldaemon", "stop");
103 system("/etc/init.d/messagebus", "stop");
104 rmdir("/mnt/bootstrap-console-backup");
105 system("/sbin/e-smith/signal-event", "post-upgrade");
106 + return;
107 }
108
109 # Determine if this server is a fresh install for restore from backup
110 +# Earlier the expression used was ($db->get_value('PasswordSet') eq 'yes')
111 +# To prevent a restore return a negative number
112 +# To allow a restore choose an appropiate sort order, eg 90
113 sub installOrder
114 {
115 -#my $db = esmith::ConfigDB::unsaved->open;
116 -#return if ($db->get_value('PasswordSet') eq 'yes'); # Too late to do a restore
117 my $order = (`grep :x:5...: /etc/group`) ? -1 : 90;
118 return $order;
119 }

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