remove extention on some scripts and correct services
authorLaurent Mazet <laurent.mazet@thalesgroup.com>
Wed, 16 Sep 2015 16:05:15 +0000 (18:05 +0200)
committerLaurent Mazet <laurent.mazet@thalesgroup.com>
Wed, 16 Sep 2015 16:05:15 +0000 (18:05 +0200)
19 files changed:
master/etc/init.d/ammwake
master/etc/init.d/waitslaves
master/etc/init.d/waitswitches
master/etc/webconfig/alias.d/50-trc6500-master-file.csv
master/opt/script/configure_fe306 [new file with mode: 0755]
master/opt/script/configure_fe306.sh [deleted file]
master/opt/script/configure_matrix [new file with mode: 0755]
master/opt/script/configure_matrix.tcl [deleted file]
master/opt/script/configure_switch [new file with mode: 0755]
master/opt/script/configure_switch.tcl [deleted file]
master/opt/script/configure_switch_bootstrap [new file with mode: 0755]
master/opt/script/configure_switch_bootstrap.tcl [deleted file]
master/opt/script/connect_switch [new file with mode: 0755]
master/opt/script/connect_switch.tcl [deleted file]
master/opt/script/flash_fe306 [new file with mode: 0755]
master/opt/script/flash_fe306.sh [deleted file]
master/opt/script/set_mediatray [new file with mode: 0755]
master/opt/script/set_mediatray.tcl [deleted file]
trc6500-master-file/changelog

index c9828836cb8986cd6b9535e66cb2aa708655f5fa..270f9634aa62a0ae6aebe790727e0668ff605b3d 100755 (executable)
@@ -20,7 +20,7 @@ VER=1.0
 
 HOSTS="/etc/hosts"
 ENABLE="yes"
-SCRIPTS=/opt/script/set_blade_power.tcl /opt/trc6500/script/set_blade_power.tcl
+SCRIPTS="/opt/script/set_blade_power /opt/trc6500/script/set_blade_power"
 SCRIPT=
 
 PATH=/sbin:/usr/sbin:/bin:/usr/bin
index 137e109604c3ba9187f36ebe3851f68b0f059635..ec6fab0928967fdc906cc81f26def56ebd673e3c 100755 (executable)
@@ -19,7 +19,7 @@ VER=1.0
 ### END INIT INFO
 
 ENABLE="yes"
-SCRIPTS=/opt/script/check_network.sh /opt/trc6500/script/check_network.sh
+SCRIPTS="/opt/script/check_network /opt/trc6500/script/check_network"
 SCRIPT=
 TIMEOUT=360
 
index f75abba5c3cc043e3f592adbefc5586ba7653101..511c1aa7166da12e314be1acd6001b32d0580713 100755 (executable)
@@ -19,7 +19,7 @@ VER=1.0
 ### END INIT INFO
 
 ENABLE="yes"
-SCRIPTS=/opt/script/check_switches.sh /opt/trc6500/script/check_switches.sh
+SCRIPTS="/opt/script/check_switches /opt/trc6500/script/check_switches"
 SCRIPT=
 TIMEOUT=360
 
index 3bc9db2e9c9f69b43909fb4feb30877bb2cf4617..aea0590d63d7c0518629848b23b11db5d022329f 100644 (file)
@@ -35,11 +35,11 @@ sw2;/usr/share/webconfig;;Configure switch SW2;/opt/script/configure_switch sw2
 swg1;/usr/share/webconfig;;Configure switch SWG1;/opt/script/configure_switch swg1
 swg2;/usr/share/webconfig;;Configure switch SWG2;/opt/script/configure_switch swg2
 swm;/usr/share/webconfig;;Configure switch SWM;/opt/script/configure_switch swm
-sw1-restart;/usr/share/webconfig;;Restart switch SW1;/opt/script/connect_switch.tcl -c reload sw1
-sw2-restart;/usr/share/webconfig;;Restart switch SW2;/opt/script/connect_switch.tcl -c reload sw2
-swg1-restart;/usr/share/webconfig;;Restart switch SWG1;/opt/script/connect_switch.tcl -c reload swg1
-swg2-restart;/usr/share/webconfig;;Restart switch SWG2;/opt/script/connect_switch.tcl -c reload swg2
-swm-restart;/usr/share/webconfig;;Restart switch SWM;/opt/script/connect_switch.tcl -c reload swm
+sw1-restart;/usr/share/webconfig;;Restart switch SW1;/opt/script/connect_switch -c reload sw1
+sw2-restart;/usr/share/webconfig;;Restart switch SW2;/opt/script/connect_switch -c reload sw2
+swg1-restart;/usr/share/webconfig;;Restart switch SWG1;/opt/script/connect_switch -c reload swg1
+swg2-restart;/usr/share/webconfig;;Restart switch SWG2;/opt/script/connect_switch -c reload swg2
+swm-restart;/usr/share/webconfig;;Restart switch SWM;/opt/script/connect_switch -c reload swm
 ;;;Blade maintenance actions;
 bios;/usr/share/webconfig;;Configure BIOS for all Supermicro blades;sudo /opt/script/check_network.sh -c '/opt/bios/update_bios_cfg.sh -y -Y' -o
 ipmi;/usr/share/webconfig;;Configure IPMI for all Supermicro blades;sudo /opt/script/check_network.sh -c '/opt/ipmi/update_blade_cfg.sh -y -Y' -o
