/[smeserver]/rpms/e-smith-base/sme7/e-smith-base-4.18.0-usbback_errcheck.patch
ViewVC logotype

Contents of /rpms/e-smith-base/sme7/e-smith-base-4.18.0-usbback_errcheck.patch

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


Revision 1.2 - (show annotations) (download)
Wed Mar 26 17:01:38 2008 UTC (16 years, 2 months ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
* Wed Mar 26 2008 Shad L. Lords <slords@mail.com> 4.18.1-2
- Fix gettext strings returned by password checks [SME: 4104]

1 diff -Nur -x '*.orig' -x '*.rej' e-smith-base-4.18.0/root/usr/lib/perl5/site_perl/esmith/console/perform_backup.pm mezzanine_patched_e-smith-base-4.18.0/root/usr/lib/perl5/site_perl/esmith/console/perform_backup.pm
2 --- e-smith-base-4.18.0/root/usr/lib/perl5/site_perl/esmith/console/perform_backup.pm 2007-06-28 08:33:59.000000000 -0600
3 +++ mezzanine_patched_e-smith-base-4.18.0/root/usr/lib/perl5/site_perl/esmith/console/perform_backup.pm 2007-06-28 08:33:19.000000000 -0600
4 @@ -36,6 +36,94 @@
5
6 }
7
8 +sub make_backup_callback
9 +{
10 + my $device = shift;
11 + return sub {
12 + my $fh = shift;
13 + my @backup_list = esmith::Backup->restore_list;
14 +
15 + unless (open(DU, "-|"))
16 + {
17 + open(STDERR, ">/dev/null");
18 + exec qw(/usr/bin/du -sb), map { "/$_" } @backup_list;
19 + }
20 + my $backup_size = 0;
21 + while (<DU>)
22 + {
23 + next unless (/^(\d+)/);
24 + $backup_size += $1;
25 + }
26 + close DU;
27 +
28 + open(OLDSTDOUT, ">&STDOUT");
29 + unless (open(STDOUT, ">/$device/smeserver.tgz"))
30 + {
31 + return gettext("Could not create backup file on device").": $!\n";
32 + }
33 +
34 + open(OLDSTDERR, ">&STDERR");
35 + my $logger = open(STDERR, "|-");
36 + die "Can't fork: $!\n" unless defined $logger;
37 +
38 + unless ($logger)
39 + {
40 + exec qw(/usr/bin/logger -p local1.info -t console_backup);
41 + }
42 +
43 + my $status = 0;
44 +
45 + my $gzip = open(GZIP, "|-");
46 + return "could not run gzip" unless defined $gzip;
47 + unless ($gzip)
48 + {
49 + close $fh;
50 + exec "gzip", "-9";
51 + }
52 +
53 + my $pv = open(PV, "|-");
54 + return "could not run pv" unless defined $pv;
55 + unless ($pv)
56 + {
57 + open(STDOUT, ">&GZIP");
58 + close GZIP;
59 + open(STDERR, ">&$fh");
60 + exec qw(pv -i 0.2 -n -s), $backup_size
61 + }
62 +
63 + my $tar = fork;
64 + return "could not run tar" unless defined $tar;
65 + unless ($tar)
66 + {
67 + open(STDOUT, ">&PV");
68 + close PV;
69 + close GZIP;
70 + close $fh;
71 + chdir "/";
72 + exec qw(tar cf -), grep { -e $_ } @backup_list;
73 + }
74 + waitpid($tar, 0);
75 + $status |= $?;
76 + #warn "status from tar is $status\n" if $status;
77 + unless (close PV)
78 + {
79 + $status |= $! ? $! : $?;
80 + warn "status from pv is $status\n" if $status;
81 + }
82 + unless (close GZIP)
83 + {
84 + $status |= $! ? $! : $?;
85 + warn "status from gzip is $status\n" if $status;
86 + }
87 +
88 + open(STDOUT, ">&OLDSTDOUT");
89 + open(STDERR, ">&OLDSTDERR");
90 + close(OLDSTDERR);
91 + close(OLDSTDOUT);
92 + return $status ? gettext("Backup returned non-zero") : gettext("Success");
93 + };
94 +}
95 +
96 sub doit
97 {
98 my ($self, $console, $db) = @_;
99 @@ -130,11 +218,9 @@
100 $backup_size += $1;
101 }
102 close DU;
103 +
104 + $console->gauge(make_backup_callback($device), 'title' => 'Creating backup file');
105
106 - system("(cd / ; tar cf - " . join(' ', @backup_list) . " |
107 - pv -i 0.2 -n -s $backup_size |
108 - gzip -9 > /$device/smeserver.tgz ) 2>&1 |
109 - dialog --backtitle 'Creating backup file' --guage 'Progress' 7 70");
110 system("/bin/umount", "$device");
111 system("/sbin/e-smith/signal-event", "post-backup");
112 ($rc, $choice) = $console->message_page

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