diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-08-24 12:15:06 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-08-24 12:15:06 -0700 |
commit | 29662246b32dd27b2540ae766684f2c634e8d044 (patch) | |
tree | aa8fdbf702d7363ba4eb1804d65f5696f62c3647 | |
parent | b21ed5d3b9df3b347c2efd8341fb042469a3aaee (diff) | |
download | vyatta-cfg-29662246b32dd27b2540ae766684f2c634e8d044.tar.gz vyatta-cfg-29662246b32dd27b2540ae766684f2c634e8d044.zip |
Add a small script to test for node existance
This does the same thing as vyatta-quagga-utils.pl --exists, but
it is generally useful (outside quagga) and has less overhead than
a perl compile.
-rw-r--r-- | Makefile.am | 1 | ||||
-rwxr-xr-x | scripts/vyatta-exists | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index f7096af..217de7e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,6 +56,7 @@ sbin_SCRIPTS += scripts/vyatta-cfg-notify sbin_SCRIPTS += scripts/vyatta-interfaces.pl sbin_SCRIPTS += scripts/vyatta-irqaffin sbin_SCRIPTS += scripts/vyatta-check-typeless-node.pl +sbin_SCRIPTS += scripts/vyatta-exists share_perl5_DATA = lib/Vyatta/Config.pm share_perl5_DATA += lib/Vyatta/Misc.pm diff --git a/scripts/vyatta-exists b/scripts/vyatta-exists new file mode 100755 index 0000000..ef2dea3 --- /dev/null +++ b/scripts/vyatta-exists @@ -0,0 +1,14 @@ +#! /bin/bash + +# Test if given node exists in Vyatta config hierarchy +# +# if vyatta-exists interfaces wireless + +if [ -z "$VYATTA_TEMP_CONFIG_DIR" ]; then + echo "$0: not in configuration mode" 1>&2; + exit 1; +fi +IFS=/ +node=$* +IFS= +exec test -d $VYATTA_TEMP_CONFIG_DIR/$node |