/[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.1 - (show annotations) (download)
Tue Jun 12 18:30:34 2007 UTC (17 years, 4 months ago) by slords
Branch: MAIN
CVS Tags: e-smith-base-4_18_0-58_el5_sme, e-smith-base-4_18_0-89_el5_sme, e-smith-base-4_18_0-82_el5_sme, e-smith-base-4_18_0-67_el5_sme, e-smith-base-4_18_0-88_el5_sme, e-smith-base-4_18_0-87_el5_sme, e-smith-base-4_18_0-77_el5_sme, e-smith-base-4_18_0-69_el5_sme, e-smith-base-4_18_0-81_el5_sme, e-smith-base-4_18_0-100_el5_sme, e-smith-base-4_18_0-72_el5_sme, e-smith-base-4_18_0-62_el5_sme, e-smith-base-4_18_0-61_el5_sme, e-smith-base-4_18_0-78_el5_sme, e-smith-base-4_18_0-60_el5_sme, e-smith-base-4_18_0-94_el5_sme, e-smith-base-4_18_0-66_el5_sme, e-smith-base-4_18_0-83_el5_sme, e-smith-base-4_18_0-59_el5_sme, e-smith-base-4_18_0-63_el5_sme, e-smith-base-4_18_0-92_el5_sme, e-smith-base-4_18_0-64_el5_sme, e-smith-base-4_18_0-101_el5_sme, e-smith-base-4_18_0-98_el5_sme, e-smith-base-4_18_0-102_el5_sme, e-smith-base-4_18_0-90_el5_sme, e-smith-base-4_18_0-104_el5_sme, e-smith-base-4_18_0-71_el5_sme, e-smith-base-4_18_0-103_el5_sme, e-smith-base-4_18_0-99_el5_sme, e-smith-base-4_18_0-73_el5_sme, e-smith-base-4_18_0-79_el5_sme, e-smith-base-4_18_0-75_el5_sme, e-smith-base-4_18_0-76_el5_sme
Import on branch sme8 of package e-smith-base-4.18.0-58.el5.sme.src.rpm

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