/[smeserver]/rpms/e-smith-backup/sme9/e-smith-backup-2.4.0-workstation-backup-spaces.patch
ViewVC logotype

Annotation of /rpms/e-smith-backup/sme9/e-smith-backup-2.4.0-workstation-backup-spaces.patch

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


Revision 1.1 - (hide annotations) (download)
Sun Jul 14 04:47:34 2013 UTC (10 years, 11 months ago) by wellsi
Branch: MAIN
CVS Tags: e-smith-backup-2_4_0-7_el6_sme
* Sat Jul 13 2013 Ian Wells <esmith@wellsi.com> 2.4.0-7.sme
- Workstation Backup, allow spaces in the backup destination [SME: 7763]
  Includes fix for disk usage broken with spaces. [SME: 7784]

1 wellsi 1.1 diff -ruN e-smith-backup-2.4.0.old/root/etc/e-smith/events/actions/workstation-backup-dar e-smith-backup-2.4.0/root/etc/e-smith/events/actions/workstation-backup-dar
2     --- e-smith-backup-2.4.0.old/root/etc/e-smith/events/actions/workstation-backup-dar 2013-07-07 21:03:58.000000000 -0700
3     +++ e-smith-backup-2.4.0/root/etc/e-smith/events/actions/workstation-backup-dar 2013-07-07 21:52:12.000000000 -0700
4     @@ -29,6 +29,7 @@
5     use File::Path;
6     use File::Find;
7     use POSIX ":sys_wait_h";
8     +use File::Glob qw(bsd_glob);
9     use esmith::ConfigDB;
10    
11     sub ldie;
12     @@ -175,7 +176,7 @@
13     }
14     }
15    
16     - system("/bin/mkdir -p /$smbshare");
17     + system("/bin/mkdir", "-p", "/$smbshare");
18    
19     $err = qx(/bin/mount $device "/$smbshare" 2>&1);
20     if ($err) {ldie("Error while mounting $device /$smbshare : \n" . $err)};
21     @@ -193,6 +193,7 @@
22     open FD, '/proc/mounts';
23     while (<FD>)
24     {
25     + s/\\040/ /g; # /proc/mount returns spaces as \040 which causes problems in matching
26     next unless /\s$mntdir\s/;
27     $err++;
28     }
29     @@ -279,6 +281,8 @@
30     # removing .dar extension
31     $ref =~ s/\..*\.dar$//;
32     $ref = "--ref " . $setdirname . "/" . $ref;
33     + $ref = "--ref|" . $setdirname . "/" . $ref; # | will be used to split this string in run_backup()
34     +
35     $bkname = "inc-" . sprintf("%03d", $incnum) . "-". $bkname;
36     }
37     }
38     @@ -326,7 +330,7 @@
39    
40     $report .= "Moving backup files to target directory $setdirname \n";
41    
42     -foreach (<$tmpdir/$id/$bkname*>)
43     +foreach (bsd_glob("$tmpdir/$id/$bkname*"))
44     {
45     ldie("Error while moving backup file $_ from temporary dir $tmpdir/$id to $setdirname : $!")
46     unless move($_, $setdirname);
47     @@ -374,7 +296,8 @@
48     my @bknum;
49     my @setd;
50     my @bkname;
51     -open(DAR_LIST, "/usr/bin/dar_manager -Q -B $catalog -l |");
52     +open(DAR_LIST, "/usr/bin/dar_manager -Q -B \"$catalog\" -l |");
53     +
54     while (<DAR_LIST>)
55     {
56     next unless ($_ =~ /set/);
57     @@ -426,8 +426,8 @@
58     }
59    
60     # Check free disk space
61     -my $df = qx(/bin/df -Ph $mntdir);
62     -if ($df =~ /^\S+\s+(\S+)\s+(\S+)\s+(\S+)\s+(\d*%)/mi)
63     +my $df = qx(/bin/df -Ph \"$mntdir\");
64     +if ($df =~ /(\S+)\s+(\S+)\s+(\S+)\s+(\d*%)/)
65     {
66     $report .= "Disk usage $2, $4 full, $3 available\n";
67     }
68     @@ -513,7 +517,7 @@
69     my $killerpid = undef;
70    
71     eval {
72     - ($pid = open INPUT, "-|", "/usr/bin/dar", "-Q", "--create", "$tmpdir/$id/$bkname", split(/\s+/,$ref), "-B", "/etc/dar/$job.dcf") or ldie("cannot start : $!" );
73     + ($pid = open INPUT, "-|", "/usr/bin/dar", "-Q", "--create", "$tmpdir/$id/$bkname", split(/\|/,$ref), "-B", "/etc/dar/$job.dcf") or ldie("cannot start : $!" );
74    
75     if ($pid) {
76     $killerpid = start_dar_killer($pid, $timeout); }
77     diff -ruN e-smith-backup-2.2.0.old/root/etc/e-smith/web/functions/backup e-smith-backup-2.2.0/root/etc/e-smith/web/functions/backup
78     --- e-smith-backup-2.2.0.old/root/etc/e-smith/web/functions/backup 2013-07-06 08:13:49.000000000 -0700
79     +++ e-smith-backup-2.2.0/root/etc/e-smith/web/functions/backup 2013-07-06 11:57:19.000000000 -0700
80     @@ -1783,7 +1783,7 @@
81    
82     # Finding existing backups
83    
84     - find { wanted => \&$setbackuplist, untaint => 1 }, $mntbkdir ;
85     + find { wanted => \&$setbackuplist, untaint => 1, untaint_pattern => qr|^([-+@\w\s./]+)$|}, $mntbkdir ;
86    
87     my %blabels = ();
88     my @blabels;
89     @@ -1936,7 +1936,7 @@
90     # find list of available backups and verify
91     # it contains all backups needed for full restore
92    
93     - find { wanted => \&$backupsetlist, untaint => 1 }, $set ;
94     + find { wanted => \&$backupsetlist, untaint => 1, untaint_pattern => qr|^([-+@\w\s./]+)$| }, $set ;
95    
96     my $key;
97     my $num = 0;
98     @@ -2185,7 +2185,7 @@
99    
100     # Finding existing backups
101    
102     - find { wanted => \&$setbackupflist, untaint => 1 }, $mntbkdir ;
103     + find { wanted => \&$setbackupflist, untaint => 1, untaint_pattern => qr|^([-+@\w\s./]+)$| }, $mntbkdir ;
104    
105     my %blabels = ();
106     my @blabels;
107     @@ -2343,7 +2343,7 @@
108     # finding list of available backups
109     # and verifying all needed backup files are available
110    
111     - find { wanted => \&$backupsetlist, untaint => 1 }, $set ;
112     + find { wanted => \&$backupsetlist, untaint => 1, untaint_pattern => qr|^([-+@\w\s./]+)$| }, $set ;
113    
114     my $key;
115     my $num = 0;
116     @@ -2985,11 +2985,11 @@
117    
118     if ($when)
119     {
120     - $restorerr = system ("/usr/bin/dar_manager -B $mntbkdir/dar-catalog -w $when -e '-N -R / -w' -r @restorelist");
121     + $restorerr = system ("/usr/bin/dar_manager -B \"$mntbkdir/dar-catalog\" -w $when -e '-N -R / -w' -r @restorelist");
122     }
123     else
124     {
125     - $restorerr = system ("/usr/bin/dar_manager -B $mntbkdir/dar-catalog -e '-N -R / -w' -r @restorelist");
126     + $restorerr = system ("/usr/bin/dar_manager -B \"$mntbkdir/dar-catalog\" -e '-N -R / -w' -r @restorelist");
127     }
128    
129     if ($mounted)

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