summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-15 10:01:27 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-11-15 10:01:27 -0800
commitc1365a86e5896ff6b7608cc9e85af14239c67bbd (patch)
treebe78c005279bcab5c072b8d5c78f5489e0ee709a /scripts
parentf105fec228b319687812b4295fd545ebe98765df (diff)
downloadvyatta-cfg-system-c1365a86e5896ff6b7608cc9e85af14239c67bbd.tar.gz
vyatta-cfg-system-c1365a86e5896ff6b7608cc9e85af14239c67bbd.zip
Move cleanup of serial interface into rl-system.init
This gets rid of separate init file for wan interfaces
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/rl-system.init21
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/rl-system.init b/scripts/rl-system.init
index 989c51e4..038653fe 100755
--- a/scripts/rl-system.init
+++ b/scripts/rl-system.init
@@ -62,6 +62,11 @@ empty()
shopt -s extglob nullglob
+clear_serial () {
+ rm -f /etc/wanpipe/*.conf /etc/ppp/peers/wan*
+ rm -f /var/run/vyatta/*.description
+}
+
search_config_if_wan () {
grep -q "\<serial\>.*\<$1\>" $BOOTFILE
}
@@ -69,13 +74,15 @@ search_config_if_wan () {
add_new_serial_if () {
__config_additions=/tmp/__config_additions
rm -f $__config_additions
+
ip link show |
- sed -n '/^[0-9]*: wan[0-9]*:/ s/.* \([^:]*\):.*$/\1/p' |
- while read wan ; do
- if ! search_config_if_wan $wan ; then
- echo " serial $wan" >> $__config_additions
- fi
- done
+ sed -n '/^[0-9]*: wan[0-9]*:/ s/.* \([^:]*\):.*$/\1/p' |
+ while read wan ; do
+ if ! search_config_if_wan $wan ; then
+ echo " serial $wan" >> $__config_additions
+ fi
+ done
+
if [ -e $__config_additions ]; then
rm -f /tmp/__bootfile
sed '/^[! ]*interfaces {$/ r '$__config_additions \
@@ -186,6 +193,8 @@ start () {
clear_or_override_config_files || \
log_failure_msg "can\'t reset config files"
setup_ntp_config_file
+
+ clear_serial
add_new_serial_if || \
log_failure_msg "can\'t add serial interfaces"