/[smeserver]/rpms/e-smith-backup/sme10/e-smith-backup-2.6.0-replacehal.patch
ViewVC logotype

Annotation of /rpms/e-smith-backup/sme10/e-smith-backup-2.6.0-replacehal.patch

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


Revision 1.3 - (hide annotations) (download)
Fri Feb 12 18:52:48 2021 UTC (3 years, 8 months ago) by chrissn
Branch: MAIN
CVS Tags: e-smith-backup-2_6_0-28_el7_sme, e-smith-backup-2_6_0-24_el7_sme, e-smith-backup-2_6_0-22_el7_sme, e-smith-backup-2_6_0-27_el7_sme, e-smith-backup-2_6_0-25_el7_sme, e-smith-backup-2_6_0-30_el7_sme, e-smith-backup-2_6_0-26_el7_sme, e-smith-backup-2_6_0-29_el7_sme, e-smith-backup-2_6_0-23_el7_sme, HEAD
Changes since 1.2: +1 -2 lines
* Fri Feb 12 2021 Chris Sansom-Ninnes <chris@sansom.ninnes.net> 2.6.0-22.sme
- Remove debug output of device names [SME: 11319]

1 chrissn 1.1 diff -urN e-smith-backup-2.6.0.old/root/etc/e-smith/events/actions/workstation-backup-dar e-smith-backup-2.6.0/root/etc/e-smith/events/actions/workstation-backup-dar
2 chrissn 1.2 --- e-smith-backup-2.6.0.old/root/etc/e-smith/events/actions/workstation-backup-dar 2021-02-09 21:26:24.961634134 +0000
3     +++ e-smith-backup-2.6.0/root/etc/e-smith/events/actions/workstation-backup-dar 2021-02-09 21:29:49.256523741 +0000
4 chrissn 1.1 @@ -31,6 +31,7 @@
5     use File::Glob qw(bsd_glob);
6     use esmith::ConfigDB;
7     use esmith::Backup;
8     +use esmith::BlockDevices;
9    
10     sub ldie;
11     sub start_dar_killer;
12 chrissn 1.3 @@ -312,77 +313,60 @@
13 chrissn 1.1 return $code;
14     }
15    
16     -
17     +# Copied from /etc/e-smith/web/functions/backup
18     +# TODO: Move to a shared module
19     sub checkMount
20     {
21     # check if $mountdir is mounted
22     my $mountdir = shift;
23     $|=1; # Auto-flush
24     -
25     - # copy STDOUT to another filehandle
26     - open (my $STDOLD, '>&', STDOUT);
27     -
28     - open(STDOUT, ">/dev/null");
29     - if ( open(MOUNTDIR, "|-", "/bin/findmnt", $mountdir)){;}
30    
31     - # restore STDOUT
32     - open (STDOUT, '>&', $STDOLD);
33     -
34     - return (!close(MOUNTDIR));
35     + my @res = qx( findmnt $mountdir );
36     + return ( !@res );
37     }
38    
39    
40     -# dmount is copied from /etc/e-smith/web/functions/backup
41     -# it could become a common function later
42     +# Copied from /etc/e-smith/web/functions/backup
43     +# TODO: Move to a shared module
44     sub dmount
45     {
46     # mount dar unit according to dar-workstation configuration
47     # return nothing if mount successfull
48    
49     my ($host,$share,$mountdir,$login,$password,$VFSType) = @_;
50     -
51     +
52     if ($VFSType eq 'cifs')
53     {
54     - return ( qx(/bin/mount -t cifs "//$host/$share" $mountdir -o credentials=/etc/dar/CIFScredentials,nounix 2>&1) );
55     + return ( qx(/bin/mount -t cifs "//$host/$share" $mountdir -o credentials=/etc/dar/CIFScredentials,nounix 2>&1) );
56     }
57     elsif ($VFSType eq 'nfs')
58     {
59     - return ( qx(/bin/mount -t nfs -o nolock "$host:/$share" $mountdir 2>&1) );
60     + return ( qx(/bin/mount -t nfs -o nolock "$host:/$share" $mountdir 2>&1) );
61     }
62     elsif ($VFSType eq 'usb')
63     {
64     my $device = "";
65     - my $blkdev = "";
66     my $vollbl = "";
67     - foreach my $udi (qx(hal-find-by-property --key volume.fsusage --string filesystem))
68     - {
69     - $udi =~ m/^(\S+)/;
70     - my $is_mounted = qx(hal-get-property --udi $1 --key volume.is_mounted);
71    
72     - if ($is_mounted eq "false\n")
73     - {
74     - $blkdev = qx(hal-get-property --udi $1 --key block.device);
75     - if ($blkdev =~ m/^(\S+)/) {$blkdev = $1;}
76     - }
77     - if ($is_mounted eq "false\n")
78     - {
79     - $vollbl = qx(hal-get-property --udi $1 --key volume.label);
80     - $vollbl =~ m/^(\S+)/;
81     - if ($vollbl =~ /^\s/) {$vollbl = 'nolabel';}
82     - }
83     + my $devices = esmith::BlockDevices->new ('allowmount' => 'disabled');
84 chrissn 1.2 + my ($valid, $invalid) = $devices->checkBackupDrives(0);
85 chrissn 1.1
86     - chomp $vollbl;
87     - chomp $blkdev;
88     - $vollbl = "media/$vollbl";
89     - if ($vollbl eq $share) {$device = $blkdev;}
90     + if ( ${$valid}[0] ) {
91     + foreach ( @{$valid} ) {
92     + $vollbl = $devices->label($_);
93     + if ( $share eq "media/$vollbl" ) {
94     + $device = "/dev/$_";
95     + }
96     + }
97     }
98     - return ( qx(/bin/mount $device "/$share" 2>&1) );
99     + $devices->destroy;
100     + return ( qx (mount $device /$share 2>&1) );
101     }
102     else
103     {
104     - return ("Mount of type $VFSType not supported.\n");
105     + return ("Error while mounting $host/$share : $VFSType not supported.\n");
106     }
107     -}
108     +}
109    
110    
111     sub removeTree
112     diff -urN e-smith-backup-2.6.0.old/root/etc/e-smith/web/functions/backup e-smith-backup-2.6.0/root/etc/e-smith/web/functions/backup
113 chrissn 1.2 --- e-smith-backup-2.6.0.old/root/etc/e-smith/web/functions/backup 2021-02-09 21:26:24.926635870 +0000
114     +++ e-smith-backup-2.6.0/root/etc/e-smith/web/functions/backup 2021-02-09 21:29:21.581890670 +0000
115 chrissn 1.1 @@ -27,6 +27,7 @@
116     use esmith::ConfigDB;
117     use esmith::Backup;
118     use esmith::BackupHistoryDB;
119     +use esmith::BlockDevices;
120     use esmith::AccountsDB;
121     use esmith::cgi;
122     use esmith::util;
123     @@ -697,9 +698,9 @@
124     if (defined $status && $status eq "on")
125     {
126    
127     - #--------------------------------------------------
128     - # Untaint parameters and check for validity
129     - #--------------------------------------------------
130     + #--------------------------------------------------
131     + # Untaint parameters and check for validity
132     + #--------------------------------------------------
133    
134     my $backupHour = $q->param ('backupHour');
135     if ($backupHour =~ /^(.*)$/) {
136     @@ -1237,23 +1238,20 @@
137     $q, undef, $fm->localise('CONFIGURE_WORKSTN_BACKUP'));
138    
139     if ( $VFSType eq 'usb' ) {
140     - foreach my $udi (qx(hal-find-by-property --key volume.fsusage --string filesystem)) {
141     - $udi =~ m/^(\S+)/;
142     + my $devices = esmith::BlockDevices->new ('allowmount' => 'disabled');
143 chrissn 1.2 + my ($valid, $invalid) = $devices->checkBackupDrives(0);
144 chrissn 1.1
145     - my $is_mounted = qx(hal-get-property --udi $1 --key volume.is_mounted);
146     -
147     - if ($is_mounted eq "false\n") {
148     - my $vollbl = qx(hal-get-property --udi $1 --key volume.label);
149     - $vollbl =~ m/^(\S+)/;
150     - if ($vollbl =~ /^\s/) {$vollbl = 'nolabel';}
151     - chomp $vollbl;
152     - push @usbdisks, $vollbl;
153     + if ( ${$valid}[0] ) {
154     + foreach ( @{$valid} ) {
155     + push @usbdisks, $devices->label($_);
156     }
157     }
158     - unless ($usbdisks[0]){
159     + else
160     + {
161     push @usbdisks, $fm->localise('ERR_NO_USB_DISK');
162     $error='nousb';
163     }
164     + $devices->destroy;
165     }
166     if ( $VFSType eq 'mnt' )
167     {
168     @@ -1509,9 +1507,9 @@
169     return;
170     }
171    
172     - #--------------------------------------------------
173     - # Untaint parameters and check for validity
174     - #--------------------------------------------------
175     + #--------------------------------------------------
176     + # Untaint parameters and check for validity
177     + #--------------------------------------------------
178    
179     my $VFSType = $q->param ('VFSType');
180     if ( $VFSType eq 'nousb')
181     @@ -3007,7 +3005,7 @@
182     my $dumpsize = 0;
183    
184     open(DF, "-|")
185     - or exec '/bin/df', '-P', '-t', 'ext3', '-t', 'ext4';
186     + or exec '/bin/df', '-P', '-t', 'ext3', '-t', 'ext4', '-t', 'xfs';
187    
188     while (<DF>)
189     {
190     @@ -3034,7 +3032,7 @@
191     my $halffree = 0;
192    
193     open(DF, "-|")
194     - or exec '/bin/df', '-P', '-t', 'ext3', '-t', 'ext4', '/tmp';
195     + or exec '/bin/df', '-P', '-t', 'ext3', '-t', 'ext4', '-t', 'xfs', '/tmp';
196    
197     while (<DF>)
198     {
199     @@ -3106,30 +3104,21 @@
200     elsif ($VFSType eq 'usb')
201     {
202     my $device = "";
203     - my $blkdev = "";
204     my $vollbl = "";
205     - foreach my $udi (qx(hal-find-by-property --key volume.fsusage --string filesystem)) {
206     - $udi =~ m/^(\S+)/;
207     - my $is_mounted = qx(hal-get-property --udi $1 --key volume.is_mounted);
208     -
209     - if ($is_mounted eq "false\n") {
210     - $blkdev = qx(hal-get-property --udi $1 --key block.device);
211     - if ($blkdev =~ m/^(\S+)/) {$blkdev = $1;}
212     - }
213     - if ($is_mounted eq "false\n") {
214     - $vollbl = qx(hal-get-property --udi $1 --key volume.label);
215     - $vollbl =~ m/^(\S+)/;
216     - if ($vollbl =~ /^\s/) {$vollbl = 'nolabel';}
217     - }
218     -
219     - chomp $vollbl;
220     - chomp $blkdev;
221     - $vollbl = "media/$vollbl";
222     - if ($vollbl eq $share) {
223     - $device = $blkdev;
224     - }
225     +
226     + my $devices = esmith::BlockDevices->new ('allowmount' => 'disabled');
227 chrissn 1.2 + my ($valid, $invalid) = $devices->checkBackupDrives(0);
228 chrissn 1.1 +
229     + if ( ${$valid}[0] ) {
230     + foreach ( @{$valid} ) {
231     + $vollbl = $devices->label($_);
232     + if ( $share eq "media/$vollbl" ) {
233     + $device = "/dev/$_";
234     + }
235     + }
236     }
237     - return ( qx(/bin/mount $device "/$share" 2>&1) );
238     + $devices->destroy;
239     + return ( qx (mount $device /$share 2>&1) );
240     }
241     else
242     {
243     @@ -3142,17 +3131,9 @@
244     # check if $mountdir is mounted
245     my $mountdir = shift;
246     $|=1; # Auto-flush
247     -
248     - # copy STDOUT to another filehandle
249     - open (my $STDOLD, '>&', STDOUT);
250     -
251     - open(STDOUT, ">/dev/null");
252     - if ( open(MOUNTDIR, "|-", "/bin/findmnt", $mountdir)){;}
253     -
254     - # restore STDOUT
255     - open (STDOUT, '>&', $STDOLD);
256     -
257     - return (!close(MOUNTDIR));
258     +
259     + my @res = qx( findmnt $mountdir );
260     + return ( !@res );
261     }
262    
263     sub bmount

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