/[smeserver]/rpms/e-smith-base/sme8/e-smith-base-4.18.0-consolebackup.patch
ViewVC logotype

Contents of /rpms/e-smith-base/sme8/e-smith-base-4.18.0-consolebackup.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:51 2008 UTC (16 years, 7 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/sbin/e-smith/console-menu-items/usbBackup.pl mezzanine_patched_e-smith-base-4.18.0/root/sbin/e-smith/console-menu-items/usbBackup.pl
2 --- e-smith-base-4.18.0/root/sbin/e-smith/console-menu-items/usbBackup.pl 1969-12-31 17:00:00.000000000 -0700
3 +++ mezzanine_patched_e-smith-base-4.18.0/root/sbin/e-smith/console-menu-items/usbBackup.pl 2007-01-29 19:32:00.000000000 -0700
4 @@ -0,0 +1,3 @@
5 +package esmith::console::perform_backup;
6 +use esmith::console::perform_backup;
7 +return new esmith::console::perform_backup;
8 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
9 --- e-smith-base-4.18.0/root/usr/lib/perl5/site_perl/esmith/console/perform_backup.pm 1969-12-31 17:00:00.000000000 -0700
10 +++ mezzanine_patched_e-smith-base-4.18.0/root/usr/lib/perl5/site_perl/esmith/console/perform_backup.pm 2007-01-29 19:32:44.000000000 -0700
11 @@ -0,0 +1,149 @@
12 +package esmith::console::perform_backup;
13 +use strict;
14 +use warnings;
15 +use esmith::ConfigDB;
16 +use esmith::console;
17 +use esmith::util;
18 +use Locale::gettext;
19 +use esmith::Backup;
20 +#use Filesys::DiskFree;
21 +#use Sys::Filesystem;
22 +
23 +sub new
24 +{
25 + my $class = shift;
26 + my $self = {
27 + name => "Perform backup to USB device",
28 + order => 80,
29 + };
30 + bless $self, $class;
31 + return $self;
32 +}
33 +
34 +sub name
35 +{
36 + return $_[0]->{name};
37 +}
38 +
39 +sub order
40 +{
41 + return -1 if (defined $ARGV [0]);
42 +
43 + return $_[0]->{order};
44 +}
45 +
46 +sub backup_size
47 +{
48 + my $self = shift;
49 +
50 +}
51 +
52 +sub doit
53 +{
54 + my ($self, $console, $db) = @_;
55 + my @backup_list = esmith::Backup->restore_list;
56 +
57 + $ENV{PATH} = "/bin:/usr/bin";
58 +
59 + my ($rc, $choice) = $console->yesno_page
60 + (
61 + title => gettext("Create Backup to USB disk"),
62 + defaultno => 1,
63 + text =>
64 + gettext("Do you wish to create backup on USB device?"),
65 + );
66 + return unless $rc == 0;
67 + INITIATE_BACKUP:
68 + ($rc, $choice) = $console->message_page
69 + (
70 + title => gettext("Insert media to use for backup"),
71 + text =>
72 + gettext("Insert memory stick or USB disk, then hit the enter key."),
73 + );
74 + sleep(3);
75 + my @dirs = map { m:^(/media/usbdisk*):; $1 } glob '/media/usbdisk*';
76 + unless ($dirs[0])
77 + {
78 + ($rc, $choice) = $console->message_page
79 + (
80 + title => gettext("Backup medium not found"),
81 + right => "Try again",
82 + text =>
83 + gettext("No removable media or device found"),
84 + );
85 + goto INITIATE_BACKUP;
86 + }
87 + my $device = $dirs[0];
88 + if (defined $dirs[1])
89 + {
90 + my $count=1;
91 + my @args = map { $count++ . '.' => $_ } @dirs;
92 +
93 + my ($rc, $choice) = $console->menu_page
94 + (
95 + title => gettext("Choose device to use for backup"),
96 + text => gettext("Please select which device should be used for the backup file."),
97 + argsref => \@args,
98 + left => gettext("Cancel"),
99 + right => gettext("OK"),
100 + );
101 + goto INITIATE_BACKUP unless ($rc == 0);
102 + my %args_hash = ( @args );
103 + $device = $args_hash{$choice};
104 + }
105 + system("/bin/mount", "$device");
106 + use File::stat;
107 + my $st = stat("$device/smeserver.tgz");
108 + if ($st)
109 + {
110 +# TODO
111 +# old backup exists - what do we want to do with it?
112 + my $size = $st->size;
113 +
114 + }
115 +
116 +# XXX-FIXME
117 +# We call dialog directly (rather than through the screen function)
118 +# as we don't want the --clear parameter passed by screen().
119 +# Appropriate magic can clean this up.
120 +system(
121 + "/usr/bin/dialog",
122 + "--backtitle", $console->backtitle,
123 + "--title", gettext("Preparing for backup"),
124 + "--infobox", gettext("Please standby while the system is " .
125 + "prepared for backup ..."),
126 + 8, esmith::console::SCREEN_COLUMNS,
127 + );
128 +
129 + my $backup_size = 0;
130 + system("/sbin/e-smith/signal-event", "pre-backup");
131 + unless (open(DU, "-|"))
132 + {
133 + open(STDERR, ">/dev/null");
134 + exec qw(/usr/bin/du -sb), map { "/$_" } @backup_list;
135 + }
136 + while (<DU>)
137 + {
138 + next unless (/^(\d+)/);
139 + $backup_size += $1;
140 + }
141 + close DU;
142 +
143 + system("(cd / ; tar cf - " . join(' ', @backup_list) . " |
144 + pv -i 0.2 -n -s $backup_size |
145 + gzip -9 > /$device/smeserver.tgz ) 2>&1 |
146 + dialog --backtitle 'Creating backup file' --guage 'Progress' 7 70");
147 + system("/bin/umount", "$device");
148 + system("/sbin/e-smith/signal-event", "post-backup");
149 + ($rc, $choice) = $console->message_page
150 + (
151 + title => gettext("Backup complete"),
152 + text =>
153 + gettext("Remove memory stick or USB disk, then hit the enter key."),
154 + );
155 +}
156 +
157 +#use esmith::console;
158 +#esmith::console::perform_backup->new->doit(esmith::console->new,
159 +# esmith::ConfigDB->open);
160 +1;

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