diff --git a/master/opt/script/configure_fe306 b/master/opt/script/configure_fe306
new file mode 100755 (executable)
index 0000000..0d90204
--- /dev/null
@@ -0,0 +1,181 @@
+#!/bin/bash
+
+# parameters
+#
+# ============================================================================
+#
+# Copyright (C) THALES. All rights reserved
+# Author: Laurent Mazet
+# 
+# 2013-11-10 V1.0 : Creation 
+#
+# 2013-11-20 V1.1 :  L.Mazet ajout possibilite de configuration du switch
+# 
+# ============================================================================
+
+DRY=
+ID=
+IP=192.168.0.1
+TRC6500_SCRIPT_DIR=$(dirname $0)
+
+# help function
+
+function usage () {
+  echo "usage: $PROGNAME [-a] [-d] [-h] [-i <id>]"
+  echo " -a: configure all boards"
+  echo " -d: dry mode"
+  echo " -h: help message"
+  echo " -i: board id (from 1 to 5)"
+  exit $@
+  }
+
+# formating functions
+
+function title () { echo -e "\033[0;1m$*\033[0;0m"; }
+function pass () { echo -e "\033[1;32m$*\033[0;0m"; }
+function warn () { echo -e "\033[1;33m$*\033[0;0m"; }
+function fail () { echo -e "\033[1;31m$*\033[0;0m"; }
+
+# configuration values
+
+# argument processing
+
+while [ $# -gt 0 ]; do
+    case "$1" in
+    -a) ID=all;;
+    -d) DRY=yes;;
+    -h) usage 0;;
+    -i) shift; ID=$1;;
+    *) usage 1;;
+    esac
+    shift
+done
+
+# switch port configure function ()
+
+function sw_configure () {
+    case "$1" in 
+    off) CMD="-c 'configure terminal' -c 'interface range g1/39-44' -c 'shutdown' -c end -c 'clear mac address-table dynamic' -c 'clear ip arp inspection log' -c exit";;
+    on) CMD="-c 'configure terminal' -c 'interface range g1/39-44' -c 'no shutdown' -c end -c exit";;
+    1) CMD="-c 'configure terminal' -c 'interface g1/39' -c 'no shutdown' -c end -c exit";;
+    2) CMD="-c 'configure terminal' -c 'interface g1/40' -c 'no shutdown' -c end -c exit";;
+    3) CMD="-c 'configure terminal' -c 'interface g1/41' -c 'no shutdown' -c end -c exit";;
+    4) CMD="-c 'configure terminal' -c 'interface g1/42' -c 'no shutdown' -c end -c exit";;
+    5) CMD="-c 'configure terminal' -c 'interface g1/43' -c 'no shutdown' -c end -c exit";;
+    6) CMD="-c 'configure terminal' -c 'interface g1/44' -c 'no shutdown' -c end -c exit";;
+    esac
+
+    if [ "$DRY" = "yes" ]; then
+        echo connect_switch -h swm $CMD
+    else
+               LOG=/tmp/$PROGNAME-$$.log
+               echo -n "sw_configure $1: "
+        eval $TRC6500_SCRIPT_DIR/connect_switch $CMD swm >&$LOG && pass OK || { fail KO; cat $LOG; exit 1; }
+               rm -f $LOG
+    fi
+}
+
+case "$ID" in
+1) CH1=0; CH2=1; CLOCKREF=external;;
+2) CH1=2; CH2=3; CLOCKREF=internal;;
+3) CH1=4; CH2=5; CLOCKREF=internal;;
+4) CH1=6; CH2=7; CLOCKREF=internal;;
+5) CH1=8; CH2=9; CLOCKREF=internal;;
+6) CH1=10; CH2=11; CLOCKREF=internal;;
+all)
+    for id in $(seq 1 5); do
+        title "switch off all fe306 ports"
+        sw_configure off
+        title "switch on port for fe306 $id"
+        sw_configure $id
+        title "configure fe306 $id"
+        if [ "$DRY" = "yes" ]; then
+            echo $(basename $0) -i $id
+        else
+            { $0 -i $id | mawk -W interactive '{print "  " $0}'; } && pass OK || { fail KO; exit 1; }
+        fi
+    done
+    title "switch on all fe306 ports"
+    sw_configure on
+    exit 0
+    ;;
+*) echo "unknown fe306 id ($ID)"; exit 1;;
+esac
+
+# configure function
+
+function configure () {
+    echo -n "$1 [$2 <= $3]: "
+    if [ "$DRY" = "yes" ]; then
+       echo wget -q -O - http://$IP/$1?$2=$3
+    else
+        wget -q -O - http://$IP/$1?$2=$3 >/dev/null && pass OK || { fail KO; exit 1; }
+    fi
+}
+
+# setup local address
+
+title "setup local address"
+cmd="ifconfig eth1:1 192.168.0.2 netmask 255.255.255.0"
+[ "$DRY" = "yes" ] && echo $cmd || { echo -n $cmd" "; eval $cmd && pass OK || { fail KO; exit 1; }; }
+
+# check if fe306 is connected
+
+#title "check presence of $IP"
+#cmd="ping -c 1 -w 10 -W 10 $IP"
+#[ "$DRY" = "yes" ] && echo $cmd || { echo -n $cmd" "; eval $cmd >&/dev/null && pass OK || { warn KO; ifconfig eth1:1 down; exit 0; }; }
+
+# get serial number
+
+[ "$DRY" = "yes" ] && SN=00 || \
+    SN=$(wget -q -O - http://$IP/versions_en.html | mawk '/MODULE/ { module = 1 } /Serial Number/ { if (module) { printf "%02X", $4; exit 0 } }')
+
+[[ "$SN" =~ ^[0-9A-F][0-9A-F]$ ]] || { echo "unknown serial number ($SN)"; exit 1; }
+
+# configure ip
+
+title "configure ip"
+
+configure ModeServ.cmd serv_mode MANUAL
+configure MacServ.cmd serv_mac 00.80.EE.00.$SN.01
+configure IpServ.cmd serv_ip $(getent hosts | awk '/fe306-'$ID'/ {print $1}')
+configure MaskServ.cmd serv_mask 255.255.255.0
+
+for i in $(seq 1 8); do
+    configure MacProd$i.cmd prod_mac$i 00.80.EE.00.$SN.0$((i+1))
+    configure IpProd$i.cmd prod_ip$i 10.133.26.1$ID$i
+done
+
+configure IpMulticast.cmd multicast_ip 238.0.0.0
+configure RxMulticast.cmd multicast_rx 62002
+configure TxMulticast.cmd multicast_tx 62004
+configure TTL.cmd ttl 10
+
+# configure gps
+
+title "configure gps"
+
+configure GpsRate.cmd gps_rate 19200
+configure GpsChar.cmd gps_char 8
+configure GpsStop.cmd gps_stop 1
+configure GpsParity.cmd gps_parity no
+
+# configure miscellaneous
+
+title "configure miscellaneous"
+configure BoardNum.cmd board_num $ID
+configure RackNum.cmd rack_num 1
+configure Chan1Num.cmd channel1_num $CH1
+configure Chan2Num.cmd channel2_num $CH2
+
+configure FpgaLoc.cmd fpga_loc FLASH
+configure Clk10Mhz.cmd clk_10 $CLOCKREF
+configure PllConfig.cmd pll_cfg pll_cfg_02
+
+# unset local address
+
+title "unset local address"
+cmd="ifconfig eth1:1 down"
+[ "$DRY" = "yes" ] && echo $cmd || { echo -n $cmd" "; eval $cmd && pass OK || { fail KO; exit 1; }; }
+
+# vim:set tabstop=4 shiftwidth=4 softtabstop=4:
diff --git a/master/opt/script/configure_fe306.sh b/master/opt/script/configure_fe306.sh
deleted file mode 100755 (executable)
index 53cfae8..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/bin/bash
-
-# parameters
-#
-# ============================================================================
-#
-# Copyright (C) THALES. All rights reserved
-# Author: Laurent Mazet
-# 
-# 2013-11-10 V1.0 : Creation 
-#
-# 2013-11-20 V1.1 :  L.Mazet ajout possibilite de configuration du switch
-# 
-# ============================================================================
-
-DRY=
-ID=
-IP=192.168.0.1
-TRC6500_SCRIPT_DIR=$(dirname $0)
-
-# help function
-
-function usage () {
-  echo "usage: $PROGNAME [-a] [-d] [-h] [-i <id>]"
-  echo " -a: configure all boards"
-  echo " -d: dry mode"
-  echo " -h: help message"
-  echo " -i: board id (from 1 to 5)"
-  exit $@
-  }
-
-# formating functions
-
-function title () { echo -e "\033[0;1m$*\033[0;0m"; }
-function pass () { echo -e "\033[1;32m$*\033[0;0m"; }
-function warn () { echo -e "\033[1;33m$*\033[0;0m"; }
-function fail () { echo -e "\033[1;31m$*\033[0;0m"; }
-
-# configuration values
-
-# argument processing
-
-while [ $# -gt 0 ]; do
-    case "$1" in
-    -a) ID=all;;
-    -d) DRY=yes;;
-    -h) usage 0;;
-    -i) shift; ID=$1;;
-    *) usage 1;;
-    esac
-    shift
-done
-
-# switch port configure function ()
-
-function sw_configure () {
-    case "$1" in 
-    off) CMD="-c 'configure terminal' -c 'interface range g1/39-44' -c 'shutdown' -c end -c 'clear mac address-table dynamic' -c 'clear ip arp inspection log' -c exit";;
-    on) CMD="-c 'configure terminal' -c 'interface range g1/39-44' -c 'no shutdown' -c end -c exit";;
-    1) CMD="-c 'configure terminal' -c 'interface g1/39' -c 'no shutdown' -c end -c exit";;
-    2) CMD="-c 'configure terminal' -c 'interface g1/40' -c 'no shutdown' -c end -c exit";;
-    3) CMD="-c 'configure terminal' -c 'interface g1/41' -c 'no shutdown' -c end -c exit";;
-    4) CMD="-c 'configure terminal' -c 'interface g1/42' -c 'no shutdown' -c end -c exit";;
-    5) CMD="-c 'configure terminal' -c 'interface g1/43' -c 'no shutdown' -c end -c exit";;
-    6) CMD="-c 'configure terminal' -c 'interface g1/44' -c 'no shutdown' -c end -c exit";;
-    esac
-
-    if [ "$DRY" = "yes" ]; then
-        echo connect_switch.tcl -h swm $CMD
-    else
-               LOG=/tmp/$PROGNAME-$$.log
-               echo -n "sw_configure $1: "
-        eval $TRC6500_SCRIPT_DIR/connect_switch.tcl $CMD swm >&$LOG && pass OK || { fail KO; cat $LOG; exit 1; }
-               rm -f $LOG
-    fi
-}
-
-case "$ID" in
-1) CH1=0; CH2=1; CLOCKREF=external;;
-2) CH1=2; CH2=3; CLOCKREF=internal;;
-3) CH1=4; CH2=5; CLOCKREF=internal;;
-4) CH1=6; CH2=7; CLOCKREF=internal;;
-5) CH1=8; CH2=9; CLOCKREF=internal;;
-6) CH1=10; CH2=11; CLOCKREF=internal;;
-all)
-    for id in $(seq 1 5); do
-        title "switch off all fe306 ports"
-        sw_configure off
-        title "switch on port for fe306 $id"
-        sw_configure $id
-        title "configure fe306 $id"
-        if [ "$DRY" = "yes" ]; then
-            echo $(basename $0) -i $id
-        else
-            { $0 -i $id | mawk -W interactive '{print "  " $0}'; } && pass OK || { fail KO; exit 1; }
-        fi
-    done
-    title "switch on all fe306 ports"
-    sw_configure on
-    exit 0
-    ;;
-*) echo "unknown fe306 id ($ID)"; exit 1;;
-esac
-
-# configure function
-
-function configure () {
-    echo -n "$1 [$2 <= $3]: "
-    if [ "$DRY" = "yes" ]; then
-       echo wget -q -O - http://$IP/$1?$2=$3
-    else
-        wget -q -O - http://$IP/$1?$2=$3 >/dev/null && pass OK || { fail KO; exit 1; }
-    fi
-}
-
-# setup local address
-
-title "setup local address"
-cmd="ifconfig eth1:1 192.168.0.2 netmask 255.255.255.0"
-[ "$DRY" = "yes" ] && echo $cmd || { echo -n $cmd" "; eval $cmd && pass OK || { fail KO; exit 1; }; }
-
-# check if fe306 is connected
-
-#title "check presence of $IP"
-#cmd="ping -c 1 -w 10 -W 10 $IP"
-#[ "$DRY" = "yes" ] && echo $cmd || { echo -n $cmd" "; eval $cmd >&/dev/null && pass OK || { warn KO; ifconfig eth1:1 down; exit 0; }; }
-
-# get serial number
-
-[ "$DRY" = "yes" ] && SN=00 || \
-    SN=$(wget -q -O - http://$IP/versions_en.html | mawk '/MODULE/ { module = 1 } /Serial Number/ { if (module) { printf "%02X", $4; exit 0 } }')
-
-[[ "$SN" =~ ^[0-9A-F][0-9A-F]$ ]] || { echo "unknown serial number ($SN)"; exit 1; }
-
-# configure ip
-
-title "configure ip"
-
-configure ModeServ.cmd serv_mode MANUAL
-configure MacServ.cmd serv_mac 00.80.EE.00.$SN.01
-configure IpServ.cmd serv_ip $(getent hosts | awk '/fe306-'$ID'/ {print $1}')
-configure MaskServ.cmd serv_mask 255.255.255.0
-
-for i in $(seq 1 8); do
-    configure MacProd$i.cmd prod_mac$i 00.80.EE.00.$SN.0$((i+1))
-    configure IpProd$i.cmd prod_ip$i 10.133.26.1$ID$i
-done
-
-configure IpMulticast.cmd multicast_ip 238.0.0.0
-configure RxMulticast.cmd multicast_rx 62002
-configure TxMulticast.cmd multicast_tx 62004
-configure TTL.cmd ttl 10
-
-# configure gps
-
-title "configure gps"
-
-configure GpsRate.cmd gps_rate 19200
-configure GpsChar.cmd gps_char 8
-configure GpsStop.cmd gps_stop 1
-configure GpsParity.cmd gps_parity no
-
-# configure miscellaneous
-
-title "configure miscellaneous"
-configure BoardNum.cmd board_num $ID
-configure RackNum.cmd rack_num 1
-configure Chan1Num.cmd channel1_num $CH1
-configure Chan2Num.cmd channel2_num $CH2
-
-configure FpgaLoc.cmd fpga_loc FLASH
-configure Clk10Mhz.cmd clk_10 $CLOCKREF
-configure PllConfig.cmd pll_cfg pll_cfg_02
-
-# unset local address
-
-title "unset local address"
-cmd="ifconfig eth1:1 down"
-[ "$DRY" = "yes" ] && echo $cmd || { echo -n $cmd" "; eval $cmd && pass OK || { fail KO; exit 1; }; }
-
-# vim:set tabstop=4 shiftwidth=4 softtabstop=4:
diff --git a/master/opt/script/configure_matrix b/master/opt/script/configure_matrix
new file mode 100755 (executable)
index 0000000..540c3d1
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/expect
+
+# ============================================================================
+#
+# Copyright (C) THALES. All rights reserved
+#
+# * V1.0 Laurent Mazet 29/04/2013 
+#   creation script de configuration de la matrice par ligne de commande
+# ============================================================================
+
+spawn /opt/trc6500/tools/matrix_tool
+
+set timeout 3
+
+exec ifconfig eth1:0 192.168.1.1 netmask 255.255.255.0
+
+proc cleanexit {rc} {
+    exec ifconfig eth1:0 down
+    exit $rc
+}
+
+expect {
+    "taper la commande choisie" { send "0\r" }
+    timeout { send_user "connection to $host timed out\n"; cleanexit 1 }
+    eof { send_user "connection to host failed\n"; cleanexit 1 }
+}
+expect {
+    "timeout detected" { send_user "can't connect on defaut ip\n"; cleanexit 1 }
+    "taper la commande choisie" { send "10\r" }
+}
+
+expect "nouvelle adresse" { send "010.133.026.253\r" }
+
+expect "taper la commande choisie" { send "12\r" }
+
+expect "taper la commande choisie" { send "14\r" }
+
+cleanexit 0
+# vim:set tabstop=4 expandtab shiftwidth=4:
diff --git a/master/opt/script/configure_matrix.tcl b/master/opt/script/configure_matrix.tcl
deleted file mode 100755 (executable)
index 540c3d1..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/expect
-
-# ============================================================================
-#
-# Copyright (C) THALES. All rights reserved
-#
-# * V1.0 Laurent Mazet 29/04/2013 
-#   creation script de configuration de la matrice par ligne de commande
-# ============================================================================
-
-spawn /opt/trc6500/tools/matrix_tool
-
-set timeout 3
-
-exec ifconfig eth1:0 192.168.1.1 netmask 255.255.255.0
-
-proc cleanexit {rc} {
-    exec ifconfig eth1:0 down
-    exit $rc
-}
-
-expect {
-    "taper la commande choisie" { send "0\r" }
-    timeout { send_user "connection to $host timed out\n"; cleanexit 1 }
-    eof { send_user "connection to host failed\n"; cleanexit 1 }
-}
-expect {
-    "timeout detected" { send_user "can't connect on defaut ip\n"; cleanexit 1 }
-    "taper la commande choisie" { send "10\r" }
-}
-
-expect "nouvelle adresse" { send "010.133.026.253\r" }
-
-expect "taper la commande choisie" { send "12\r" }
-
-expect "taper la commande choisie" { send "14\r" }
-
-cleanexit 0
-# vim:set tabstop=4 expandtab shiftwidth=4:
diff --git a/master/opt/script/configure_switch b/master/opt/script/configure_switch
new file mode 100755 (executable)
index 0000000..0a7785e
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/expect
+
+# ============================================================================
+#
+# Copyright (C) THALES. All rights reserved
+# Author: Laurent Mazet
+# 
+# Script de configuration du switchs
+#
+# 2013-10-10 V1.0 : Creation
+#
+# ============================================================================
+
+set host [lrange $argv 0 0]
+if { $host == "" } {
+    puts "usage: configure_switch \[sw1|sw2|swg1|swg2|swm\]"
+    exit 1
+}
+
+set tftpserver ""
+if { $host == "swg1" } { set tftpserver "10.133.26.160" }
+if { $host == "swg2" } { set tftpserver "10.133.26.160" }
+if { $host == "swm" } { set tftpserver "10.133.28.160" }
+if { $host == "sw1" } { set tftpserver "10.133.26.160" }
+if { $host == "sw2" } { set tftpserver "10.133.26.160" }
+if { $tftpserver == "" } { puts "unknown switch '$host'"; exit }
+
+set date [ exec date +%Y%m%d-%H:%m:%S ]
+set backup "$host-$date.txt"
+
+spawn telnet $host
+
+set timeout 30
+
+expect {
+    "Password:" { send "thales\r" }
+    incorrect { send_user "invalid password or account\n"; exit 1 }
+    timeout { send_user "connection to $host timed out\n"; exit 1 }
+    eof { send_user "connection to host failed\n"; exit 1 }
+}
+expect -exact ">" { send "enable\r" }
+expect "Password:" { send "thales\r" }
+expect "#" { send "copy running-config tftp://$tftpserver/$backup\r" }
+expect -exact "?" { send "$tftpserver\r" }
+expect -exact "?" { send "$backup\r" }
+expect "#" { send "copy tftp://$tftpserver/$host.txt startup-config\r" }
+expect -exact "?" { send "startup-config\r" }
+#expect "#" { send_user " << reload or exit ? >> "; interact }
+expect "#" { send "reload\r" }
+
+exit 0
+# vim:set tabstop=4 expandtab shiftwidth=4:
diff --git a/master/opt/script/configure_switch.tcl b/master/opt/script/configure_switch.tcl
deleted file mode 100755 (executable)
index 4d34d43..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/expect
-
-# ============================================================================
-#
-# Copyright (C) THALES. All rights reserved
-# Author: Laurent Mazet
-# 
-# Script de configuration du switchs
-#
-# 2013-10-10 V1.0 : Creation
-#
-# ============================================================================
-
-set host [lrange $argv 0 0]
-if { $host == "" } {
-    puts "usage: configure_switch.tcl \[sw1|sw2|swg1|swg2|swm\]"
-    exit 1
-}
-
-set tftpserver ""
-if { $host == "swg1" } { set tftpserver "10.133.26.160" }
-if { $host == "swg2" } { set tftpserver "10.133.26.160" }
-if { $host == "swm" } { set tftpserver "10.133.28.160" }
-if { $host == "sw1" } { set tftpserver "10.133.26.160" }
-if { $host == "sw2" } { set tftpserver "10.133.26.160" }
-if { $tftpserver == "" } { puts "unknown switch '$host'"; exit }
-
-set date [ exec date +%Y%m%d-%H:%m:%S ]
-set backup "$host-$date.txt"
-
-spawn telnet $host
-
-set timeout 30
-
-expect {
-    "Password:" { send "thales\r" }
-    incorrect { send_user "invalid password or account\n"; exit 1 }
-    timeout { send_user "connection to $host timed out\n"; exit 1 }
-    eof { send_user "connection to host failed\n"; exit 1 }
-}
-expect -exact ">" { send "enable\r" }
-expect "Password:" { send "thales\r" }
-expect "#" { send "copy running-config tftp://$tftpserver/$backup\r" }
-expect -exact "?" { send "$tftpserver\r" }
-expect -exact "?" { send "$backup\r" }
-expect "#" { send "copy tftp://$tftpserver/$host.txt startup-config\r" }
-expect -exact "?" { send "startup-config\r" }
-#expect "#" { send_user " << reload or exit ? >> "; interact }
-expect "#" { send "reload\r" }
-
-exit 0
-# vim:set tabstop=4 expandtab shiftwidth=4:
diff --git a/master/opt/script/configure_switch_bootstrap b/master/opt/script/configure_switch_bootstrap
new file mode 100755 (executable)
index 0000000..f7b9da8
--- /dev/null
@@ -0,0 +1,49 @@
+#!/usr/bin/expect
+
+set host [lrange $argv 0 0]
+if { $host == "" } {
+    puts "usage: configure_switch_bootstrap \[sw1|sw2|swg1|swg2|swm\]"
+    exit 1
+}
+
+set ipaddress ""
+if { $host == "swg1" } { set ipaddress "10.133.26.231" }
+if { $host == "swg2" } { set ipaddress "10.133.26.232" }
+if { $host == "swm" } { set ipaddress "10.133.28.231" }
+if { $host == "sw1" } { set ipaddress "10.133.26.231" }
+if { $host == "sw2" } { set ipaddress "10.133.26.232" }
+if { $ipaddress == "" } { puts "unknown switch '$host'""; exit 1 }
+
+spawn screen -c . /dev/ttyUSB0
+
+set timeout 5
+
+set state 0
+while { $state != 1 } {
+    expect {
+        timeout { send "\r" }
+        -exact ">" { send "enable\r" }
+        "#" { set state 1 }
+        "Password:" { send "thales\r" }
+        eof { send_user "connection to host failed\n"; exit 1 }
+    }
+}
+
+send "configure terminal\r"
+expect "#" { send "interface vlan 1\r" }
+expect "#" { send "ip address $ipaddress 255.255.255.0\r" }
+expect "#" { send "exit\r" }
+expect "#" { send "line vty 0 4\r" }
+expect "#" { send "password thales\r" }
+expect "#" { send "enable password thales\r" }
+expect "#" { send "end\r" }
+
+# quit switch connection
+expect "#" { send "exit\r" }
+
+# to quit screen we need to send C-a \.
+send "\001\\"
+expect "kill all your windows" { send "y\r" }
+
+exit 0
+# vim:set tabstop=4 expandtab shiftwidth=4:
diff --git a/master/opt/script/configure_switch_bootstrap.tcl b/master/opt/script/configure_switch_bootstrap.tcl
deleted file mode 100755 (executable)
index db95d4d..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/expect
-
-set host [lrange $argv 0 0]
-if { $host == "" } {
-    puts "usage: configure_switch_bootstrap.tcl \[sw1|sw2|swg1|swg2|swm\]"
-    exit 1
-}
-
-set ipaddress ""
-if { $host == "swg1" } { set ipaddress "10.133.26.231" }
-if { $host == "swg2" } { set ipaddress "10.133.26.232" }
-if { $host == "swm" } { set ipaddress "10.133.28.231" }
-if { $host == "sw1" } { set ipaddress "10.133.26.231" }
-if { $host == "sw2" } { set ipaddress "10.133.26.232" }
-if { $ipaddress == "" } { puts "unknown switch '$host'""; exit 1 }
-
-spawn screen -c . /dev/ttyUSB0
-
-set timeout 5
-
-set state 0
-while { $state != 1 } {
-    expect {
-        timeout { send "\r" }
-        -exact ">" { send "enable\r" }
-        "#" { set state 1 }
-        "Password:" { send "thales\r" }
-        eof { send_user "connection to host failed\n"; exit 1 }
-    }
-}
-
-send "configure terminal\r"
-expect "#" { send "interface vlan 1\r" }
-expect "#" { send "ip address $ipaddress 255.255.255.0\r" }
-expect "#" { send "exit\r" }
-expect "#" { send "line vty 0 4\r" }
-expect "#" { send "password thales\r" }
-expect "#" { send "enable password thales\r" }
-expect "#" { send "end\r" }
-
-# quit switch connection
-expect "#" { send "exit\r" }
-
-# to quit screen we need to send C-a \.
-send "\001\\"
-expect "kill all your windows" { send "y\r" }
-
-exit 0
-# vim:set tabstop=4 expandtab shiftwidth=4:
diff --git a/master/opt/script/connect_switch b/master/opt/script/connect_switch
new file mode 100755 (executable)
index 0000000..67f7678
--- /dev/null
@@ -0,0 +1,115 @@
+#!/usr/bin/expect
+
+# ============================================================================
+#
+# Copyright (C) THALES. All rights reserved
+# Author: Laurent Mazet
+# 
+# Script de connection au switchs
+#
+# 2013-10-10 V1.0 : Creation
+#
+# 2014-03-05 V1.1 : LMa ajout de passage de commande CISCO en parametre
+#
+# 2014-06-10 V1.2 : LMa ajout d'un fichier de commandes
+# 
+# ============================================================================
+
+# default value
+set adminpassword "thales"
+set cmd {}
+set host ""
+set loginpassword "thales"
+set prompt "SW*"
+
+proc usage {rc} {
+    puts "usage: connect_switch \[host\] \[-a adminpassword\] \[-c command\] \[-f file\] \[-h\] \[-l loginpassword\] \[-p prompt\]"
+    exit $rc
+}
+
+# process argument
+set action ""
+for {set i 0} {$i < [llength $argv]} {incr i} {
+    set arg [lindex $argv $i]
+    switch $arg {
+        -a { set action "-adminpassword" }
+        -c { set action "-cmd" }
+        -f { set action "-file" }
+        -h { usage 0 }
+        -l { set action "-loginpassword" }
+        -p { set action "-prompt" }
+        default {
+            switch $action {
+                -adminpassword { set adminpassword $arg }
+                -cmd { set cmd [lappend cmd $arg] }
+                -file {
+                    if {[file isfile $arg] == 1} then {
+                        set f [open $arg "r"]
+                        set data [read $f]
+                        close $f
+                        foreach line [split $data "\n"] {
+                            set cmd [lappend cmd $line]
+                        }
+                    } else {
+                        puts "can't open file '$arg'"
+                        exit 1
+                    }
+                }
+                -loginpassword { set loginpassword $arg }
+                -prompt { set prompt $arg }
+                default { set host $arg }
+            }
+        set action ""
+        }
+    }
+}
+if {$action != ""} {
+    puts "missing arguments"
+    exit 1
+}
+if { $host == "" } {
+    usage 1
+}
+
+# start connection
+spawn telnet $host
+
+# login password
+expect {
+    "Password:" { send "$loginpassword\r" }
+    timeout { send_user "connection to host failed\n"; exit 1 }
+    eof { send_user "connection to host failed\n"; exit 1 }
+}
+
+# admin password
+expect {
+    "$prompt>" { send "enable\r" }
+    timeout { send_user "connection to host failed\n"; exit 1 }
+    "Password:" { send_user "invalid login password\n"; exit 1 }
+}
+expect "Password:" { send "$adminpassword\r" }
+expect {
+    "$prompt#" { send "\r" }
+    "Password:" { send_user "invalid admin password\n"; exit 1 }
+}
+
+# commands or interactive mode
+if {[llength $cmd] == 0 } {
+    expect "$prompt#" { interact }
+} else {
+    expect "$prompt#" { send "terminal length 0\r" }
+    for {set i 0} {$i < [llength $cmd]} {incr i} {
+        expect {
+            "$prompt#" { send "[lindex $cmd $i]\r" }
+            "confirm" { send "\r"; continue }
+        }
+    }
+    expect {
+        "confirm" { send "\r"; expect "$prompt" { send "exit\r" } }
+        "$prompt" { send "exit\r" }
+    }
+    send_user "\n"
+}
+
+exit 0
+# vim:set tabstop=4 shiftwidth=4 softtabstop=4:
diff --git a/master/opt/script/connect_switch.tcl b/master/opt/script/connect_switch.tcl
deleted file mode 100755 (executable)
index 5f2299e..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/expect
-
-# ============================================================================
-#
-# Copyright (C) THALES. All rights reserved
-# Author: Laurent Mazet
-# 
-# Script de connection au switchs
-#
-# 2013-10-10 V1.0 : Creation
-#
-# 2014-03-05 V1.1 : LMa ajout de passage de commande CISCO en parametre
-#
-# 2014-06-10 V1.2 : LMa ajout d'un fichier de commandes
-# 
-# ============================================================================
-
-# default value
-set adminpassword "thales"
-set cmd {}
-set host ""
-set loginpassword "thales"
-set prompt "SW*"
-
-proc usage {rc} {
-    puts "usage: connect_switch.tcl \[host\] \[-a adminpassword\] \[-c command\] \[-f file\] \[-h\] \[-l loginpassword\] \[-p prompt\]"
-    exit $rc
-}
-
-# process argument
-set action ""
-for {set i 0} {$i < [llength $argv]} {incr i} {
-    set arg [lindex $argv $i]
-    switch $arg {
-        -a { set action "-adminpassword" }
-        -c { set action "-cmd" }
-        -f { set action "-file" }
-        -h { usage 0 }
-        -l { set action "-loginpassword" }
-        -p { set action "-prompt" }
-        default {
-            switch $action {
-                -adminpassword { set adminpassword $arg }
-                -cmd { set cmd [lappend cmd $arg] }
-                -file {
-                    if {[file isfile $arg] == 1} then {
-                        set f [open $arg "r"]
-                        set data [read $f]
-                        close $f
-                        foreach line [split $data "\n"] {
-                            set cmd [lappend cmd $line]
-                        }
-                    } else {
-                        puts "can't open file '$arg'"
-                        exit 1
-                    }
-                }
-                -loginpassword { set loginpassword $arg }
-                -prompt { set prompt $arg }
-                default { set host $arg }
-            }
-        set action ""
-        }
-    }
-}
-if {$action != ""} {
-    puts "missing arguments"
-    exit 1
-}
-if { $host == "" } {
-    usage 1
-}
-
-# start connection
-spawn telnet $host
-
-# login password
-expect {
-    "Password:" { send "$loginpassword\r" }
-    timeout { send_user "connection to host failed\n"; exit 1 }
-    eof { send_user "connection to host failed\n"; exit 1 }
-}
-
-# admin password
-expect {
-    "$prompt>" { send "enable\r" }
-    timeout { send_user "connection to host failed\n"; exit 1 }
-    "Password:" { send_user "invalid login password\n"; exit 1 }
-}
-expect "Password:" { send "$adminpassword\r" }
-expect {
-    "$prompt#" { send "\r" }
-    "Password:" { send_user "invalid admin password\n"; exit 1 }
-}
-
-# commands or interactive mode
-if {[llength $cmd] == 0 } {
-    expect "$prompt#" { interact }
-} else {
-    expect "$prompt#" { send "terminal length 0\r" }
-    for {set i 0} {$i < [llength $cmd]} {incr i} {
-        expect {
-            "$prompt#" { send "[lindex $cmd $i]\r" }
-            "confirm" { send "\r"; continue }
-        }
-    }
-    expect {
-        "confirm" { send "\r"; expect "$prompt" { send "exit\r" } }
-        "$prompt" { send "exit\r" }
-    }
-    send_user "\n"
-}
-
-exit 0
-# vim:set tabstop=4 shiftwidth=4 softtabstop=4:
diff --git a/master/opt/script/flash_fe306 b/master/opt/script/flash_fe306
new file mode 100755 (executable)
index 0000000..423b6d4
--- /dev/null
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+# parameters
+#
+# ============================================================================
+#
+# Copyright (C) THALES. All rights reserved
+# Author: Laurent Mazet
+# 
+# 2014-10-06 V1.0 : Creation 
+# 
+# ============================================================================
+
+DRY=
+FIRMWARE=/opt/trc6500/config/code_metier/libHwCtrl/Bitstream
+LIST="application.out production.bin ts12_fp_pano.bin ts22_fp_pano.bin firmware.out"
+HOST=
+TRC6500_SCRIPT_DIR=$(dirname $0)
+
+# help function
+
+function usage () {
+  echo "usage: $PROGNAME [-d] [-f dir] [-h] [-i host] [-l list]"
+  echo " -d: dry mode"
+  echo " -f: firmware directory ($FIRMWARE)"
+  echo " -h: help message"
+  echo " -i: board hostname (or ip)"
+  echo " -l: list of firmware ($LIST)"
+  exit $@
+  }
+
+# formating functions
+
+function title () { echo -e "\033[0;1m$*\033[0;0m"; }
+function pass () { echo -e "\033[1;32m$*\033[0;0m"; }
+function warn () { echo -e "\033[1;33m$*\033[0;0m"; }
+function fail () { echo -e "\033[1;31m$*\033[0;0m"; }
+
+# argument processing
+
+while [ $# -gt 0 ]; do
+    case "$1" in
+    -d) DRY=yes;;
+    -f) shift; FIRMWARE=$1;;
+    -h) usage 0;;
+    -i) shift; HOST=$1;;
+    -l) shift; LIST=$1;;
+    *) usage 1;;
+    esac
+    shift
+done
+
+# check host
+
+[ "$HOST" ] || ping -c 1 $HOST >&/dev/null || \
+    { fail "Can't connect '$HOST'"; exit 1; }
+
+# check firmware
+
+for f in $LIST; do
+    [ -f $FIRMWARE/$f ] || { fail "Can't find '$FIRMWARE/$f'"; exit 1; }
+done
+
+# check mode
+
+protect=""
+[ "$DRY" = yes ] && protect="!echo"
+
+# flash firmware
+
+title "flash fe306 '$HOST'"
+
+ftp -n <<EOF
+open $HOST
+quote USER none
+quote PASS none
+binary
+cd flash
+$(for f in $LIST; do echo "$protect send $FIRMWARE/$f"; done)
+bye
+EOF
+
+# vim:set tabstop=4 shiftwidth=4 softtabstop=4:
diff --git a/master/opt/script/flash_fe306.sh b/master/opt/script/flash_fe306.sh
deleted file mode 100755 (executable)
index 423b6d4..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/bash
-
-# parameters
-#
-# ============================================================================
-#
-# Copyright (C) THALES. All rights reserved
-# Author: Laurent Mazet
-# 
-# 2014-10-06 V1.0 : Creation 
-# 
-# ============================================================================
-
-DRY=
-FIRMWARE=/opt/trc6500/config/code_metier/libHwCtrl/Bitstream
-LIST="application.out production.bin ts12_fp_pano.bin ts22_fp_pano.bin firmware.out"
-HOST=
-TRC6500_SCRIPT_DIR=$(dirname $0)
-
-# help function
-
-function usage () {
-  echo "usage: $PROGNAME [-d] [-f dir] [-h] [-i host] [-l list]"
-  echo " -d: dry mode"
-  echo " -f: firmware directory ($FIRMWARE)"
-  echo " -h: help message"
-  echo " -i: board hostname (or ip)"
-  echo " -l: list of firmware ($LIST)"
-  exit $@
-  }
-
-# formating functions
-
-function title () { echo -e "\033[0;1m$*\033[0;0m"; }
-function pass () { echo -e "\033[1;32m$*\033[0;0m"; }
-function warn () { echo -e "\033[1;33m$*\033[0;0m"; }
-function fail () { echo -e "\033[1;31m$*\033[0;0m"; }
-
-# argument processing
-
-while [ $# -gt 0 ]; do
-    case "$1" in
-    -d) DRY=yes;;
-    -f) shift; FIRMWARE=$1;;
-    -h) usage 0;;
-    -i) shift; HOST=$1;;
-    -l) shift; LIST=$1;;
-    *) usage 1;;
-    esac
-    shift
-done
-
-# check host
-
-[ "$HOST" ] || ping -c 1 $HOST >&/dev/null || \
-    { fail "Can't connect '$HOST'"; exit 1; }
-
-# check firmware
-
-for f in $LIST; do
-    [ -f $FIRMWARE/$f ] || { fail "Can't find '$FIRMWARE/$f'"; exit 1; }
-done
-
-# check mode
-
-protect=""
-[ "$DRY" = yes ] && protect="!echo"
-
-# flash firmware
-
-title "flash fe306 '$HOST'"
-
-ftp -n <<EOF
-open $HOST
-quote USER none
-quote PASS none
-binary
-cd flash
-$(for f in $LIST; do echo "$protect send $FIRMWARE/$f"; done)
-bye
-EOF
-
-# vim:set tabstop=4 shiftwidth=4 softtabstop=4:
diff --git a/master/opt/script/set_mediatray b/master/opt/script/set_mediatray
new file mode 100755 (executable)
index 0000000..02f76b2
--- /dev/null
@@ -0,0 +1,86 @@
+#!/usr/bin/expect
+
+# ============================================================================
+#
+# Copyright (C) THALES. All rights reserved
+# Author: Laurent Mazet
+# 
+# Script de connection au switchs
+#
+# 2014-10-06 V1.0 : Creation
+#
+# ============================================================================
+
+# default value
+set blade {0}
+set host ""
+set login "admin"
+set password "thalescom02"
+set prompt "system>"
+
+proc usage {script_name rc} {
+    puts "usage: [exec basename $script_name] \[host\] \[-b blade\] \[-h\] \[-l login\] \[-p password\] \[-x prompt\]"
+    exit $rc
+}
+
+# process argument
+set action ""
+for {set i 0} {$i < [llength $argv]} {incr i} {
+    set arg [lindex $argv $i]
+    switch $arg {
+        -b { set action "-blade" }
+        -h { usage $argv0 0 }
+        -l { set action "-login" }
+        -p { set action "-password" }
+        -x { set action "-prompt" }
+        default {
+            switch $action {
+                -blade { set blade $arg }
+                -login { set login $arg }
+                -password { set password $arg }
+                -prompt { set prompt $arg }
+                default { set host $arg }
+            }
+        set action ""
+        }
+    }
+}
+if {$action != ""} {
+    puts "missing arguments"
+    exit 1
+}
+if { $host == "" } {
+    usage $argv0 1
+}
+
+# start connection
+spawn telnet $host
+
+# login
+expect {
+    "username:" { send "$login\r" }
+    timeout { send_user "connection to host failed\n"; exit 1 }
+    eof { send_user "connection to host failed\n"; exit 1 }
+}
+
+
+# password
+expect {
+    "password:" { send "$password\r" }
+    timeout { send_user "connection to host failed\n"; exit 1 }
+    eof { send_user "connection to host failed\n"; exit 1 }
+}
+
+expect {
+    "$prompt" { send "mt -b $blade\r" }
+    "username:" { send_user "connection to host failed\n"; exit 1 }
+}
+
+expect {
+    "OK" { send "exit\r" }
+    "$prompt" { send_user "error\n"; exit 1 }
+}
+
+send_user "\n"
+exit 0
+# vim:set tabstop=4 shiftwidth=4 softtabstop=4:
diff --git a/master/opt/script/set_mediatray.tcl b/master/opt/script/set_mediatray.tcl
deleted file mode 100755 (executable)
index 02f76b2..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/expect
-
-# ============================================================================
-#
-# Copyright (C) THALES. All rights reserved
-# Author: Laurent Mazet
-# 
-# Script de connection au switchs
-#
-# 2014-10-06 V1.0 : Creation
-#
-# ============================================================================
-
-# default value
-set blade {0}
-set host ""
-set login "admin"
-set password "thalescom02"
-set prompt "system>"
-
-proc usage {script_name rc} {
-    puts "usage: [exec basename $script_name] \[host\] \[-b blade\] \[-h\] \[-l login\] \[-p password\] \[-x prompt\]"
-    exit $rc
-}
-
-# process argument
-set action ""
-for {set i 0} {$i < [llength $argv]} {incr i} {
-    set arg [lindex $argv $i]
-    switch $arg {
-        -b { set action "-blade" }
-        -h { usage $argv0 0 }
-        -l { set action "-login" }
-        -p { set action "-password" }
-        -x { set action "-prompt" }
-        default {
-            switch $action {
-                -blade { set blade $arg }
-                -login { set login $arg }
-                -password { set password $arg }
-                -prompt { set prompt $arg }
-                default { set host $arg }
-            }
-        set action ""
-        }
-    }
-}
-if {$action != ""} {
-    puts "missing arguments"
-    exit 1
-}
-if { $host == "" } {
-    usage $argv0 1
-}
-
-# start connection
-spawn telnet $host
-
-# login
-expect {
-    "username:" { send "$login\r" }
-    timeout { send_user "connection to host failed\n"; exit 1 }
-    eof { send_user "connection to host failed\n"; exit 1 }
-}
-
-
-# password
-expect {
-    "password:" { send "$password\r" }
-    timeout { send_user "connection to host failed\n"; exit 1 }
-    eof { send_user "connection to host failed\n"; exit 1 }
-}
-
-expect {
-    "$prompt" { send "mt -b $blade\r" }
-    "username:" { send_user "connection to host failed\n"; exit 1 }
-}
-
-expect {
-    "OK" { send "exit\r" }
-    "$prompt" { send_user "error\n"; exit 1 }
-}
-
-send_user "\n"
-exit 0
-# vim:set tabstop=4 shiftwidth=4 softtabstop=4:
index b95e9186ef5da1382a60378e8852d0870bb305fb..7263b281848d9ebd5105445c08da459912002f46 100644 (file)
@@ -1,3 +1,8 @@
+trc6500-master-file (7.8.5-1) unstable; urgency=low
+  * restore /etc/default/webconfig
+
+ -- Laurent Mazet <laurent.mazet@thalesgroup.com>  Wed, 16 Sep 2015 15:24:31 +0200
+
 trc6500-master-file (7.8.4-1) unstable; urgency=low
   * update softndesign packages
   * remove rproxy default files