summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbalocca <rbalocca@fugazi.vyatta.com>2007-12-19 15:19:37 -0800
committerrbalocca <rbalocca@fugazi.vyatta.com>2007-12-19 15:19:37 -0800
commita27a8f7b5501ef9fa1c8e3be0fed4430d0515271 (patch)
tree1ae0af03eaa4214fdcc69a57e20c2598f44e6519
parenteefd3f1d5836f383f4d627f02c794d870f23bb94 (diff)
parent793d580050edada4b4468b0d8044615ff5fc15aa (diff)
downloadvyatta-cfg-system-a27a8f7b5501ef9fa1c8e3be0fed4430d0515271.tar.gz
vyatta-cfg-system-a27a8f7b5501ef9fa1c8e3be0fed4430d0515271.zip
Merge branch 'master' into glendale
-rw-r--r--Makefile.am12
-rw-r--r--debian/vyatta-cfg-system.postinst.in2
-rwxr-xr-xetc/init.d/vyatta-udev58
-rwxr-xr-xscripts/keepalived/VyattaKeepalived.pm9
-rwxr-xr-xscripts/keepalived/vyatta-show-vrrp.pl10
-rwxr-xr-xscripts/system/vyatta_update_resolv.pl95
-rw-r--r--templates/system/domain-search/domain/node.def7
7 files changed, 116 insertions, 77 deletions
diff --git a/Makefile.am b/Makefile.am
index 2d109577..39d65e30 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,7 @@
-cfgdir = $(datadir)/vyatta-cfg/templates
-share_perl5dir = $(datarootdir)/perl5
-libudevdir = /lib/udev
-etcudevdir = /etc/udev
-initddir = /etc/init.d
+cfgdir = $(datadir)/vyatta-cfg/templates
+share_perl5dir = $(datarootdir)/perl5
+libudevdir = /lib/udev
+etcudevdir = /etc/udev
bin_SCRIPTS =
sbin_SCRIPTS =
@@ -17,6 +16,7 @@ sbin_SCRIPTS += scripts/quick-install
sbin_SCRIPTS += scripts/standalone_root_pw_reset
sbin_SCRIPTS += scripts/system/vyatta_update_login_user.pl
sbin_SCRIPTS += scripts/system/vyatta_update_logrotate.pl
+sbin_SCRIPTS += scripts/system/vyatta_update_resolv.pl
sbin_SCRIPTS += scripts/system/vyatta_update_syslog.pl
sbin_SCRIPTS += scripts/snmp/vyatta-snmp.pl
sbin_SCRIPTS += scripts/snmp/snmpd.init
@@ -40,8 +40,6 @@ sysconf_DATA += sysconf/config.boot.default
libudev_SCRIPTS = scripts/vyatta_net_name
etcudev_DATA = sysconf/vyatta-net.rules
-initd_SCRIPTS = etc/init.d/vyatta-udev
-
cpiop = find . ! -regex '\(.*~\|.*\.bak\|.*\.swp\|.*\#.*\#\)' -print0 | \
cpio -0pd
diff --git a/debian/vyatta-cfg-system.postinst.in b/debian/vyatta-cfg-system.postinst.in
index 9911cda5..46c7e79d 100644
--- a/debian/vyatta-cfg-system.postinst.in
+++ b/debian/vyatta-cfg-system.postinst.in
@@ -22,8 +22,6 @@ esac
ln -sf ../vyatta-net.rules /etc/udev/rules.d/$vyatta_net_rules
-update-rc.d vyatta-udev start 21 S .
-
if [ "$sysconfdir" != "/etc" ]; then
# for "admin" level (FIXME)
sed -i 's/^# %sudo ALL=NOPASSWD: ALL/%sudo ALL=NOPASSWD: ALL/' /etc/sudoers
diff --git a/etc/init.d/vyatta-udev b/etc/init.d/vyatta-udev
deleted file mode 100755
index 5c2c1d37..00000000
--- a/etc/init.d/vyatta-udev
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/bash
-### BEGIN INIT INFO
-# Provides: vyatta-udev
-# Required-Start: udev module-init-tools
-# Required-Stop:
-# Default-Start: S
-# Default-Stop:
-# Short-Description: Trigger udev net subsystem to process interface renaming
-### END INIT INFO
-# **** License ****
-# Version: VPL 1.0
-#
-# The contents of this file are subject to the Vyatta Public License
-# Version 1.0 ("License"); you may not use this file except in
-# compliance with the License. You may obtain a copy of the License at
-# http://www.vyatta.com/vpl
-#
-# Software distributed under the License is distributed on an "AS IS"
-# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-# the License for the specific language governing rights and limitations
-# under the License.
-#
-# This code was originally developed by Vyatta, Inc.
-# Portions created by Vyatta are Copyright (C) 2007 Vyatta, Inc.
-# All Rights Reserved.
-#
-# Author: Tom Grennan <tgrennan@vyatta.com>
-# **** End License ****
-
-. /lib/lsb/init-functions
-
-: ${vyatta_env:=/etc/default/vyatta}
-source $vyatta_env
-
-declare progname=${0##*/}
-declare action=$1; shift
-
-start ()
-{
- log_action_begin_msg "Trigger rename of network interfaces"
- udevtrigger --subsystem-match=net
- udevsettle
- log_action_end_msg $?
-}
-
-case "$action" in
- start) start ;;
- stop|restart|force-reload) true ;;
- *) log_failure_msg "usage: $progname [ start|stop|restart ]" ;
- false ;;
-esac
-
-exit $?
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 4
-# End:
diff --git a/scripts/keepalived/VyattaKeepalived.pm b/scripts/keepalived/VyattaKeepalived.pm
index e0e84af3..13512b42 100755
--- a/scripts/keepalived/VyattaKeepalived.pm
+++ b/scripts/keepalived/VyattaKeepalived.pm
@@ -115,11 +115,16 @@ sub get_master_file {
}
sub get_state_files {
- my $intf = shift;
+ my ($intf, $group) = @_;
# todo: fix sorting for ethX > 9
my @state_files;
- open(my $LS, "ls $state_dir |grep '^vrrpd_$intf.*\.state\$' | sort |");
+ my $LS;
+ if ($group eq "all") {
+ open($LS,"ls $state_dir |grep '^vrrpd_$intf.*\.state\$' | sort |");
+ } else {
+ open($LS,"ls $state_dir |grep '^vrrpd_$intf.\_$group\.state\$' | sort |");
+ }
@state_files = <$LS>;
close($LS);
foreach my $i (0 .. $#state_files) {
diff --git a/scripts/keepalived/vyatta-show-vrrp.pl b/scripts/keepalived/vyatta-show-vrrp.pl
index 934808f6..9228eeeb 100755
--- a/scripts/keepalived/vyatta-show-vrrp.pl
+++ b/scripts/keepalived/vyatta-show-vrrp.pl
@@ -147,17 +147,21 @@ sub vrrp_show {
#
# main
#
-my $intf = "eth";
-if ($#ARGV > -1) {
+my $intf = "eth";
+my $group = "all";
+if ($#ARGV == 0) {
$intf = $ARGV[0];
}
+if ($#ARGV == 1) {
+ $group = $ARGV[1];
+}
if (!VyattaKeepalived::is_running()) {
print "VRRP isn't running\n";
exit 1;
}
-my @state_files = VyattaKeepalived::get_state_files($intf);
+my @state_files = VyattaKeepalived::get_state_files($intf, $group);
foreach my $state_file (@state_files) {
vrrp_show($state_file);
}
diff --git a/scripts/system/vyatta_update_resolv.pl b/scripts/system/vyatta_update_resolv.pl
new file mode 100755
index 00000000..0255b256
--- /dev/null
+++ b/scripts/system/vyatta_update_resolv.pl
@@ -0,0 +1,95 @@
+#!/usr/bin/perl -w
+#
+# Module: vyatta_update_resolv.pl
+#
+# **** License ****
+# Version: VPL 1.0
+#
+# The contents of this file are subject to the Vyatta Public License
+# Version 1.0 ("License"); you may not use this file except in
+# compliance with the License. You may obtain a copy of the License at
+# http://www.vyatta.com/vpl
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+# the License for the specific language governing rights and limitations
+# under the License.
+#
+# This code was originally developed by Vyatta, Inc.
+# Portions created by Vyatta are Copyright (C) 2007 Vyatta, Inc.
+# All Rights Reserved.
+#
+# Author: Marat Nepomnyashy
+# Date: December 2007
+# Description: Script to update '/etc/resolv.conf' on commit of 'system domain-search domain' config.
+#
+# **** End License ****
+#
+
+use strict;
+use lib "/opt/vyatta/share/perl5/";
+
+
+use Getopt::Long;
+my $change_dir = '';
+my $modify_dir = '';
+GetOptions("change_dir=s" => \$change_dir, "modify_dir=s" => \$modify_dir);
+
+
+use VyattaConfig;
+my $vc = new VyattaConfig();
+
+if ($change_dir ne '') {
+ $vc->{_changes_only_dir_base} = $change_dir;
+}
+if ($modify_dir ne '') {
+ $vc->{_new_config_dir_base} = $modify_dir;
+}
+
+
+my $doms = '';
+$vc->setLevel('system domain-search domain');
+my @domains = $vc->returnValues('.');
+foreach my $domain (@domains) {
+ if (length($doms) > 0) {
+ $doms .= ' ';
+ }
+ $doms .= $domain;
+}
+
+my $search = '';
+if (length($doms) > 0) {
+ $search = "search\t\t$doms\t\t#line generated by $0\n";
+}
+
+
+# The following will re-write '/etc/resolv.conf' line by line,
+# replacing the 'search' specifier with the latest values.
+
+my @resolv;
+if (-e '/etc/resolv.conf') {
+ open (RESOLV, '</etc/resolv.conf') or die("$0: Error! Unable to open '/etc/resolv.conf' for input: $!\n");
+ @resolv = <RESOLV>;
+ close (RESOLV);
+}
+
+
+my $foundSearch = 0;
+
+open (RESOLV, '>/etc/resolv.conf') or die("$0: Error! Unable to open '/etc/resolv.conf' for output: $!\n");
+foreach my $line (@resolv) {
+ if ($line =~ /^search\s/) {
+ $foundSearch = 1;
+ if (length($search) > 0) {
+ print RESOLV $search;
+ }
+ } else {
+ print RESOLV $line;
+ }
+}
+if ($foundSearch == 0 && length($search) > 0) {
+ print RESOLV $search;
+}
+
+close (RESOLV);
+
diff --git a/templates/system/domain-search/domain/node.def b/templates/system/domain-search/domain/node.def
index bc259182..e29df293 100644
--- a/templates/system/domain-search/domain/node.def
+++ b/templates/system/domain-search/domain/node.def
@@ -2,8 +2,5 @@ multi:
type: txt
help: "Configure DNS domain completion order"
syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "invalid domain name $(@)"
-update: "sudo sh -c \"touch /etc/resolv.conf && \
-if grep -q 'search\t $(@)' /etc/resolv.conf; then exit 0; \
-else echo \\\"search\t $(@)\\\" >> /etc/resolv.conf; fi\" "
-delete: "sudo sh -c \"touch /etc/resolv.conf && \
-sed -i '/search\\\\t $(@)/d' /etc/resolv.conf\" "
+update: "sudo /opt/vyatta/sbin/vyatta_update_resolv.pl"
+delete: "sudo /opt/vyatta/sbin/vyatta_update_resolv.pl"