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 --- 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 +++ 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 @@ -932,4 +932,9 @@ ERROR_WHEN_TESTING_REMOTE_SERVER The parameters have been saved, however the remote host is not reachable, please check your settings. + + DO_NOT_RESTORE_BIN_SBIN_LIB_LIB64_FROM_SME9 + 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. + + 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 --- e-smith-backup-2.6.0.old/root/etc/e-smith/web/functions/backup 2021-03-11 11:49:18.784000000 -0500 +++ e-smith-backup-2.6.0/root/etc/e-smith/web/functions/backup 2021-03-12 01:14:24.744000000 -0500 @@ -2211,6 +2211,10 @@ ); print $q->table ( {border => 0, cellspacing => 0, cellpadding => 4}, + esmith::cgi::genTextRow( + $q, + $q->b($fm->localise('DO_NOT_RESTORE_BIN_SBIN_LIB_LIB64_FROM_SME9')), + ), esmith::cgi::genWidgetRow( $q, @@ -2483,7 +2487,14 @@ $error_message .= bunmount($mntdir,$VFSType); die ($error_message); } - system ("/usr/bin/dar", "-Q", "-x", "$file", "-v", "-N", "-R", "/", "-wa"); + # 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 + # 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. + 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'); + # However if one has added element to backup to this location; we need to resore them to their new location + # TODO condition to execute or not the following .... + # 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 + # or with a loop accross the 4 locations + system ("/usr/bin/dar", "-Q", "-x", "$file", "-v", "-N", "-R", "/usr/", "-wa", '-g', 'bin', '-g', 'lib', '-g', 'lib64', '-g', 'sbin', '-D'); } $error_message = bunmount($mntdir,$VFSType); @@ -2717,6 +2728,7 @@ { chomp; $_ =~ s/$regex//; + next if m/^(sbin|bin|lib|lib64|var\/run|var\/lock)$/; if ($filterexp) {next unless m/$rgfilter/}; push @flabels, $_; } @@ -2747,6 +2759,11 @@ print $q->table ({border => 0, cellspacing => 0, cellpadding => 4}, + esmith::cgi::genTextRow( + $q, + $q->b($fm->localise('DO_NOT_RESTORE_BIN_SBIN_LIB_LIB64_FROM_SME9')), + ), + esmith::cgi::genWidgetRow( $q, $q->b($fm->localise('SELECT_FILES_TO_RESTORE')), @@ -2908,14 +2925,14 @@ { select(STDOUT); $| = 1; - + # 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 if ($when) { - $restorerr = system ("/usr/bin/dar_manager -B \"$mntbkdir/dar-catalog\" -Q -w $when -e '-v -N -R / -w' -r @restorelist"); + $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"); } else { - $restorerr = system ("/usr/bin/dar_manager -B \"$mntbkdir/dar-catalog\" -Q -k -e '-v -N -R / -w' -r @restorelist"); + $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"); } $error_message = bunmount($mntdir,$VFSType);