diff options
author | Mohit Mehta <mohit@vyatta.com> | 2011-04-13 17:58:50 -0700 |
---|---|---|
committer | Mohit Mehta <mohit@vyatta.com> | 2011-04-13 17:58:50 -0700 |
commit | 90954826826a0c60c74d9fd8a6fa68994c13a519 (patch) | |
tree | 9d02c8bb7d69facd5a5955dc145dfeebe1168b5a | |
parent | 24e78a686c36820e7e40d862deca9772d78ebafb (diff) | |
download | vyatta-cfg-system-90954826826a0c60c74d9fd8a6fa68994c13a519.tar.gz vyatta-cfg-system-90954826826a0c60c74d9fd8a6fa68994c13a519.zip |
* Add help and checks for VRRP transition-script nodes
to push users towards putting scripts in /config/scripts
15 files changed, 61 insertions, 12 deletions
diff --git a/Makefile.am b/Makefile.am index 914611fb..74784522 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,6 +17,8 @@ netplugdown_SCRIPTS = scripts/netplug/linkdown/dhclient bin_SCRIPTS += scripts/progress-indicator bin_SCRIPTS += scripts/vyatta-functions + +sbin_SCRIPTS += scripts/check_file_in_config_dir sbin_SCRIPTS += scripts/init-floppy sbin_SCRIPTS += scripts/rl-system.init sbin_SCRIPTS += scripts/install-system diff --git a/debian/vyatta-cfg-system.postinst.in b/debian/vyatta-cfg-system.postinst.in index 1b9752d3..7daa3134 100644 --- a/debian/vyatta-cfg-system.postinst.in +++ b/debian/vyatta-cfg-system.postinst.in @@ -167,6 +167,9 @@ fi # create needed directories mkdir -p /var/log/user mkdir -p /var/core +mkdir -p /opt/vyatta/etc/config/auth +mkdir -p /opt/vyatta/etc/config/scripts +mkdir -p /opt/vyatta/etc/config/user-data touch /etc/environment diff --git a/scripts/check_file_in_config_dir b/scripts/check_file_in_config_dir new file mode 100644 index 00000000..bceb2858 --- /dev/null +++ b/scripts/check_file_in_config_dir @@ -0,0 +1,32 @@ +#!/bin/bash +# **** License **** +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# This code was originally developed by Vyatta, Inc. +# Portions created by Vyatta are Copyright (C) 2011 Vyatta, Inc. +# All Rights Reserved. +# +# Author: Mohit Mehta <mohit@vyatta.com> +# Description: Check if the given file is under /config. Used for files that +# are referenced from the CLI and need to be preserved during +# image upgrade. Warn the user if these aren't under /config +# +# **** End License **** + +FILE=$1 +CONFIG_DIR=$2 + +if [[ ( $FILE =~ ^\/config\/.*$ ) || \ + ( $FILE =~ ^\/opt\/vyatta\/etc\/config\/.*$ ) ]]; then + exit 0 +else + echo Warning: \'$FILE\' lies outside of $CONFIG_DIR directory. \ + It will not get preserved during image upgrade. +fi diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def index 88fbb670..12006ee6 100644 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def @@ -1,4 +1,5 @@ help: Script to run on VRRP state-transition to backup type: txt syntax:expression: exec "[ -x $VAR(@) ] || exit 1"; "Backup Script should be an existing executable" - +syntax:expression: exec "/opt/vyatta/sbin/check_file_in_config_dir $VAR(@) '/config/scripts'" +val_help: Script in /config/scripts diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def index 2d2c08d0..f2065249 100644 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def @@ -1,4 +1,5 @@ help: Script to run on VRRP state-transition to fault type: txt syntax:expression: exec "[ -x $VAR(@) ] || exit 1"; "Fault Script should be an existing executable" - +syntax:expression: exec "/opt/vyatta/sbin/check_file_in_config_dir $VAR(@) '/config/scripts'" +val_help: Script in /config/scripts diff --git a/templates/interfaces/bonding/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def b/templates/interfaces/bonding/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def index e3eb0175..d87909b7 100644 --- a/templates/interfaces/bonding/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def +++ b/templates/interfaces/bonding/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def @@ -1,4 +1,5 @@ help: Script to run on VRRP state-transition to master type: txt syntax:expression: exec "[ -x $VAR(@) ] || exit 1"; "Master Script should be an existing executable" - +syntax:expression: exec "/opt/vyatta/sbin/check_file_in_config_dir $VAR(@) '/config/scripts'" +val_help: Script in /config/scripts diff --git a/templates/interfaces/bonding/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def b/templates/interfaces/bonding/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def index 88fbb670..12006ee6 100644 --- a/templates/interfaces/bonding/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def +++ b/templates/interfaces/bonding/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def @@ -1,4 +1,5 @@ help: Script to run on VRRP state-transition to backup type: txt syntax:expression: exec "[ -x $VAR(@) ] || exit 1"; "Backup Script should be an existing executable" - +syntax:expression: exec "/opt/vyatta/sbin/check_file_in_config_dir $VAR(@) '/config/scripts'" +val_help: Script in /config/scripts diff --git a/templates/interfaces/bonding/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def b/templates/interfaces/bonding/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def index 2d2c08d0..f2065249 100644 --- a/templates/interfaces/bonding/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def +++ b/templates/interfaces/bonding/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def @@ -1,4 +1,5 @@ help: Script to run on VRRP state-transition to fault type: txt syntax:expression: exec "[ -x $VAR(@) ] || exit 1"; "Fault Script should be an existing executable" - +syntax:expression: exec "/opt/vyatta/sbin/check_file_in_config_dir $VAR(@) '/config/scripts'" +val_help: Script in /config/scripts diff --git a/templates/interfaces/bonding/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def b/templates/interfaces/bonding/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def index e3eb0175..d87909b7 100644 --- a/templates/interfaces/bonding/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def +++ b/templates/interfaces/bonding/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def @@ -1,4 +1,5 @@ help: Script to run on VRRP state-transition to master type: txt syntax:expression: exec "[ -x $VAR(@) ] || exit 1"; "Master Script should be an existing executable" - +syntax:expression: exec "/opt/vyatta/sbin/check_file_in_config_dir $VAR(@) '/config/scripts'" +val_help: Script in /config/scripts diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def index 88fbb670..12006ee6 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def @@ -1,4 +1,5 @@ help: Script to run on VRRP state-transition to backup type: txt syntax:expression: exec "[ -x $VAR(@) ] || exit 1"; "Backup Script should be an existing executable" - +syntax:expression: exec "/opt/vyatta/sbin/check_file_in_config_dir $VAR(@) '/config/scripts'" +val_help: Script in /config/scripts diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def index 2d2c08d0..f2065249 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def @@ -1,4 +1,5 @@ help: Script to run on VRRP state-transition to fault type: txt syntax:expression: exec "[ -x $VAR(@) ] || exit 1"; "Fault Script should be an existing executable" - +syntax:expression: exec "/opt/vyatta/sbin/check_file_in_config_dir $VAR(@) '/config/scripts'" +val_help: Script in /config/scripts diff --git a/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def index e3eb0175..d87909b7 100644 --- a/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def +++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def @@ -1,4 +1,5 @@ help: Script to run on VRRP state-transition to master type: txt syntax:expression: exec "[ -x $VAR(@) ] || exit 1"; "Master Script should be an existing executable" - +syntax:expression: exec "/opt/vyatta/sbin/check_file_in_config_dir $VAR(@) '/config/scripts'" +val_help: Script in /config/scripts diff --git a/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def index 88fbb670..12006ee6 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/backup/node.def @@ -1,4 +1,5 @@ help: Script to run on VRRP state-transition to backup type: txt syntax:expression: exec "[ -x $VAR(@) ] || exit 1"; "Backup Script should be an existing executable" - +syntax:expression: exec "/opt/vyatta/sbin/check_file_in_config_dir $VAR(@) '/config/scripts'" +val_help: Script in /config/scripts diff --git a/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def index 2d2c08d0..f2065249 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/fault/node.def @@ -1,4 +1,5 @@ help: Script to run on VRRP state-transition to fault type: txt syntax:expression: exec "[ -x $VAR(@) ] || exit 1"; "Fault Script should be an existing executable" - +syntax:expression: exec "/opt/vyatta/sbin/check_file_in_config_dir $VAR(@) '/config/scripts'" +val_help: Script in /config/scripts diff --git a/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def index e3eb0175..d87909b7 100644 --- a/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def +++ b/templates/interfaces/ethernet/node.tag/vrrp/vrrp-group/node.tag/run-transition-scripts/master/node.def @@ -1,4 +1,5 @@ help: Script to run on VRRP state-transition to master type: txt syntax:expression: exec "[ -x $VAR(@) ] || exit 1"; "Master Script should be an existing executable" - +syntax:expression: exec "/opt/vyatta/sbin/check_file_in_config_dir $VAR(@) '/config/scripts'" +val_help: Script in /config/scripts |