HOSTS="/etc/hosts"
ENABLE="yes"
-SCRIPT=/opt/trc6500/script/set_blade_power.tcl
+SCRIPTS=/opt/script/set_blade_power.tcl /opt/trc6500/script/set_blade_power.tcl
+SCRIPT=
PATH=/sbin:/usr/sbin:/bin:/usr/bin
[ -f /etc/default/ammwake ] && . /etc/default/ammwake
-[ -x $SCRIPT ] || exit 1
+for s in $SCRIPTS; do [ -x $s ] && SCRIPT=$s; done
+[ -x "$SCRIPT" ] || exit 1
[ "$ENABLE" = "yes" ] || exit 0
. /lib/lsb/init-functions
### END INIT INFO
ENABLE="yes"
-SCRIPT=/opt/trc6500/script/check_network.sh
+SCRIPTS=/opt/script/check_network.sh /opt/trc6500/script/check_network.sh
+SCRIPT=
TIMEOUT=360
PATH=/sbin:/usr/sbin:/bin:/usr/bin
[ -f /etc/default/waitslaves ] && . /etc/default/waitslaves
-[ -x $SCRIPT ] || exit 1
+for s in $SCRIPTS; do [ -x $s ] && SCRIPT=$s; done
+[ -x "$SCRIPT" ] || exit 1
[ "$ENABLE" = "yes" ] || exit 0
. /lib/lsb/init-functions
### END INIT INFO
ENABLE="yes"
-SCRIPT=/opt/trc6500/script/check_switches.sh
+SCRIPTS=/opt/script/check_switches.sh /opt/trc6500/script/check_switches.sh
+SCRIPT=
TIMEOUT=360
PATH=/sbin:/usr/sbin:/bin:/usr/bin
[ -f /etc/default/waitswitches ] && . /etc/default/waitswitches
-[ -x $SCRIPT ] || exit 1
+for s in $SCRIPTS; do [ -x $s ] && SCRIPT=$s; done
+[ -x "$SCRIPT" ] || exit 1
[ "$ENABLE" = "yes" ] || exit 0
. /lib/lsb/init-functions
# /etc/sudoers.d/trc6500
+trc6500 ALL = (root)NOPASSWD: /opt/script/check_network.sh *
trc6500 ALL = (root)NOPASSWD: /opt/trc6500/script/check_network.sh *
trc6500 ALL = (root)NOPASSWD: /sbin/halt
trc6500 ALL = (root)NOPASSWD: /usr/sbin/service ammwake *
trc6500 ALL = (root)NOPASSWD: /usr/sbin/service ipmiwake *
trc6500 ALL = (root)NOPASSWD: /usr/sbin/service trc6500 *
trc6500 ALL = (root)NOPASSWD: /usr/bin/make *
+trc6500 ALL = (root)NOPASSWD: /opt/script/change_configuration.sh *
trc6500 ALL = (root)NOPASSWD: /opt/trc6500/script/change_configuration.sh *
trc6500 ALL = (root)NOPASSWD: /root/bin/change_lgcore.sh *
# /etc/sudoers.d/webconfig
+webconfig ALL = (root)NOPASSWD: /opt/script/check_network.sh *
webconfig ALL = (root)NOPASSWD: /opt/trc6500/script/check_network.sh *
webconfig ALL = (root)NOPASSWD: /sbin/halt
webconfig ALL = (root)NOPASSWD: /usr/sbin/service ammwake *
webconfig ALL = (root)NOPASSWD: /usr/sbin/service ipmiwake *
webconfig ALL = (root)NOPASSWD: /usr/sbin/service trc6500 *
webconfig ALL = (root)NOPASSWD: /usr/bin/make *
+webconfig ALL = (root)NOPASSWD: /opt/script/change_configuration.sh *
webconfig ALL = (root)NOPASSWD: /opt/trc6500/script/change_configuration.sh *
webconfig ALL = (root)NOPASSWD: /root/bin/change_lgcore.sh *
stop;/usr/share/webconfig;;Stop active phase;/opt/trc6500/bin/stop_active_phase
halt;/usr/share/webconfig;;Shutdown TRC6500;sudo halt
;;;FE306 maintenance actions;
-fe306;/usr/share/webconfig;;Configure all FE306;/opt/trc6500/script/configure_fe306 -a
-FE306-1-flash;/usr/share/webconfig;;Flash FE306-1;/opt/trc6500/script/flash_fe306 -i fe306-1
-FE306-2-flash;/usr/share/webconfig;;Flash FE306-2;/opt/trc6500/script/flash_fe306 -i fe306-2
-FE306-3-flash;/usr/share/webconfig;;Flash FE306-3;/opt/trc6500/script/flash_fe306 -i fe306-3
-FE306-4-flash;/usr/share/webconfig;;Flash FE306-4;/opt/trc6500/script/flash_fe306 -i fe306-4
-FE306-5-flash;/usr/share/webconfig;;Flash FE306-5;/opt/trc6500/script/flash_fe306 -i fe306-5
+fe306;/usr/share/webconfig;;Configure all FE306;/opt/script/configure_fe306 -a
+FE306-1-flash;/usr/share/webconfig;;Flash FE306-1;/opt/script/flash_fe306 -i fe306-1
+FE306-2-flash;/usr/share/webconfig;;Flash FE306-2;/opt/script/flash_fe306 -i fe306-2
+FE306-3-flash;/usr/share/webconfig;;Flash FE306-3;/opt/script/flash_fe306 -i fe306-3
+FE306-4-flash;/usr/share/webconfig;;Flash FE306-4;/opt/script/flash_fe306 -i fe306-4
+FE306-5-flash;/usr/share/webconfig;;Flash FE306-5;/opt/script/flash_fe306 -i fe306-5
;;;Matrix maintenance actions;
-maxtrix;/usr/share/webconfig;;Configure matrix;/opt/trc6500/script/configure_matrix
+maxtrix;/usr/share/webconfig;;Configure matrix;/opt/script/configure_matrix
;;;Switch maintenance actions;
-sw1-boot;/usr/share/webconfig;;Bootstrap switch SW1;/opt/trc6500/script/configure_switch_bootstrap sw1
-sw2-boot;/usr/share/webconfig;;Bootstrap switch SW2;/opt/trc6500/script/configure_switch_bootstrap sw2
-swg1-boot;/usr/share/webconfig;;Bootstrap switch SWG1;/opt/trc6500/script/configure_switch_bootstrap swg1
-swg2-boot;/usr/share/webconfig;;Bootstrap switch SWG2;/opt/trc6500/script/configure_switch_bootstrap swg2
-swm-boot;/usr/share/webconfig;;Bootstrap switch SWM;/opt/trc6500/script/configure_switch_bootstrap swm
-sw1;/usr/share/webconfig;;Configure switch SW1;/opt/trc6500/script/configure_switch sw1
-sw2;/usr/share/webconfig;;Configure switch SW2;/opt/trc6500/script/configure_switch sw2
-swg1;/usr/share/webconfig;;Configure switch SWG1;/opt/trc6500/script/configure_switch swg1
-swg2;/usr/share/webconfig;;Configure switch SWG2;/opt/trc6500/script/configure_switch swg2
-swm;/usr/share/webconfig;;Configure switch SWM;/opt/trc6500/script/configure_switch swm
-sw1-restart;/usr/share/webconfig;;Restart switch SW1;/opt/trc6500/script/connect_switch.tcl -c reload sw1
-sw2-restart;/usr/share/webconfig;;Restart switch SW2;/opt/trc6500/script/connect_switch.tcl -c reload sw2
-swg1-restart;/usr/share/webconfig;;Restart switch SWG1;/opt/trc6500/script/connect_switch.tcl -c reload swg1
-swg2-restart;/usr/share/webconfig;;Restart switch SWG2;/opt/trc6500/script/connect_switch.tcl -c reload swg2
-swm-restart;/usr/share/webconfig;;Restart switch SWM;/opt/trc6500/script/connect_switch.tcl -c reload swm
+sw1-boot;/usr/share/webconfig;;Bootstrap switch SW1;/opt/script/configure_switch_bootstrap sw1
+sw2-boot;/usr/share/webconfig;;Bootstrap switch SW2;/opt/script/configure_switch_bootstrap sw2
+swg1-boot;/usr/share/webconfig;;Bootstrap switch SWG1;/opt/script/configure_switch_bootstrap swg1
+swg2-boot;/usr/share/webconfig;;Bootstrap switch SWG2;/opt/script/configure_switch_bootstrap swg2
+swm-boot;/usr/share/webconfig;;Bootstrap switch SWM;/opt/script/configure_switch_bootstrap swm
+sw1;/usr/share/webconfig;;Configure switch SW1;/opt/script/configure_switch sw1
+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
;;;Blade maintenance actions;
-bios;/usr/share/webconfig;;Configure BIOS for all Supermicro blades;sudo /opt/trc6500/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/trc6500/script/check_network.sh -c '/opt/ipmi/update_blade_cfg.sh -y -Y' -o
+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
/dce;/usr/share/dce;/etc/dhcp/dhcpd.conf;DHCPD Configuration Editor;sudo service isc-dhcp-server restart
-ntp;/usr/share/webconfig;;Synchronize time and date on all blades;sudo /opt/trc6500/script/check_network.sh -c 'service chrony stop; ntpdate-debian; service chrony start' -o
+ntp;/usr/share/webconfig;;Synchronize time and date on all blades;sudo /opt/script/check_network.sh -c 'service chrony stop; ntpdate-debian; service chrony start' -o
;;;Internal equipements;
http://10.133.26.160:8110;/usr/share/webconfig;;FE306-1;:goto:
http://10.133.26.160:8120;/usr/share/webconfig;;FE306-2;:goto:
ipmiwake;/usr/share/webconfig;;Power on all SuperMicro slaves;sudo service ipmiwake start
ammwake;/usr/share/webconfig;;Power off all HS22 IBM slaves;sudo service ammwake stop
ipmiwake;/usr/share/webconfig;;Power off all SuperMicro slaves;sudo service ipmiwake stop
-mediatray;/usr/share/webconfig;;Set media-tray to HS22 master blade;/opt/trc6500/script/set_mediatray amm00 -b 1
-mediatray;/usr/share/webconfig;;Remove media-tray on HS22 chassis;/opt/trc6500/script/set_mediatray amm00 -b 0 && /opt/trc6500/script/set_mediatray amm01 -b 0
+mediatray;/usr/share/webconfig;;Set media-tray to HS22 master blade;/opt/script/set_mediatray amm00 -b 1
+mediatray;/usr/share/webconfig;;Remove media-tray on HS22 chassis;/opt/script/set_mediatray amm00 -b 0 && /opt/script/set_mediatray amm01 -b 0
;;;Setup hardware actions;
-8mhzmhf;/usr/share/webconfig;;Setup 8MHzMHF mode;sudo /opt/trc6500/script/change_configuration.sh 8MHzMHF
-12mhzdf;/usr/share/webconfig;;Setup 12MHzDF mode;sudo /opt/trc6500/script/change_configuration.sh 12MHzDF
-12mhzmdf;/usr/share/webconfig;;Setup 12MHzMDF mode;sudo /opt/trc6500/script/change_configuration.sh 12MHzMDF
-30mhzmdf;/usr/share/webconfig;;Setup 30MHzMDF mode;sudo /opt/trc6500/script/change_configuration.sh 30MHzMDF
-30mhzmdf.lite;/usr/share/webconfig;;Setup 30MHzMDF lite mode;sudo /opt/trc6500/script/change_configuration.sh 30MHzMDF.lite
-30mhzmhf;/usr/share/webconfig;;Setup 30MHzMHF mode;sudo /opt/trc6500/script/change_configuration.sh 30MHzMHF
-hw_ibm;/usr/share/webconfig;;Setup IBM HS22 chassis mode;sudo /opt/trc6500/script/change_configuration.sh hw_ibm
-hw_supermicro;/usr/share/webconfig;;Setup FatTwin Supermicro chassis mode;sudo /opt/trc6500/script/change_configuration.sh hw_supermicro
-tz_zulu;/usr/share/webconfig;;Setup Zulu timezone;sudo /opt/trc6500/script/change_configuration.sh tz_zulu
-tz_paris;/usr/share/webconfig;;Setup Europe/Paris timezone;sudo /opt/trc6500/script/change_configuration.sh tz_paris
+8mhzmhf;/usr/share/webconfig;;Setup 8MHzMHF mode;sudo /opt/script/change_configuration.sh 8MHzMHF
+12mhzdf;/usr/share/webconfig;;Setup 12MHzDF mode;sudo /opt/script/change_configuration.sh 12MHzDF
+12mhzmdf;/usr/share/webconfig;;Setup 12MHzMDF mode;sudo /opt/script/change_configuration.sh 12MHzMDF
+30mhzmdf;/usr/share/webconfig;;Setup 30MHzMDF mode;sudo /opt/script/change_configuration.sh 30MHzMDF
+30mhzmdf.lite;/usr/share/webconfig;;Setup 30MHzMDF lite mode;sudo /opt/script/change_configuration.sh 30MHzMDF.lite
+30mhzmhf;/usr/share/webconfig;;Setup 30MHzMHF mode;sudo /opt/script/change_configuration.sh 30MHzMHF
+hw_ibm;/usr/share/webconfig;;Setup IBM HS22 chassis mode;sudo /opt/script/change_configuration.sh hw_ibm
+hw_supermicro;/usr/share/webconfig;;Setup FatTwin Supermicro chassis mode;sudo /opt/script/change_configuration.sh hw_supermicro
+tz_zulu;/usr/share/webconfig;;Setup Zulu timezone;sudo /opt/script/change_configuration.sh tz_zulu
+tz_paris;/usr/share/webconfig;;Setup Europe/Paris timezone;sudo /opt/script/change_configuration.sh tz_paris
tarballs;/usr/share/webconfig;;Build tarballs;sudo make -f /opt/cluster/Makefile all
;;;Install LgCore actions;
install-usb;/usr/share/webconfig;;Install LgCore from USB key;sudo /root/bin/change_lgcore.sh usb
+++ /dev/null
-#!/bin/bash
-# ============================================================================
-#
-# Copyright (C) THALES. All rights reserved
-# Author: Laurent Mazet
-#
-
-# Date : 10/10/2013
-#
-# 05/11/2013 : LMa configuration des timezone Zulu(GMT) et Paris
-# Desactivation de pam pour ssh
-# ============================================================================
-
-# Switch configuration
-
-# TODO
-# *
-
-MODE_BW=""
-MODE_FIX=""
-MODE_HW=""
-MODE_NET=""
-MODE_TZ=""
-TARBALLS=""
-PROGNAME=$(basename $0)
-VER=1.0
-TMPLOG=/tmp/$PROGNAME-$$.log
-
-# help function
-
-function usage () {
- echo "usage: $PROGNAME <mode>"
- echo " switch trc6500 mode"
- echo " avaliable modes are:"
- echo " - 8MHzMHF, 12MHzDF, 12MHzMDF, 30MHzMDF 30MHzMDF.lite or 30MHzMHF"
- echo " - fix_ssh"
- echo " - hw_ibm or hw_supermicro"
- echo " - network"
- echo " - tz_zulu or tz_paris"
- 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"; }
-
-# check command
-
-function check () {
- echo -n "$@: "
- $@ 2>$TMPLOG && pass OK || { fail KO; cat $TMPLOG; exit 1; }
- rm -f $TMPLOG
-}
-
-# argument processing
-
-while [ $# -gt 0 ]; do
- case "$1" in
- -h) usage 0;;
- 8mhz|8MHz|12mhzdf|12MHzDF|12mhzmdf|12MHzMDF|30mhzmdf|30MHzMDF|30mhzmdf.lite|30MHzMDF.lite|30mhzmhf|30MHzMHF) MODE_BW="${1^^}";;
- fix_ssh) MODE_FIX="$1";;
- hw_ibm|hw_supermicro) MODE_HW="$1";;
- network) MODE_NET="$1";;
- tz_paris|tz_zulu) MODE_TZ="$1";;
- *) usage 1;;
- esac
- shift
-done
-
-# main process
-
-action=""
-
-if [ "$MODE_BW" ]; then
- title "updating /etc/hosts"
- MODE_BW=${MODE_BW/MHZ/MHz}
- check rm -f /etc/hosts
- check ln -s /etc/hosts.${MODE_BW/LITE/lite} /etc/hosts
- TARBALLS+=" root"
- for ip in 0A851{A,C}; do check ln -T -f -s default /opt/tftp/pxelinux.cfg/$ip; done
- case "$MODE_BW" in
- 8MHzMHF)
- for ip in 0A851{A,C}A5; do check ln -T -f -s rec /opt/tftp/pxelinux.cfg/$ip; done
- ;;
- 12MHzDF) ;;
- 12MHzMDF) ;;
- 30MHzMDF) ;;
- 30MHzMDF.lite)
- check cp /etc/dhcp/dhcpd.conf.lite /etc/dhcp/dhcpd.conf
- ;;
- 30MHzMHF)
- for ip in 0A851{A,C}A{1..6}; do check ln -T -f -s acq /opt/tftp/pxelinux.cfg/$ip; done
- for ip in 0A851{A,C}A9; do check ln -T -f -s rec /opt/tftp/pxelinux.cfg/$ip; done
- ;;
- esac
- action="done"
-fi
-
-if [ "$MODE_FIX" ]; then
-
- case "$MODE_FIX" in
- fix_ssh)
- sed -i 's/^\(UsePAM\) yes/\1 no/' /etc/ssh/sshd_config
- TARBALLS+=" root"
-
- action="done"
- esac
-
-fi
-
-if [ "$MODE_HW" ]; then
-
- conf=/etc/default/shutdownallblades
-
- title "change shutdownallblades"
- if $(grep -sq '^#*REBOOT=' $conf); then
- case "$MODE_HW" in
- hw_ibm) check sed -i 's/^#*REBOOT=.*$/#REBOOT=yes/' $conf;;
- hw_supermicro) check sed -i 's/^#*REBOOT=.*$/REBOOT=yes/' $conf;;
- esac
- else
- case "$MODE_HW" in
- hw_ibm) check sed -i '$a#REBOOT=yes' $conf;;
- hw_supermicro) check sed -i '$aREBOOT=yes' $conf;;
- esac
- fi
-
- action="done"
-fi
-
-if [ "$MODE_NET" ]; then
-
- conf=/etc/dhcp/dhcpd.conf
-
- title "update network configuraton"
- if $(grep -sq 'trc[0-9]*_1' $conf); then
- check sed -i 's/\(host.*trc[0-9][0-9]\)\([^_]\)/\1-rf\2/;s/\(host.*trc[0-9][0-9]\)_1/\1/' $conf
- fi
- TARBALLS+=" root"
-
- action="done"
-fi
-
-if [ "$MODE_TZ" ]; then
- case "$MODE_TZ" in
- tz_paris) TZ="Europe/Paris";;
- tz_zulu) TZ="Etc/Zulu";;
- *) TZ="";;
- esac
-
- if [ "$TZ" ]; then
- echo $TZ > /etc/timezone
- TARBALLS+=" root"
-
- action="done"
- fi
-fi
-
-# last check
-[ "$action" ] || { echo "no mode specified"; exit 1; }
-
-[ "$TARBALLS" ] && make -f /opt/cluster/Makefile $TARBALLS
-
-# vim:set tabstop=4 expandtab shiftwidth=4:
+++ /dev/null
-#!/bin/bash
-#
-# ============================================================================
-#
-# Copyright (C) THALES. All rights reserved
-# Author: Alexandre Cazalis
-#
-# Gestion attente lames esclaves au boot (ping,ssh)
-#
-# 2013-11-20 : V1.2 LMa
-# - Ajout de la personalisation de la commande a executer
-# par defaut (uptime). Ajout attente montage nfs avant demarrage
-# 2014-05-28 : V1.3 LMa
-# - Ajout d'un mode foreground pour ne tenter qu'une fois chaque commande
-# - Ajout d'une commande pour exclude la lame maitre
-#
-# 2014-10-28 : Change owner
-# ============================================================================
-
-# TODO
-# *
-
-CMD="uptime"
-MODE="iter"
-PROGNAME=$(basename $0)
-VER=1.3
-EXCLUDE="___"
-
-function usage () {
- echo "usage: $PROGNAME [-c command] [-h] [-i] [-o] [-t seconds] [-v] [-w] [-x] host1 host2..."
- echo " -c: set command (default '$CMD')"
- echo " -h: help message"
- echo " -i: infinity loop mode [default]"
- echo " -o: only try ones"
- echo " -t: timeout"
- echo " -v: version message"
- echo " -w: wait mode"
- echo " -x: avoid master blade"
- exit $@
-}
-
-while [ $# -gt 0 ]; do
- case "$1" in
- -c) shift; CMD=$1;;
- -h) usage 0;;
- -i) MODE="iter";;
- -o) MODE="ones";;
- -t) shift; [[ "$1" =~ [^0-9] ]] && { echo "incorrect timeout ($1)"; exit 1;}; TIMEOUT=$1;;
- -v) echo "$PROGNAME: version $VER"; exit;;
- -w) MODE="wait";;
- -x) EXCLUDE="trc00";;
- *) list+=" "$1;;
- esac
- shift
-done
-
-# list
-[ "$list" ] || list=$(awk '{sub(/#.*/, "")} /trc[0-9][0-9]/ && ! /-rf/ {print $2}' /etc/hosts)
-list=$(echo $list" "|sed s/$EXCLUDE//)
-
-# timeout
-if [ "$TIMEOUT" ]; then
- trap "echo 'timeout expired (${TIMEOUT}s)'; exit 0;" SIGVTALRM
- ( sleep $TIMEOUT; kill -SIGVTALRM $$ 2>/dev/null; [ $? -eq 0 ] && rc=1 || rc=0; exit $rc) &
-fi
-trap "exit 0;" SIGINT
-
-# main loop
-while true; do
- for host in $list; do
- stat=0
- echo -n ${host}:" "
- ping -c 1 $host >&/dev/null && { ssh -t -o ConnectTimeout=1 root@$host "$CMD" 2>/dev/null && stat=1 || echo "soon..."; } || echo
- [ "$MODE" = "wait" -a $stat -eq 1 ] && list=${list/$host }
- done
- [ "$MODE" = "ones" ] && break;
- [[ "$list" =~ [a-zA-Z0-9_-] ]] && sleep 1 || break;
-done
+++ /dev/null
-#!/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=/opt/trc6500/script
-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:
+++ /dev/null
-#!/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:
+++ /dev/null
-#!/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:
+++ /dev/null
-#!/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:
+++ /dev/null
-#!/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:
+++ /dev/null
-#!/usr/bin/perl
-
-open PROC_STAT, "</proc/stat";
-my @proc_stat=<PROC_STAT>;
-close PROC_STAT;
-my @cpu_stat_t0 = grep {s/^cpu\d+\s//} (@proc_stat);
-sleep 1;
-open PROC_STAT, "</proc/stat";
-my @proc_stat=<PROC_STAT>;
-close PROC_STAT;
-my @cpu_stat_t1 = grep {s/^cpu\d+\s//} (@proc_stat);
-
-my $total = 0;
-for (my $cpu_i=0; $cpu_i<(scalar @cpu_stat_t0); $cpu_i++) {
- my @stat_t0 = split /\s+/, $cpu_stat_t0[$cpu_i];
- my @stat_t1 = split /\s+/, $cpu_stat_t1[$cpu_i];
- my ($t0_idle, $t1_idle) = ($stat_t0[3], $stat_t1[3]);
- my ($t0_total, $t1_total) = (0, 0);
- $t0_total += $_ foreach @stat_t0;
- $t1_total += $_ foreach @stat_t1;
-
- my $load = ($t1_total - $t0_total == 0) ? 100: int((100 * (($t1_total - $t0_total) - ($t1_idle - $t0_idle))/($t1_total - $t0_total)) + 0.5);
- print " +" unless ($cpu_i == 0);
- printf "% 5.1f%% ", $load;
- $total += $load;
-}
-printf " = % 6.1f%%\n", $total;
+++ /dev/null
-#!/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=/opt/trc6500/script
-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:
+++ /dev/null
-#!/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:
+++ /dev/null
-# -*- Makefile -*-
-
-DIR = master-files/
-
-CONFIGDIR = debian/
-
-FILES = $(shell cd $(DIR); find etc/ -type f)
-
-TARGET = $(MODULE)_$(VERSION)_$(ARCH).deb
-
-OBJECTS = deb/DEBIAN/preinst \
- deb/DEBIAN/postrm \
- deb/DEBIAN/postinst \
- deb/opt/trc6500/script
-
-SHELL=/bin/bash
-MODULE = trc6500-master-files
-ARCH = all
-
-.DEFAULT: all
-.PHONY: clean deb all
-
-VERSION = $(shell awk '/^$(MODULE)/ { gsub(/[()]/, ""); print $$2; exit }' debian/debian-changelog)
-
-
-all: $(TARGET) deb
-
-clean:
- rm -rf deb $(OBJECTS) $(TARGETS)
-
-deb:
- rm -rf deb
- mkdir --parent deb/etc/webconfig/ deb/etc/default/ deb/DEBIAN
-
-deb/DEBIAN/preinst: debian/debian-preinst deb $(addprefix $(DIR)/, $(FILES)) $(MAKEFILE_LIST)
- rm -f $@
- cat $< > $@~
- for f in $(FILES); do echo '[ -f "/'$$f'" ] && dpkg-divert --add /'$$f; done >>$@~
- echo "exit 0" >>$@~
- chmod +x $@~
- mv $@~ $@
-
-deb/DEBIAN/postrm: debian/debian-postrm deb $(addprefix $(DIR)/, $(FILES)) $(MAKEFILE_LIST)
- rm -f $@
- cat $< > $@~
- for f in $(FILES); do echo '[ -f "/'$$f'" ] && dpkg-divert --remove /'$$f; done >>$@~
- echo "exit 0" >>$@~
- chmod +x $@~
- mv $@~ $@
-
-deb/DEBIAN/postinst: debian/debian-postinst deb
- cp $< $@
-
-deb/opt/trc6500/script: ../additional_scripts deb
- mkdir -p deb/opt/trc6500/script/
- cp ../additional_scripts/* deb/opt/trc6500/script/
-
-$(TARGET): deb $(OBJECTS)
- sed s/@@version@@/$(VERSION)/ debian/debian-control > deb/DEBIAN/control
- mkdir -p deb/usr/share/doc/$(MODULE)
- cp debian/debian-changelog deb/usr/share/doc/$(MODULE)/changelog
- cp -r $(DIR)/* deb/
- fakeroot dpkg --build deb
- mv deb.deb $@
+++ /dev/null
-trc6500-master-files (7.8.2-1) unstable; urgency=low
-
- * Keep standard 30MHzDF and adds the lite configuration
-
- -- Thomas Pérennou <thomas.perennou@external.thalesgroup.com> Mon, 22 Jun 2015 15:15:16 +0200
-
-trc6500-master-files (7.8.1-1) unstable; urgency=low
-
- * .deb packaging
-
- -- Olivier Leobal <olivier.leobal@thalesgroup.com> Wed, 10 Jun 2015 14:16:08 +0200
-
-trc6500-master-files (7.8.0-1) unstable; urgency=low
-
- * initial release (#1337)
- * added scripts from lgcore
- * getswitchtemp fix
- * inetd removal
-
- -- Olivier Leobal <olivier.leobal@thalesgroup.com> Wed, 10 Jun 2015 12:46:08 +0200
+++ /dev/null
-Section: TRC6500
-Priority: important
-Version: @@version@@
-Architecture: all
-Package: trc6500-master-files
-Maintainer: Olivier Léobal <olivier.leobal@thalesgroup.com>
-Description: files for the TRC6500's computing cluster's operating system
- Contains mainly scripts and configuration files
-Homepage: http://www.thalesgroup.com/
+++ /dev/null
-#!/bin/bash
-
-# since equivs can't handle symlinks, here we are doing them by hand. As of writing this script (2015-05-29), there are 11 symlinks to take care of.
-
-# I don't know why things were that way before, but I'm told to set them that way again.
-echo 'Moving things around..'
-[ -h /home ] || mv /home /var/media/backup
-mkdir -p /var/media/backup/dump/{core,dump_delay_line,dump_track_base,log,prod,rec,trace}
-ln -sf /var/media/backup/dump /
-ln -sf /var/media/backup/home /
-ln -sf /var/media/backup/rec /
-ln -sf /var/media/prod /var/media/backup/
-ln -sf /etc/hosts.30MHzMDF /etc/hosts.30MHz
-ln -sf /etc/hosts.8MHzMHF /etc/hosts.8MHz
-ln -sf /usr/lib/syslinux/menu.c32 /opt/tftp/menu.c32
-ln -sf /initrd.img /opt/tftp/initrd.img
-ln -sf /vmlinuz /opt/tftp/vmlinuz
-ln -sf /usr/lib/syslinux/pxelinux.0 /opt/tftp/pxelinux.0
-ln -sf /usr/lib/syslinux/memdisk /opt/tftp/memdisk
-echo 'Things moved.'
-
-# now enable all the scripts and such..
-echo 'Enabling on-startup scripts..'
-update-rc.d waitswitches defaults
-update-rc.d waitswitches enable
-update-rc.d etherwake defaults
-update-rc.d etherwake enable
-update-rc.d ipmiwake defaults
-update-rc.d ipmiwake enable
-update-rc.d wakeonlan defaults
-update-rc.d wakeonlan enable
-update-rc.d waitslaves defaults
-update-rc.d shutdownallblades defaults
-update-rc.d checkudevrules enable
-update-rc.d checkudevrules defaults
-echo 'Scripts enabled.'
-
-# and these other things too
-echo 'Finalizing configuration..'
-chown webconfig /etc/webconfig/alias.csv /etc/dhcp/dhcpd.conf*
-cp /etc/dhcp/dhcpd.conf.blank /etc/dhcp/dhcpd.conf
-chsh -s /usr/bin/pdmenu trc6500
-
-# from that sync_master.sh script.. Apparently there from Git shenanigans.
-chmod go-rwx /root/.ssh/id_rsa
-chmod go-rwx /opt/cluster/slave/root/.ssh
-chmod go-rwx /opt/cluster/slave/root/.ssh/id_rsa
-chmod a+rwx /opt/tftp
-
-echo "">/var/log/atftpd.log
-chown nobody /var/log/atftpd.log
-
-update-initramfs -u
-
-cd /opt/cluster
-# now this file is locked away during install and replaced by a dummy. So we put a duplicate of this in a script executed on first boot after the install.
-# this is still here because it is planned we install/update this on established systems
-[ -f /sbin/start-stop-daemon.REAL ] || make all
-echo 'Finalized.'
-
-
+++ /dev/null
-#!/bin/sh
-
-# list of diverts
+++ /dev/null
-#!/bin/bash
-
-# list of diverts
+++ /dev/null
-../../master/
\ No newline at end of file
+++ /dev/null
-This puts things and thongs together to get us a makeshift Debian package. Copied from the same in lgcore6500(git repo)/dev/services/webconfig. Use with caution.
-
-
-** How to use
-
-edit things in /debian, notably the control file
-
-edit the Makefile to include the files you want to include (ie, here, the master-files directory which is simply the "master" folder in the debian6500 git repo, without the symlinks)
-
-pray "make" will do the job
-
-
-** What files we need
-
-Everything in the debian/ folder, ie control, preinst, postinst and the like.
-Obviously they are not required for a _debian_ package but for _ours_ they are
-
-the ../additional_scripts folder. Please, please don't trash it away. These scripts come from the lgcore6500 repository, that's why they're no symlinks like for the master-files thing.
-
-
-** About versioning
-
-Let us say our package is version 7.8.1-1. This means it's the version 1 of the customization archive for Debian 7.8, hence 7.8.1. The -1 suffix is a package version, in theory it doesn't affect the contents, only how they're packaged.
-
-That's for version number. Remember also to list your changes in the debian-changelog in the debian/ folder ; it'll be useful to check the OS version on systems once it's installed.
+++ /dev/null
-** Introduction
-
-This uses the simple-cdd package (available on the official Debian repository) to create a custom install CD for the master blade of the TRC6500 system's computing cluster. A number of components are installed automatically (either during install or on first boot) ; the CD also includes useful files for subsequent configuration.
-
-
-** What the built CD includes
-
-- a selection of useful/required packages
-- a selection of custom packages scarcely available elsewhere
-- unpacking of config files and scripts during install
-- automatic execution of some configuration options
-
-This CD does NOT create an usable operating system. All included systems should be reviewed, but particularly the network configuration (/etc/hosts, DHCP config, TFTP config..), which is partly automated thanks to scripts provided by the TRC6500 exploitation software, which is NOT bundled with this CD.
-
-
-** What files we'll be using
-
-- simple-cdd.conf (name is clear enough) should be passed to the build-simple-cdd program
-- the entire profiles/ directory is used by build-simple-cdd
-- myrc.local is the script executed on first boot
-- the local_packages/ directory contains packages not available on the regular repository, or more recent versions of packages available there.
-- the additional_scripts/ directory contains useful scripts included in the trc6500-master-files deb archive, in the /opt/trc6500/script/ folder.
-- the deb_build/ folder contains the necessary stuff to build the trc6500-master-files deb package which contains a collection of scripts, config files and config instructions
-- TRC6500.pub is a GPG public key added to the OS's keyring during install, corresponding to a makeshift Debian repo from T. Pérennou
-- splash-thales.png is a 640*480 image used for the splashscreen
-
-
-** How build-simple-cdd works
-
-The build-simple-cdd program is to be called like this :
-build-simple-cdd --dist wheezy --conf ./simple-cdd.conf
-
-Most options described in the documentation are included in the simple-cdd.conf file. The program will use those (in addition to the default settings) to build a list of what is to be included on the CD. Primarily, it includes itself, profile(s) scripts, and pulls packages (from the <profile>.packages list) from whatever repositories are in /etc/apt/sources.list, or from the ./tmp folder if the packages have already been fetched.
-
-Additional packages are to be put in the local_packages directory (which is specified in our own simple_cdd.conf). It should be noted that packages placed there simply join the pool of available packages : to actually include them on the CD, they should be added in an itself included profile's packages list (say, profiles/trc6500.packages). The list of packages added this way is :
-cpumon dce firmware-bnx2 libcalloc1 libcycle1 libdebug1 libmcore1 raf swb webconfig xcfe
-
-Additional files are included with the all_extras="<path>,<path>" option in our simple-cdd.conf file.
-
-You should look into the provided simple-cdd.conf file ! It is tailored to a quite specific use case, and making your own should be easy enough since the simple-cdd package contains a detailed config file.
-
-
-** Building the trc6500-master-files deb packages
-
-This package has been put together in replacement of an earlier tarball ; the main benefit to using a deb being easier upgrade of existing systems.
-
-Check out the deb_build/ folder to learn more ; most of it is done by the Makefile.
-
-
-** Regarding install vectors
-
-To set up a bootable USB key :
-cp <iso file> /dev/<key> && sync
-<key> should be the device, not a partition of it. The key will get partitioned like the CD (and how the CD is partitioned is a whole other topic).
-
-To burn your ISO to a CD :
-xorriso -as cdrecord -v dev=/dev/sr0 blank=as_needed <iso file>
-
-
-** Additional documentation
-/usr/share/simple-cdd
-/usr/share/doc/simple-cdd
-/usr/share/doc/installation-guide-amd64 (talks about preseeds)
-
--- /dev/null
+** Introduction
+
+This uses the simple-cdd package (available on the official Debian repository) to create a custom install CD for the master blade of the TRC6500 system's computing cluster. A number of components are installed automatically (either during install or on first boot) ; the CD also includes useful files for subsequent configuration.
+
+
+** What the built CD includes
+
+- a selection of useful/required packages
+- a selection of custom packages scarcely available elsewhere
+- unpacking of config files and scripts during install
+- automatic execution of some configuration options
+
+This CD does NOT create an usable operating system. All included systems should be reviewed, but particularly the network configuration (/etc/hosts, DHCP config, TFTP config..), which is partly automated thanks to scripts provided by the TRC6500 exploitation software, which is NOT bundled with this CD.
+
+
+** What files we'll be using
+
+- simple-cdd.conf (name is clear enough) should be passed to the build-simple-cdd program
+- the entire profiles/ directory is used by build-simple-cdd
+- myrc.local is the script executed on first boot
+- the local_packages/ directory contains packages not available on the regular repository, or more recent versions of packages available there.
+- the deb_build/ folder contains the necessary stuff to build the trc6500-master-files deb package which contains a collection of scripts, config files and config instructions
+- TRC6500.pub is a GPG public key added to the OS's keyring during install, corresponding to a makeshift Debian repo from T. Pérennou
+- splash-thales.png is a 640*480 image used for the splashscreen
+
+
+** How build-simple-cdd works
+
+The build-simple-cdd program is to be called like this :
+build-simple-cdd --dist wheezy --conf ./simple-cdd.conf
+
+Most options described in the documentation are included in the simple-cdd.conf file. The program will use those (in addition to the default settings) to build a list of what is to be included on the CD. Primarily, it includes itself, profile(s) scripts, and pulls packages (from the <profile>.packages list) from whatever repositories are in /etc/apt/sources.list, or from the ./tmp folder if the packages have already been fetched.
+
+Additional packages are to be put in the local_packages directory (which is specified in our own simple_cdd.conf). It should be noted that packages placed there simply join the pool of available packages : to actually include them on the CD, they should be added in an itself included profile's packages list (say, profiles/trc6500.packages). The list of packages added this way is :
+cpumon dce firmware-bnx2 libcalloc1 libcycle1 libdebug1 libmcore1 raf swb webconfig xcfe
+
+Additional files are included with the all_extras="<path>,<path>" option in our simple-cdd.conf file.
+
+You should look into the provided simple-cdd.conf file ! It is tailored to a quite specific use case, and making your own should be easy enough since the simple-cdd package contains a detailed config file.
+
+
+** Building the trc6500-master-files deb packages
+
+This package has been put together in replacement of an earlier tarball ; the main benefit to using a deb being easier upgrade of existing systems.
+
+Check out the deb_build/ folder to learn more ; most of it is done by the Makefile.
+
+
+** Regarding install vectors
+
+To set up a bootable USB key :
+cp <iso file> /dev/<key> && sync
+<key> should be the device, not a partition of it. The key will get partitioned like the CD (and how the CD is partitioned is a whole other topic).
+
+To burn your ISO to a CD :
+xorriso -as cdrecord -v dev=/dev/sr0 blank=as_needed <iso file>
+
+
+** Additional documentation
+/usr/share/simple-cdd
+/usr/share/doc/simple-cdd
+/usr/share/doc/installation-guide-amd64 (talks about preseeds)
+
--- /dev/null
+# -*- Makefile -*-
+
+DIR = ../master/
+
+CONFIGDIR = debian/
+
+FILES = $(shell cd $(DIR); find etc/ -type f)
+
+TARGET = ../$(MODULE)_$(VERSION)_$(ARCH).deb
+
+OBJECTS = deb/DEBIAN/preinst \
+ deb/DEBIAN/postrm \
+ deb/DEBIAN/postinst \
+ deb/opt/script
+
+SHELL=/bin/bash
+MODULE = $(shell basename `pwd`)
+ARCH = all
+
+.DEFAULT: all
+.PHONY: clean deb all
+
+VERSION = $(shell awk '/^$(MODULE)/ { gsub(/[()]/, ""); print $$2; exit }' debian/debian-changelog)
+
+
+all: $(TARGET) deb
+
+clean:
+ rm -rf deb $(OBJECTS) $(TARGETS)
+
+deb:
+ rm -rf deb
+ mkdir --parent deb/etc/webconfig/ deb/etc/default/ deb/DEBIAN
+
+deb/DEBIAN/preinst: debian/debian-preinst deb $(addprefix $(DIR)/, $(FILES)) $(MAKEFILE_LIST)
+ rm -f $@
+ cat $< > $@~
+ for f in $(FILES); do echo '[ -f "/'$$f'" ] && dpkg-divert --add /'$$f; done >>$@~
+ echo "exit 0" >>$@~
+ chmod +x $@~
+ mv $@~ $@
+
+deb/DEBIAN/postrm: debian/debian-postrm deb $(addprefix $(DIR)/, $(FILES)) $(MAKEFILE_LIST)
+ rm -f $@
+ cat $< > $@~
+ for f in $(FILES); do echo '[ -f "/'$$f'" ] && dpkg-divert --remove /'$$f; done >>$@~
+ echo "exit 0" >>$@~
+ chmod +x $@~
+ mv $@~ $@
+
+deb/DEBIAN/postinst: debian/debian-postinst deb
+ cp $< $@
+
+deb/opt/script: script deb
+ mkdir -p $@
+ cp $</* $@
+
+$(TARGET): deb $(OBJECTS)
+ sed s/@@version@@/$(VERSION)/ debian/debian-control > deb/DEBIAN/control
+ mkdir -p deb/usr/share/doc/$(MODULE)
+ cp debian/debian-changelog deb/usr/share/doc/$(MODULE)/changelog
+ cp -r $(DIR)/* deb/
+ fakeroot dpkg --build deb
+ mv deb.deb $@
--- /dev/null
+trc6500-master-files (7.8.3-1) unstable; urgency=low
+
+ *
+
+ -- Laurent Mazet <laurent.mazet@thalesgroup.com> Tue, 28 Jul 2015 14:02:50 +0200
+
+trc6500-master-files (7.8.2-1) unstable; urgency=low
+
+ * Keep standard 30MHzDF and adds the lite configuration
+
+ -- Thomas Pérennou <thomas.perennou@external.thalesgroup.com> Mon, 22 Jun 2015 15:15:16 +0200
+
+trc6500-master-files (7.8.1-1) unstable; urgency=low
+
+ * .deb packaging
+
+ -- Olivier Leobal <olivier.leobal@thalesgroup.com> Wed, 10 Jun 2015 14:16:08 +0200
+
+trc6500-master-files (7.8.0-1) unstable; urgency=low
+
+ * initial release (#1337)
+ * added scripts from lgcore
+ * getswitchtemp fix
+ * inetd removal
+
+ -- Olivier Leobal <olivier.leobal@thalesgroup.com> Wed, 10 Jun 2015 12:46:08 +0200
--- /dev/null
+Section: TRC6500
+Priority: important
+Version: @@version@@
+Architecture: all
+Package: trc6500-master-files
+Maintainer: Olivier Léobal <olivier.leobal@thalesgroup.com>
+Description: files for the TRC6500's computing cluster's operating system
+ Contains mainly scripts and configuration files
+Homepage: http://www.thalesgroup.com/
--- /dev/null
+#!/bin/bash
+
+# since equivs can't handle symlinks, here we are doing them by hand. As of writing this script (2015-05-29), there are 11 symlinks to take care of.
+
+# I don't know why things were that way before, but I'm told to set them that way again.
+echo 'Moving things around..'
+[ -h /home ] || mv /home /var/media/backup
+mkdir -p /var/media/backup/dump/{core,dump_delay_line,dump_track_base,log,prod,rec,trace}
+ln -sf /var/media/backup/dump /
+ln -sf /var/media/backup/home /
+ln -sf /var/media/backup/rec /
+ln -sf /var/media/prod /var/media/backup/
+ln -sf /etc/hosts.30MHzMDF /etc/hosts.30MHz
+ln -sf /etc/hosts.8MHzMHF /etc/hosts.8MHz
+ln -sf /usr/lib/syslinux/menu.c32 /opt/tftp/menu.c32
+ln -sf /initrd.img /opt/tftp/initrd.img
+ln -sf /vmlinuz /opt/tftp/vmlinuz
+ln -sf /usr/lib/syslinux/pxelinux.0 /opt/tftp/pxelinux.0
+ln -sf /usr/lib/syslinux/memdisk /opt/tftp/memdisk
+echo 'Things moved.'
+
+# now enable all the scripts and such..
+echo 'Enabling on-startup scripts..'
+update-rc.d waitswitches defaults
+update-rc.d waitswitches enable
+update-rc.d etherwake defaults
+update-rc.d etherwake enable
+update-rc.d ipmiwake defaults
+update-rc.d ipmiwake enable
+update-rc.d wakeonlan defaults
+update-rc.d wakeonlan enable
+update-rc.d waitslaves defaults
+update-rc.d shutdownallblades defaults
+update-rc.d checkudevrules enable
+update-rc.d checkudevrules defaults
+echo 'Scripts enabled.'
+
+# and these other things too
+echo 'Finalizing configuration..'
+chown webconfig /etc/webconfig/alias.csv /etc/dhcp/dhcpd.conf*
+cp /etc/dhcp/dhcpd.conf.blank /etc/dhcp/dhcpd.conf
+chsh -s /usr/bin/pdmenu trc6500
+
+# from that sync_master.sh script.. Apparently there from Git shenanigans.
+chmod go-rwx /root/.ssh/id_rsa
+chmod go-rwx /opt/cluster/slave/root/.ssh
+chmod go-rwx /opt/cluster/slave/root/.ssh/id_rsa
+chmod a+rwx /opt/tftp
+
+echo "">/var/log/atftpd.log
+chown nobody /var/log/atftpd.log
+
+update-initramfs -u
+
+cd /opt/cluster
+# now this file is locked away during install and replaced by a dummy. So we put a duplicate of this in a script executed on first boot after the install.
+# this is still here because it is planned we install/update this on established systems
+[ -f /sbin/start-stop-daemon.REAL ] || make all
+echo 'Finalized.'
+
+
--- /dev/null
+#!/bin/sh
+
+# list of diverts
--- /dev/null
+#!/bin/bash
+
+# list of diverts
--- /dev/null
+This puts things and thongs together to get us a makeshift Debian package. Copied from the same in lgcore6500(git repo)/dev/services/webconfig. Use with caution.
+
+
+** How to use
+
+edit things in /debian, notably the control file
+
+edit the Makefile to include the files you want to include (ie, here, the master-files directory which is simply the "master" folder in the debian6500 git repo, without the symlinks)
+
+pray "make" will do the job
+
+
+** What files we need
+
+Everything in the debian/ folder, ie control, preinst, postinst and the like.
+Obviously they are not required for a _debian_ package but for _ours_ they are
+
+the ../additional_scripts folder. Please, please don't trash it away. These scripts come from the lgcore6500 repository, that's why they're no symlinks like for the master-files thing.
+
+
+** About versioning
+
+Let us say our package is version 7.8.1-1. This means it's the version 1 of the customization archive for Debian 7.8, hence 7.8.1. The -1 suffix is a package version, in theory it doesn't affect the contents, only how they're packaged.
+
+That's for version number. Remember also to list your changes in the debian-changelog in the debian/ folder ; it'll be useful to check the OS version on systems once it's installed.
--- /dev/null
+#!/bin/bash
+# ============================================================================
+#
+# Copyright (C) THALES. All rights reserved
+# Author: Laurent Mazet
+#
+
+# Date : 10/10/2013
+#
+# 05/11/2013 : LMa configuration des timezone Zulu(GMT) et Paris
+# Desactivation de pam pour ssh
+# ============================================================================
+
+# Switch configuration
+
+# TODO
+# *
+
+MODE_BW=""
+MODE_FIX=""
+MODE_HW=""
+MODE_NET=""
+MODE_TZ=""
+TARBALLS=""
+PROGNAME=$(basename $0)
+VER=1.0
+TMPLOG=/tmp/$PROGNAME-$$.log
+
+# help function
+
+function usage () {
+ echo "usage: $PROGNAME <mode>"
+ echo " switch trc6500 mode"
+ echo " avaliable modes are:"
+ echo " - 8MHzMHF, 12MHzDF, 12MHzMDF, 30MHzMDF 30MHzMDF.lite or 30MHzMHF"
+ echo " - fix_ssh"
+ echo " - hw_ibm or hw_supermicro"
+ echo " - network"
+ echo " - tz_zulu or tz_paris"
+ 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"; }
+
+# check command
+
+function check () {
+ echo -n "$@: "
+ $@ 2>$TMPLOG && pass OK || { fail KO; cat $TMPLOG; exit 1; }
+ rm -f $TMPLOG
+}
+
+# argument processing
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -h) usage 0;;
+ 8mhz|8MHz|12mhzdf|12MHzDF|12mhzmdf|12MHzMDF|30mhzmdf|30MHzMDF|30mhzmdf.lite|30MHzMDF.lite|30mhzmhf|30MHzMHF) MODE_BW="${1^^}";;
+ fix_ssh) MODE_FIX="$1";;
+ hw_ibm|hw_supermicro) MODE_HW="$1";;
+ network) MODE_NET="$1";;
+ tz_paris|tz_zulu) MODE_TZ="$1";;
+ *) usage 1;;
+ esac
+ shift
+done
+
+# main process
+
+action=""
+
+if [ "$MODE_BW" ]; then
+ title "updating /etc/hosts"
+ MODE_BW=${MODE_BW/MHZ/MHz}
+ check rm -f /etc/hosts
+ check ln -s /etc/hosts.${MODE_BW/LITE/lite} /etc/hosts
+ TARBALLS+=" root"
+ for ip in 0A851{A,C}; do check ln -T -f -s default /opt/tftp/pxelinux.cfg/$ip; done
+ case "$MODE_BW" in
+ 8MHzMHF)
+ for ip in 0A851{A,C}A5; do check ln -T -f -s rec /opt/tftp/pxelinux.cfg/$ip; done
+ ;;
+ 12MHzDF) ;;
+ 12MHzMDF) ;;
+ 30MHzMDF) ;;
+ 30MHzMDF.lite)
+ check cp /etc/dhcp/dhcpd.conf.lite /etc/dhcp/dhcpd.conf
+ ;;
+ 30MHzMHF)
+ for ip in 0A851{A,C}A{1..6}; do check ln -T -f -s acq /opt/tftp/pxelinux.cfg/$ip; done
+ for ip in 0A851{A,C}A9; do check ln -T -f -s rec /opt/tftp/pxelinux.cfg/$ip; done
+ ;;
+ esac
+ action="done"
+fi
+
+if [ "$MODE_FIX" ]; then
+
+ case "$MODE_FIX" in
+ fix_ssh)
+ sed -i 's/^\(UsePAM\) yes/\1 no/' /etc/ssh/sshd_config
+ TARBALLS+=" root"
+
+ action="done"
+ esac
+
+fi
+
+if [ "$MODE_HW" ]; then
+
+ conf=/etc/default/shutdownallblades
+
+ title "change shutdownallblades"
+ if $(grep -sq '^#*REBOOT=' $conf); then
+ case "$MODE_HW" in
+ hw_ibm) check sed -i 's/^#*REBOOT=.*$/#REBOOT=yes/' $conf;;
+ hw_supermicro) check sed -i 's/^#*REBOOT=.*$/REBOOT=yes/' $conf;;
+ esac
+ else
+ case "$MODE_HW" in
+ hw_ibm) check sed -i '$a#REBOOT=yes' $conf;;
+ hw_supermicro) check sed -i '$aREBOOT=yes' $conf;;
+ esac
+ fi
+
+ action="done"
+fi
+
+if [ "$MODE_NET" ]; then
+
+ conf=/etc/dhcp/dhcpd.conf
+
+ title "update network configuraton"
+ if $(grep -sq 'trc[0-9]*_1' $conf); then
+ check sed -i 's/\(host.*trc[0-9][0-9]\)\([^_]\)/\1-rf\2/;s/\(host.*trc[0-9][0-9]\)_1/\1/' $conf
+ fi
+ TARBALLS+=" root"
+
+ action="done"
+fi
+
+if [ "$MODE_TZ" ]; then
+ case "$MODE_TZ" in
+ tz_paris) TZ="Europe/Paris";;
+ tz_zulu) TZ="Etc/Zulu";;
+ *) TZ="";;
+ esac
+
+ if [ "$TZ" ]; then
+ echo $TZ > /etc/timezone
+ TARBALLS+=" root"
+
+ action="done"
+ fi
+fi
+
+# last check
+[ "$action" ] || { echo "no mode specified"; exit 1; }
+
+[ "$TARBALLS" ] && make -f /opt/cluster/Makefile $TARBALLS
+
+# vim:set tabstop=4 expandtab shiftwidth=4:
--- /dev/null
+#!/bin/bash
+#
+# ============================================================================
+#
+# Copyright (C) THALES. All rights reserved
+# Author: Alexandre Cazalis
+#
+# Gestion attente lames esclaves au boot (ping,ssh)
+#
+# 2013-11-20 : V1.2 LMa
+# - Ajout de la personalisation de la commande a executer
+# par defaut (uptime). Ajout attente montage nfs avant demarrage
+# 2014-05-28 : V1.3 LMa
+# - Ajout d'un mode foreground pour ne tenter qu'une fois chaque commande
+# - Ajout d'une commande pour exclude la lame maitre
+#
+# 2014-10-28 : Change owner
+# ============================================================================
+
+# TODO
+# *
+
+CMD="uptime"
+MODE="iter"
+PROGNAME=$(basename $0)
+VER=1.3
+EXCLUDE="___"
+
+function usage () {
+ echo "usage: $PROGNAME [-c command] [-h] [-i] [-o] [-t seconds] [-v] [-w] [-x] host1 host2..."
+ echo " -c: set command (default '$CMD')"
+ echo " -h: help message"
+ echo " -i: infinity loop mode [default]"
+ echo " -o: only try ones"
+ echo " -t: timeout"
+ echo " -v: version message"
+ echo " -w: wait mode"
+ echo " -x: avoid master blade"
+ exit $@
+}
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -c) shift; CMD=$1;;
+ -h) usage 0;;
+ -i) MODE="iter";;
+ -o) MODE="ones";;
+ -t) shift; [[ "$1" =~ [^0-9] ]] && { echo "incorrect timeout ($1)"; exit 1;}; TIMEOUT=$1;;
+ -v) echo "$PROGNAME: version $VER"; exit;;
+ -w) MODE="wait";;
+ -x) EXCLUDE="trc00";;
+ *) list+=" "$1;;
+ esac
+ shift
+done
+
+# list
+[ "$list" ] || list=$(awk '{sub(/#.*/, "")} /trc[0-9][0-9]/ && ! /-rf/ {print $2}' /etc/hosts)
+list=$(echo $list" "|sed s/$EXCLUDE//)
+
+# timeout
+if [ "$TIMEOUT" ]; then
+ trap "echo 'timeout expired (${TIMEOUT}s)'; exit 0;" SIGVTALRM
+ ( sleep $TIMEOUT; kill -SIGVTALRM $$ 2>/dev/null; [ $? -eq 0 ] && rc=1 || rc=0; exit $rc) &
+fi
+trap "exit 0;" SIGINT
+
+# main loop
+while true; do
+ for host in $list; do
+ stat=0
+ echo -n ${host}:" "
+ ping -c 1 $host >&/dev/null && { ssh -t -o ConnectTimeout=1 root@$host "$CMD" 2>/dev/null && stat=1 || echo "soon..."; } || echo
+ [ "$MODE" = "wait" -a $stat -eq 1 ] && list=${list/$host }
+ done
+ [ "$MODE" = "ones" ] && break;
+ [[ "$list" =~ [a-zA-Z0-9_-] ]] && sleep 1 || break;
+done
--- /dev/null
+#!/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:
--- /dev/null
+#!/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:
--- /dev/null
+#!/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:
--- /dev/null
+#!/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:
--- /dev/null
+#!/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:
--- /dev/null
+#!/usr/bin/perl
+
+open PROC_STAT, "</proc/stat";
+my @proc_stat=<PROC_STAT>;
+close PROC_STAT;
+my @cpu_stat_t0 = grep {s/^cpu\d+\s//} (@proc_stat);
+sleep 1;
+open PROC_STAT, "</proc/stat";
+my @proc_stat=<PROC_STAT>;
+close PROC_STAT;
+my @cpu_stat_t1 = grep {s/^cpu\d+\s//} (@proc_stat);
+
+my $total = 0;
+for (my $cpu_i=0; $cpu_i<(scalar @cpu_stat_t0); $cpu_i++) {
+ my @stat_t0 = split /\s+/, $cpu_stat_t0[$cpu_i];
+ my @stat_t1 = split /\s+/, $cpu_stat_t1[$cpu_i];
+ my ($t0_idle, $t1_idle) = ($stat_t0[3], $stat_t1[3]);
+ my ($t0_total, $t1_total) = (0, 0);
+ $t0_total += $_ foreach @stat_t0;
+ $t1_total += $_ foreach @stat_t1;
+
+ my $load = ($t1_total - $t0_total == 0) ? 100: int((100 * (($t1_total - $t0_total) - ($t1_idle - $t0_idle))/($t1_total - $t0_total)) + 0.5);
+ print " +" unless ($cpu_i == 0);
+ printf "% 5.1f%% ", $load;
+ $total += $load;
+}
+printf " = % 6.1f%%\n", $total;
--- /dev/null
+#!/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:
--- /dev/null
+#!/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: