diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-commit-revs.pl | 13 | ||||
-rwxr-xr-x | scripts/vyatta-config-mgmt.pl | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/scripts/vyatta-commit-revs.pl b/scripts/vyatta-commit-revs.pl index 7ae34ad..edf0845 100755 --- a/scripts/vyatta-commit-revs.pl +++ b/scripts/vyatta-commit-revs.pl @@ -34,21 +34,26 @@ use lib '/opt/vyatta/share/perl5/'; use Vyatta::Config; use Vyatta::ConfigMgmt; +use File::Compare; # # main # -my $archive_dir = cm_get_archive_dir(); -my $lr_state_file = cm_get_lr_state_file(); -my $lr_conf_file = cm_get_lr_conf_file(); +my $archive_dir = cm_get_archive_dir(); +my $lr_state_file = cm_get_lr_state_file(); +my $lr_conf_file = cm_get_lr_conf_file(); +my $last_commit_file = cm_get_last_commit_file(); +my $tmp_config_file = "/tmp/config.boot.$$"; if (! -d $archive_dir) { system("sudo mkdir $archive_dir"); } -my $tmp_config_file = "/tmp/config.boot.$$"; system("/opt/vyatta/sbin/vyatta-save-config.pl $tmp_config_file > /dev/null"); +if (compare($tmp_config_file, $last_commit_file) == 0) { + exit 0; +} system("sudo mv $tmp_config_file $archive_dir/config.boot"); system("sudo logrotate -f -s $lr_state_file $lr_conf_file"); my ($user) = getpwuid($<); diff --git a/scripts/vyatta-config-mgmt.pl b/scripts/vyatta-config-mgmt.pl index 46d57e9..94b9b57 100755 --- a/scripts/vyatta-config-mgmt.pl +++ b/scripts/vyatta-config-mgmt.pl @@ -142,11 +142,13 @@ if ($action eq 'update-revs') { } if (! -e $archive_dir) { system("sudo mkdir $archive_dir"); + system("sudo chown vyatta:vyattacfg $archive_dir"); } my $lr_conf = "$config_file {\n"; $lr_conf .= "\t rotate $revs\n"; $lr_conf .= "\t start 0\n"; $lr_conf .= "\t compress \n"; + $lr_conf .= "\t copy \n"; $lr_conf .= "}\n"; cm_write_file($lr_conf_file, $lr_conf); exit 0; |