diff options
-rw-r--r-- | scripts/vyatta-activate-config.pl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/vyatta-activate-config.pl b/scripts/vyatta-activate-config.pl index f1269e1..acbdcf5 100644 --- a/scripts/vyatta-activate-config.pl +++ b/scripts/vyatta-activate-config.pl @@ -115,6 +115,22 @@ if ($action eq 'deactivate') { } ####################################################### +#prevent deactivate or activate to be applied with +#uncommitted changes +####################################################### +if (-e "$ENV{VYATTA_CHANGES_ONLY_DIR}/$path") { + opendir DIR, "$ENV{VYATTA_CHANGES_ONLY_DIR}/$path"; + my @files = readdir DIR; + foreach my $d (@files) { + if ($d ne '.' && $d ne '..') { + print("Cannot $action modified elements, please commit your changes and then deactivate.\n"); + closedir DIR; + exit 1; + } + } + closedir DIR; +} +####################################################### #now apply the magic ####################################################### if ($action eq 'activate') { |