summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2020-01-20 09:56:03 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2020-01-20 09:56:03 (GMT)
commit2dbd1f123e2c9dd5d81513ef0b2d6443bf5edde3 (patch) (side-by-side diff)
treed5f56ec364216c50fb0fb1473e488b1576187556
parentc4bcbcbfd6cce382249f16b1f536484d98842e3d (diff)
downloadacmeman-2dbd1f123e2c9dd5d81513ef0b2d6443bf5edde3.tar.gz
acmeman-2dbd1f123e2c9dd5d81513ef0b2d6443bf5edde3.tar.bz2
Create backup copies of Apache configuration files during setup on Slackware.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--lib/App/Acmeman/Apache/Layout/slackware.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/App/Acmeman/Apache/Layout/slackware.pm b/lib/App/Acmeman/Apache/Layout/slackware.pm
index d09017a..fd9ea31 100644
--- a/lib/App/Acmeman/Apache/Layout/slackware.pm
+++ b/lib/App/Acmeman/Apache/Layout/slackware.pm
@@ -5,6 +5,7 @@ use Carp;
use parent 'App::Acmeman::Apache::Layout';
use Apache::Config::Preproc;
use App::Acmeman::Log qw(:all);
+use File::BackupCopy;
our $PRIORITY = 10;
@@ -175,7 +176,14 @@ sub run_commands_for_file {
error((0+@commands) . " left unmatched in edit queue for file $file");
error("$file left unchanged");
} else {
- # FIXME: backup/rollback
+ my $backup_name = backup_copy($app->filename, error => \my $error);
+ if ($backup_name) {
+ debug(1, "modifying ".$app->filename."; prior version saved in $backup_name");
+ } elsif ($error) {
+ error("can't backup ".$app->filename.": $error");
+ error("file left unchanged");
+ return;
+ }
$app->save;
}
}

Return to:

Send suggestions and report system problems to the System administrator.