summaryrefslogtreecommitdiff
path: root/scripts/rl-system.init
diff options
context:
space:
mode:
authorTom Grennan <tgrennan@vyatta.com>2008-01-23 16:06:00 -0800
committerTom Grennan <tgrennan@vyatta.com>2008-01-23 16:06:00 -0800
commit411ea581185a36888b1f4dd2b027541b4e029443 (patch)
tree02088afecb3d924a91c2e2c89777806604f8ac27 /scripts/rl-system.init
parent909f09598d60863634a36972823d19d5ec5a6d1e (diff)
downloadvyatta-cfg-quagga-411ea581185a36888b1f4dd2b027541b4e029443.tar.gz
vyatta-cfg-quagga-411ea581185a36888b1f4dd2b027541b4e029443.zip
fix bug 2658
udev appears to be threaded where sub-scripts may be context switch; so, defer config file interface updates to rl-system.init
Diffstat (limited to 'scripts/rl-system.init')
-rwxr-xr-xscripts/rl-system.init33
1 files changed, 33 insertions, 0 deletions
diff --git a/scripts/rl-system.init b/scripts/rl-system.init
index d73dae74..cbdadd0f 100755
--- a/scripts/rl-system.init
+++ b/scripts/rl-system.init
@@ -22,6 +22,7 @@
#
# **** End License ****
+progname=${0##*/}
ACTION=$1
source /etc/default/vyatta
@@ -30,6 +31,7 @@ source /etc/default/vyatta
: ${vyatta_bindir:=${vyatta_prefix}/bin}
: ${vyatta_sbindir:=${vyatta_prefix}/sbin}
: ${vyatta_sysconfdir:=${vyatta_prefix}/etc}
+: ${hostname:=`hostname -s`}
[[ $PATH == *${vyatta_bindir}* ]] || PATH+=:${vyatta_bindir}
[[ $PATH == *${vyatta_sbindir}* ]] || PATH+=:${vyatta_sbindir}
@@ -41,6 +43,20 @@ export PATH
## BOOTFILE is provided by ofr.init
: ${BOOTFILE:=$prefix/etc/config/config.boot}
+if [ -z "$LOGFILE" ] ; then
+ if touch /var/log/messages &> /dev/null ; then
+ LOGFILE=/var/log/messages
+ else
+ LOGFILE=/dev/null
+ fi
+fi
+
+syslog ()
+{
+
+ date -u "+%b %d %H:%M:%S $hostname $progname: $*" >> $LOGFILE
+}
+
shopt -s extglob nullglob
search_config_if_wan () {
@@ -118,7 +134,24 @@ clear_or_override_config_files ()
rm -f /etc/ssh/ssh_host_key
}
+udev_rescan ()
+{
+ rm -f /tmp/vyatta_net_name_*
+ udevtrigger --subsystem-match=net && udevsettle
+ for ff in /tmp/vyatta_net_name_* ; do
+ f=${ff##*/}
+ cmd_name_hwid=${f/vyatta_net_name_/}
+ cmd=${cmd_name_hwid%%_*}
+ name_hwid=${cmd_name_hwid#*_}
+ name=${name_hwid%_*}
+ hwid=${name_hwid#*_}
+ syslog $cmd $name $hwid
+ $vyatta_sbindir/${cmd}_bootfile_eth_hwid $BOOTFILE $name $hwid
+ done
+}
+
start () {
+ udev_rescan
clear_or_override_config_files || \
log_failure_msg "can\'t reset config files"
set_reboot_on_panic || \