From c1365a86e5896ff6b7608cc9e85af14239c67bbd Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 15 Nov 2010 10:01:27 -0800 Subject: Move cleanup of serial interface into rl-system.init This gets rid of separate init file for wan interfaces --- scripts/rl-system.init | 21 +++++++++++++++------ 1 file 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 "\.*\<$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" -- cgit v1.2.3