/[smeserver]/rpms/e-smith-backup/sme8/e-smith-backup-1.15.0-no_desktop_verify_restore.patch
ViewVC logotype

Contents of /rpms/e-smith-backup/sme8/e-smith-backup-1.15.0-no_desktop_verify_restore.patch

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


Revision 1.2 - (show annotations) (download)
Tue Oct 7 19:27:49 2008 UTC (15 years, 7 months ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
New streams

1 diff -Nur -x '*.orig' -x '*.rej' e-smith-backup-1.15.0/root/etc/e-smith/web/functions/backup mezzanine_patched_e-smith-backup-1.15.0/root/etc/e-smith/web/functions/backup
2 --- e-smith-backup-1.15.0/root/etc/e-smith/web/functions/backup 2007-09-11 16:18:01.000000000 -0400
3 +++ mezzanine_patched_e-smith-backup-1.15.0/root/etc/e-smith/web/functions/backup 2007-09-11 16:17:22.000000000 -0400
4 @@ -77,14 +77,6 @@
5 {
6 performAndShowResult ($q);
7 }
8 -elsif ($q->param ('state') eq "desktop-restore")
9 -{
10 - performDesktopRestore($q);
11 -}
12 -elsif ($q->param ('state') eq "desktop-verify")
13 -{
14 - performDesktopVerify($q);
15 -}
16 elsif ($q->param ('state') eq "tape-configure")
17 {
18 updateTapeBackupConfig($q);
19 @@ -231,8 +223,6 @@
20
21 my %labels = (
22 "desktop-backup" => $fm->localise('DESKTOP_BACKUP'),
23 - "desktop-restore" => $fm->localise('DESKTOP_RESTORE'),
24 - "desktop-verify" => $fm->localise('DESKTOP_VERIFY'),
25 "tape-configure" => $fm->localise('TAPE_CONFIGURE'),
26 "tape-restore" => $fm->localise('TAPE_RESTORE'),
27 "workstn-configure" => $fm->localise('WORKSTN_CONFIGURE'),
28 @@ -243,8 +233,6 @@
29
30 my @labels = (
31 'desktop-backup',
32 - 'desktop-restore',
33 - 'desktop-verify',
34 'tape-configure',
35 'tape-restore',
36 'workstn-configure',
37 @@ -420,14 +408,6 @@
38 {
39 desktopBackup();
40 }
41 - elsif ($function eq 'desktop-restore')
42 - {
43 - desktopRestore();
44 - }
45 - elsif ($function eq 'desktop-verify')
46 - {
47 - desktopVerify();
48 - }
49 elsif ($function eq 'tape-configure')
50 {
51 TapeBackupConfig ($q);
52 @@ -546,317 +526,6 @@
53 $backup_rec->set_prop('Result', "0");
54 }
55
56 -sub desktopRestore ()
57 -{
58 - my (undef, undef, $tmpfree, $halffree) = &CalculateSizes();
59 -
60 - esmith::cgi::genHeaderNonCacheable ($q, undef,
61 - $fm->localise('RESTORE_SERVER_CONFIG'));
62 -
63 - print $q->p ($fm->localise('DESKTOP_RESTORE_DESC'));
64 -
65 - my $freespace = eval 'return "'.$fm->localise('FREE_SPACE').'";';
66 - print $q->p($freespace);
67 -
68 - print $q->p (
69 - $q->b ($fm->localise('MUST_REBOOT_AFTER_RESTORE')));
70 -
71 - print $q->start_multipart_form(
72 - -method => 'POST',
73 - -action => $q->url (-absolute => 1)
74 - );
75 -
76 - print $q->table (
77 - {border => 0, cellspacing => 0, cellpadding => 4},
78 -
79 - esmith::cgi::genWidgetRow(
80 - $q,
81 - $fm->localise('FILE_TO_RESTORE'),
82 - $q->filefield(
83 - -name => 'backupFile',
84 - -default => 'smeserver.tgz',
85 - -size => 32
86 - )
87 - ),
88 - );
89 - print $q->start_table ({width => "100%", -class => "sme-noborders"});
90 - print esmith::cgi::genButtonRow(
91 - $q,
92 - $q->submit(
93 - -name => 'action',
94 - -value => $fm->localise('RESTORE')
95 - )
96 - );
97 - print $q->end_table,"\n";
98 - print $q->hidden(
99 - -name => 'state',
100 - -override => 1,
101 - -default => 'desktop-restore'
102 - );
103 -
104 - print $q->endform;
105 -
106 - esmith::cgi::genFooter($fm);
107 -}
108 -
109 -sub desktopVerify ()
110 -{
111 - my (undef, undef, $tmpfree, $halffree) = &CalculateSizes();
112 -
113 - esmith::cgi::genHeaderNonCacheable ($q, undef,
114 - $fm->localise('VERIFY_DESKTOP_BACKUP_FILE'));
115 -
116 - print $q->p ($fm->localise('VERIFY_BACKUP_DESC'));
117 -
118 - print $q->start_multipart_form(
119 - -method => 'POST',
120 - -action => $q->url (-absolute => 1)
121 - );
122 -
123 - print $q->table (
124 - {border => 0, cellspacing => 0, cellpadding => 4},
125 -
126 - esmith::cgi::genWidgetRow(
127 - $q,
128 - $fm->localise('SELECT_BACKUP_FILE'),
129 - $q->filefield(
130 - -name => 'backupFile',
131 - -default => 'smeserver.tgz',
132 - -size => 32
133 - )
134 - ));
135 -
136 - print $q->table ({width => "100%", -class => "sme-noborders"},
137 - esmith::cgi::genButtonRow(
138 - $q,
139 - $q->submit(
140 - -name => 'action',
141 - -value => $fm->localise('VERIFY')
142 - )
143 - )),"\n";
144 -
145 - print $q->hidden(
146 - -name => 'state',
147 - -override => 1,
148 - -default => 'desktop-verify'
149 - );
150 -
151 - print $q->endform;
152 -
153 - esmith::cgi::genFooter($fm);
154 -}
155 -
156 -sub performDesktopRestore
157 -{
158 - my ($q) = @_;
159 -
160 - # Need to validate this here: $q->param ('backupFile');
161 - my $lock_file = "/var/lock/subsys/e-smith-restore";
162 - my $file_handle = &esmith::lockfile::LockFileOrReturn($lock_file);
163 -
164 - unless ($file_handle)
165 - {
166 - esmith::cgi::genHeaderNonCacheable(
167 - $q,
168 - undef, $fm->localise('RESTORE_CANNOT_PROCEED')
169 - );
170 -
171 - print $q->p (
172 - $q->b ($fm->localise('ANOTHER_RESTORE_IN_PROGRESS')
173 - )
174 - );
175 -
176 - esmith::cgi::genFooter($fm);
177 - return;
178 - }
179 -
180 - my $rec = $restore->get('restore');
181 - $rec->set_prop('state','running');
182 - $rec->set_prop('start', time);
183 - unless (system("/sbin/e-smith/signal-event", "pre-restore") == 0)
184 - {
185 - esmith::cgi::genHeaderNonCacheable(
186 - $fm->{cgi},
187 - undef, $fm->localise('OPERATION_STATUS_REPORT'));
188 - esmith::cgi::genResult(
189 - $fm->{cgi}, $fm->localise('ERR_PRE_RESTORE'));
190 - return;
191 - }
192 -
193 - if (open(RD, "-|"))
194 - {
195 -
196 - #----------------------------------------
197 - # restore system from uploaded backup file
198 - #----------------------------------------
199 -
200 - esmith::cgi::genHeaderNonCacheable ($q, undef,
201 - $fm->localise('RESTORE_IN_PROGRESS'));
202 -
203 - print $q->p (
204 - $q->b ($fm->localise('RESTORE_IN_PROGRESS_DESC')
205 - )
206 - );
207 -
208 - print $q->p($fm->localise('FILES_HAVE_BEEN_RESTORED'));
209 -
210 - print "<UL>";
211 - my $complete = 0;
212 - while (<RD>)
213 - {
214 - $complete++ if /^etc\/smbpasswd$/; # 5.x case
215 - $complete++ if /^etc\/samba\/smbpasswd$/; # 6.0 base
216 - print "<li>$_</li>\n";
217 - }
218 -
219 - print "</UL>";
220 - my $message;
221 - if (!close RD)
222 - {
223 - $message = $fm->localise('RESTORE_FAILED_MSG');
224 - }
225 - else
226 - {
227 - #-----------------------------------------------------
228 - # if restore completed, regenerate configuration files
229 - #-----------------------------------------------------
230 - if ($complete)
231 - {
232 -
233 - $message = $fm->localise('RESTORE_COMPLETE');
234 - system("/usr/sbin/groupmod", "-g", "$www_gid", "www") == 0
235 - or warn ($fm->localise('ERR_RESTORING_GID')."\n");
236 - system("/usr/sbin/usermod", "-g", "$www_gid", "www") == 0
237 - or warn ($fm->localise('ERR_RESTORING_INITIAL_GRP')."\n");
238 - system("/sbin/e-smith/signal-event", "post-upgrade") == 0
239 - or die ($fm->localise('ERR_UPDATING_SYSCONF')."\n");
240 - }
241 - else
242 - {
243 - $message = $fm->localise('RESTORE_FAILED');
244 - }
245 - }
246 -
247 - $rec->set_prop('state', 'complete');
248 - $rec->set_prop('finish', time);
249 -
250 - &esmith::lockfile::UnlockFile($file_handle);
251 -
252 - print $q->p ($q->b ($message));
253 -
254 - print $q->startform(
255 - -method => 'POST',
256 - -action => $q->url (-absolute => 1)
257 - );
258 - print $q->p($q->b ($fm->localise('YOU_MUST_REBOOT'))),"\n";
259 - print $q->start_table ({width => "100%", -class => "sme-noborders"}),"\n";
260 - print esmith::cgi::genButtonRow(
261 - $q,
262 - $q->submit (-name => 'action', -value =>
263 - $fm->localise('REBOOT'))
264 - );
265 - # Put in a hidden widget to store the reboot value.
266 - print $q->hidden(
267 - -name => 'function',
268 - -value => 'reboot'
269 - ),"\n";
270 - print $q->hidden (
271 - -name => 'state',
272 - -override => 1,
273 - -default => 'perform'
274 - ),"\n";
275 - print $q->end_table,"\n";
276 - print $q->endform;
277 -
278 - esmith::cgi::genFooter($fm);
279 - }
280 - else
281 - {
282 - select(STDOUT);
283 - $| = 1;
284 -
285 - my $backupFile = $q->param ('backupFile');
286 -
287 - my $decodeCommand = ( $backupFile =~ /\.bak$/ ) ?
288 - "|/usr/bin/uudecode -o /dev/stdout" :
289 - "|/usr/bin/gzip -d";
290 -
291 - open(WR,
292 - $decodeCommand
293 - . " | /bin/tar --directory / --extract --verbose --file=-"
294 - ) || die ($fm->localise('COULD_NOT_EXEC_PIPELINE')."$!\n");
295 -
296 - while (<$backupFile>)
297 - {
298 - print WR;
299 - }
300 -
301 - close WR || die($fm->localise('COULD_NOT_DECODE')."$!\n");
302 - exit(0);
303 - }
304 - return;
305 -}
306 -
307 -sub performDesktopVerify
308 -{
309 - my ($q) = @_;
310 -
311 - if (open(RD, "-|"))
312 - {
313 - esmith::cgi::genHeaderNonCacheable ($q,
314 - undef, $fm->localise("VERIFY_DESKTOP_BACKUP_FILE"));
315 -
316 - print $q->p($fm->localise('FILES_IN_BACKUP'));
317 -
318 - print "<UL>";
319 -
320 - my $complete = 0;
321 - while (<RD>)
322 - {
323 - $complete++ if /^etc\/smbpasswd$/; # 5.x case
324 - $complete++ if /^etc\/samba\/smbpasswd$/; # 6.0 base
325 - print "<li>$_</li>\n";
326 - }
327 -
328 - print "</UL>";
329 - my $status = close RD ?
330 - ($complete ?
331 - $fm->localise('VERIFY_COMPLETE') :
332 - $fm->localise('BACKUP_FILE_INCOMPLETE'))
333 - : $fm->localise('ERROR_READING_FILE');
334 - print $q->p ($q->b ($status));
335 -
336 - esmith::cgi::genFooter($fm);
337 -
338 - }
339 - else
340 - {
341 - select(STDOUT);
342 - $| = 1;
343 -
344 - my $backupFile = $q->param ('backupFile');
345 -
346 - my $decodeCommand = ( $backupFile =~ /\.bak$/ ) ?
347 - "|/usr/bin/uudecode -o /dev/stdout" :
348 - "|/usr/bin/gzip -d";
349 -
350 - open(WR,
351 - $decodeCommand
352 - . " | /bin/tar --directory / --list --file=-"
353 - ) || die ($fm->localise('COULD_NOT_DECODE')."$!\n");
354 -
355 - while (<$backupFile>)
356 - {
357 - print WR;
358 - }
359 -
360 - close WR;
361 - exit 0;
362 - }
363 -
364 - return;
365 -}
366 -
367 sub TapeBackupConfig
368 {
369 my ($q) = @_;

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