diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/VyattaConfig.pm | 2 | ||||
-rw-r--r-- | scripts/VyattaConfigDOMTree.pm | 2 | ||||
-rwxr-xr-x | scripts/vyatta-cfg-notify | 4 | ||||
-rw-r--r-- | scripts/vyatta-interfaces.pl | 4 | ||||
-rwxr-xr-x | scripts/vyatta-load-config.pl | 6 | ||||
-rwxr-xr-x | scripts/vyatta-save-config.pl | 9 | ||||
-rwxr-xr-x | scripts/xorp_tmpl_tool | 14 |
7 files changed, 24 insertions, 17 deletions
diff --git a/scripts/VyattaConfig.pm b/scripts/VyattaConfig.pm index a783957..9b1b933 100644 --- a/scripts/VyattaConfig.pm +++ b/scripts/VyattaConfig.pm @@ -284,7 +284,7 @@ sub listDeleted { if (! -d "$filepath") { return undef; } else { opendir DIR, "$filepath" or return undef; - @nodes = grep /^\.wh./, readdir DIR; + @nodes = grep !/^\.wh\.\.wh\./, grep /^\.wh./, readdir DIR; closedir DIR; } diff --git a/scripts/VyattaConfigDOMTree.pm b/scripts/VyattaConfigDOMTree.pm index d951202..86aabf8 100644 --- a/scripts/VyattaConfigDOMTree.pm +++ b/scripts/VyattaConfigDOMTree.pm @@ -307,7 +307,7 @@ sub getSubNodesNumber { my @subs = $node->getSubNodes(); - if(defined @subs) { + if(@subs) { $ret = $#subs + 1; } } diff --git a/scripts/vyatta-cfg-notify b/scripts/vyatta-cfg-notify index 82dc6a3..07a385d 100755 --- a/scripts/vyatta-cfg-notify +++ b/scripts/vyatta-cfg-notify @@ -1,11 +1,13 @@ #!/bin/bash +[ -r /etc/default/vyatta ] && source /etc/default/vyatta + declare cur_tty=$(ps -o tty= |head -n1) declare cur_uid=($(ps -o ruser= n |head -n1)) declare cur_user=$(grep "[^:]\+:[^:]*:${cur_uid[0]}:" /etc/passwd \ | cut -d ':' -f 1) declare -a ulist=( $(ps -a -o args,tty,ruser n \ - | grep '^newgrp quaggavty' | cut -c 29-) ) + | grep "^newgrp $VYATTA_CFG_GROUP_NAME" | cut -c 29-) ) for (( i = 0; i < ${#ulist[@]}; i += 2 )); do utty=${ulist[i]} diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index d7ba950..36d811f 100644 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -287,6 +287,10 @@ sub is_valid_addr { my ($addr_net, $intf) = @_; if ($addr_net eq "dhcp") { + if ($intf eq "lo") { + print "Error: can't use dhcp client on loopback interface\n"; + exit 1; + } if (is_dhcp_enabled($intf)) { print "Error: dhcp already configured for $intf\n"; exit 1; diff --git a/scripts/vyatta-load-config.pl b/scripts/vyatta-load-config.pl index a6f037a..d011a65 100755 --- a/scripts/vyatta-load-config.pl +++ b/scripts/vyatta-load-config.pl @@ -8,11 +8,7 @@ use VyattaConfigLoad; my $etcdir = $ENV{vyatta_sysconfdir}; my $sbindir = $ENV{vyatta_sbindir}; -my $bootpath = ''; -if (-r "$etcdir/bootfile_path") { - $bootpath = `cat $etcdir/bootfile_path`; -} -$bootpath =~ s/\/[^\/]+$//; +my $bootpath = $etcdir . "/config"; if ($#ARGV != 0) { print "Usage: load <config_file_name>\n"; diff --git a/scripts/vyatta-save-config.pl b/scripts/vyatta-save-config.pl index 26b8eec..bad7c45 100755 --- a/scripts/vyatta-save-config.pl +++ b/scripts/vyatta-save-config.pl @@ -5,19 +5,14 @@ use lib "/opt/vyatta/share/perl5/"; use VyattaConfigOutput; my $etcdir = "/opt/vyatta/etc"; -my $bootfile = ''; -if (-r "$etcdir/bootfile_path") { - $bootfile = `cat $etcdir/bootfile_path`; -} -my $bootpath = $bootfile; -$bootpath =~ s/\/[^\/]+$//; +my $bootpath = $etcdir . "/config"; +my $save_file = $bootpath . "/config.boot"; if ($#ARGV > 0) { print "Usage: save [config_file_name]\n"; exit 1; } -my $save_file = "$bootfile"; if (defined($ARGV[0])) { $save_file = $ARGV[0]; if (!($save_file =~ /^\//)) { diff --git a/scripts/xorp_tmpl_tool b/scripts/xorp_tmpl_tool index 54c87bb..014a53b 100755 --- a/scripts/xorp_tmpl_tool +++ b/scripts/xorp_tmpl_tool @@ -1,5 +1,11 @@ #!/bin/bash +if grep -q union=aufs /proc/cmdline || grep -q aufs /proc/filesystems ; then + export UNIONFS=aufs +else + export UNIONFS=unionfs +fi + UMASK_SAVE_G=`umask` umask 0111 XORPLOGFILE=/tmp/xorp_tmpl_tool.log @@ -36,7 +42,7 @@ export VYATTA_TEMP_CONFIG_DIR=/opt/vyatta/config/tmp/new_config_$VTID; if [ ! -d $VYATTA_TEMP_CONFIG_DIR ] then mkdir -p $VYATTA_TEMP_CONFIG_DIR - sudo mount -t unionfs -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:/opt/vyatta/config/active=ro unionfs ${VYATTA_TEMP_CONFIG_DIR} + sudo mount -t $UNIONFS -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:/opt/vyatta/config/active=ro $UNIONFS ${VYATTA_TEMP_CONFIG_DIR} fi ## cli ENV_TMP_DIR @@ -110,7 +116,7 @@ case "$1" in sudo umount ${VYATTA_TEMP_CONFIG_DIR} sudo rm -rf $VYATTA_CHANGES_ONLY_DIR/* $VYATTA_CHANGES_ONLY_DIR/.modified - sudo mount -t unionfs -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:/opt/vyatta/config/active=ro unionfs ${VYATTA_TEMP_CONFIG_DIR} + sudo mount -t $UNIONFS -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:/opt/vyatta/config/active=ro $UNIONFS ${VYATTA_TEMP_CONFIG_DIR} RET_STATUS=0 ;; end_loading) @@ -150,3 +156,7 @@ echo "ret=${RET_STATUS}" >> ${XORPLOGFILE} umask ${UMASK_SAVE_G} exit $RET_STATUS +# Local Variables: +# mode: shell-script +# sh-indentation: 4 +# End: |