/[smeserver]/rpms/e-smith-backup/sme10/e-smith-backup-2.6.0-bz11424-preserve-rootdir-and-var-symlinks.patch
ViewVC logotype

Annotation of /rpms/e-smith-backup/sme10/e-smith-backup-2.6.0-bz11424-preserve-rootdir-and-var-symlinks.patch

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


Revision 1.1 - (hide annotations) (download)
Fri Mar 12 06:18:05 2021 UTC (3 years, 8 months ago) by jpp
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-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, HEAD
* Fri Mar 12 2021 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-24.sme
- fix dar restore replacing rootdir symlinks by folders [SME: 11424]

1 jpp 1.1 diff -Nur --no-dereference e-smith-backup-2.6.0.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup e-smith-backup-2.6.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup
2     --- e-smith-backup-2.6.0.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup 2021-03-11 11:49:18.728000000 -0500
3     +++ e-smith-backup-2.6.0/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/backup 2021-03-12 01:02:22.327000000 -0500
4     @@ -932,4 +932,9 @@
5     <base>ERROR_WHEN_TESTING_REMOTE_SERVER</base>
6     <trans>The parameters have been saved, however the remote host is not reachable, please check your settings.</trans>
7     </entry>
8     + <entry>
9     + <base>DO_NOT_RESTORE_BIN_SBIN_LIB_LIB64_FROM_SME9</base>
10     + <trans>If you restore from Koozali SME Server 9 or before, pay attention that some folders in the system are now symlinks. Basic backup configuration does not include /bin, /lib, /lib64, /sbin, /var/lock and /var/run. If you have added them for files in their subdirectories, we will prevent the restoration of those folders to prevent dar from replacing those symlinks and leave the system unusable. Those additions are, however, not recommended as they are at risk to overwrite files provides by rpms.</trans>
11     + </entry>
12     +
13     </lexicon>
14     diff -Nur --no-dereference 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
15     --- e-smith-backup-2.6.0.old/root/etc/e-smith/web/functions/backup 2021-03-11 11:49:18.784000000 -0500
16     +++ e-smith-backup-2.6.0/root/etc/e-smith/web/functions/backup 2021-03-12 01:14:24.744000000 -0500
17     @@ -2211,6 +2211,10 @@
18     );
19    
20     print $q->table ( {border => 0, cellspacing => 0, cellpadding => 4},
21     + esmith::cgi::genTextRow(
22     + $q,
23     + $q->b($fm->localise('DO_NOT_RESTORE_BIN_SBIN_LIB_LIB64_FROM_SME9')),
24     + ),
25    
26     esmith::cgi::genWidgetRow(
27     $q,
28     @@ -2483,7 +2487,14 @@
29     $error_message .= bunmount($mntdir,$VFSType);
30     die ($error_message);
31     }
32     - system ("/usr/bin/dar", "-Q", "-x", "$file", "-v", "-N", "-R", "/", "-wa");
33     + # because CentOS 7/SME 10 has now links in place of folder for bin lib lib64 and sbin, we need to exclude them to avoid to trash the server
34     + # if restoring from a previous SME version. An alternative or complement to exclud directories would be to add this rule : '-/{!T&~D}[Pp];Oo' : do not replace symlink by dir, otherwise replace.
35     + system ("/usr/bin/dar", "-Q", "-x", "$file", "-v", "-N", "-R", "/", "-wa", '-P', 'bin', '-P', 'lib', '-P', 'lib64', '-P', 'sbin', '-P', 'var/run', '-P', 'var/lock');
36     + # However if one has added element to backup to this location; we need to resore them to their new location
37     + # TODO condition to execute or not the following ....
38     + # something like dar -l full-20210309124352 -g bin -g lib -g lib64 -g sbin -/'{T}[Pp]'|grep -E '(sbin|bin|lib)'|wc -l ; if result > to 4
39     + # or with a loop accross the 4 locations
40     + system ("/usr/bin/dar", "-Q", "-x", "$file", "-v", "-N", "-R", "/usr/", "-wa", '-g', 'bin', '-g', 'lib', '-g', 'lib64', '-g', 'sbin', '-D');
41     }
42    
43     $error_message = bunmount($mntdir,$VFSType);
44     @@ -2717,6 +2728,7 @@
45     {
46     chomp;
47     $_ =~ s/$regex//;
48     + next if m/^(sbin|bin|lib|lib64|var\/run|var\/lock)$/;
49     if ($filterexp) {next unless m/$rgfilter/};
50     push @flabels, $_;
51     }
52     @@ -2747,6 +2759,11 @@
53    
54     print $q->table ({border => 0, cellspacing => 0, cellpadding => 4},
55    
56     + esmith::cgi::genTextRow(
57     + $q,
58     + $q->b($fm->localise('DO_NOT_RESTORE_BIN_SBIN_LIB_LIB64_FROM_SME9')),
59     + ),
60     +
61     esmith::cgi::genWidgetRow(
62     $q,
63     $q->b($fm->localise('SELECT_FILES_TO_RESTORE')),
64     @@ -2908,14 +2925,14 @@
65     {
66     select(STDOUT);
67     $| = 1;
68     -
69     + # we could add this filter here -/{!T&~D}[Pp];Oo to prevent symlinks to be transformed as folder, but it would lead to $?=4 or 5 or 1024.... thus marking as failed
70     if ($when)
71     {
72     - $restorerr = system ("/usr/bin/dar_manager -B \"$mntbkdir/dar-catalog\" -Q -w $when -e '-v -N -R / -w' -r @restorelist");
73     + $restorerr = system ("/usr/bin/dar_manager -B \"$mntbkdir/dar-catalog\" -Q -w $when -e '-v -N -R / -w -P sbin -P bin -P lib64 -P lib -P var/run -P var/lock' -r @restorelist");
74     }
75     else
76     {
77     - $restorerr = system ("/usr/bin/dar_manager -B \"$mntbkdir/dar-catalog\" -Q -k -e '-v -N -R / -w' -r @restorelist");
78     + $restorerr = system ("/usr/bin/dar_manager -B \"$mntbkdir/dar-catalog\" -Q -k -e '-v -N -R / -w -P sbin -P bin -P lib64 -P lib -P var/run -P var/lock' -r @restorelist");
79     }
80    
81     $error_message = bunmount($mntdir,$VFSType);

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