From 29662246b32dd27b2540ae766684f2c634e8d044 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 24 Aug 2009 12:15:06 -0700 Subject: 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. --- Makefile.am | 1 + scripts/vyatta-exists | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100755 scripts/vyatta-exists 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 -- cgit v1.2.3