add a script to update lgcore
authorLaurent Mazet <laurent.mazet@thalesgroup.com>
Tue, 23 Dec 2014 08:52:03 +0000 (09:52 +0100)
committerLaurent Mazet <laurent.mazet@thalesgroup.com>
Tue, 23 Dec 2014 08:52:03 +0000 (09:52 +0100)
master/etc/sudoers.d/pdmenu
master/etc/sudoers.d/webconfig
master/etc/webconfig/alias.csv
master/root/bin/change_lgcore.sh [new file with mode: 0755]

index 53c247d8cacdca3c897d10962b261c02ee059967..789fdd919e57462dd36b52128c0e438e5a0e1a42 100644 (file)
@@ -5,3 +5,7 @@ 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/trc6500/script/change_configuration.sh *
+trc6500        ALL = (root)NOPASSWD: /root/bin/change_lgcore.sh *
+
index b0216510e89dc0497df5a3da4346dff5d2827467..4f15b4de27d3db4a2b8988279ad51ab088540b05 100644 (file)
@@ -5,3 +5,6 @@ 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/trc6500/script/change_configuration.sh *
+webconfig      ALL = (root)NOPASSWD: /root/bin/change_lgcore.sh *
index 05a7fdcf5884f69757ba623530da30dd687c3547..47561f6c5a4cfb016db393c9602395c900ca7af7 100644 (file)
 /gonext_ce/cfg;/usr/share/xcfe/cfg;/etc/webconfig/gonext.csv;;
 /trc6500_ce;/usr/share/xcfe;/opt/trc6500/etc/trc6500_config.xml;TRC6500 Configuration Editor;sudo service trc6500 restart
 /trc6500_ce/cfg;/usr/share/xcfe/cfg;/etc/webconfig/trc6500.csv;;
-;;;TRC6500 maintenance action;
+;;;TRC6500 maintenance actions;
 trc6500;/usr/share/webconfig;;Restart TRC6500;sudo service trc6500 restart
 start_active_phase;/usr/share/webconfig;;Start active phase;/opt/trc6500/bin/start_active_phase
 stop;/usr/share/webconfig;;Stop active phase;/opt/trc6500/bin/stop_active_phase
 halt;/usr/share/webconfig;;Shutdown TRC6500;sudo halt
-;;;FE306 maintenance action;
+;;;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
-;;;Matrix maintenance action;
+;;;Matrix maintenance actions;
 maxtrix;/usr/share/webconfig;;Configure matrix;/opt/trc6500/script/configure_matrix
 ;;;Switch maintenance actions;
 swg1-boot;/usr/share/webconfig;;Bootstrap switch SWG1;/opt/trc6500/script/configure_switch_bootstrap swg1
@@ -56,4 +56,19 @@ ammwake;/usr/share/webconfig;;Power on all HS22 IBM slaves;sudo service ammwake
 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 -1 && /opt/trc6500/script/set_mediatray amm01 -b -1
+;;;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
+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 IBM HS22 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
+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
+install-file;/usr/share/webconfig;;Install LgCore from local file;sudo /root/bin/change_lgcore.sh file -r /var/cache/webconfig
diff --git a/master/root/bin/change_lgcore.sh b/master/root/bin/change_lgcore.sh
new file mode 100755 (executable)
index 0000000..24c2da8
--- /dev/null
@@ -0,0 +1,90 @@
+#!/bin/bash
+# ============================================================================
+#
+# Copyright (C) THALES. All rights reserved
+# Author: Laurent Mazet
+#
+# Date : 17/12/2014
+# ============================================================================
+
+# Install new lgcore delivery
+
+# TODO
+# *
+
+MODE=
+PROGNAME=$(basename $0)
+REPOSITORY="/opt/trc6500/debian-rep"
+TMPLOG=/tmp/$PROGNAME-$$.log
+VER=1.0
+
+# help function
+
+function usage () {
+  echo "usage: $PROGNAME [-h] [-r dir] [-v] <mode>"
+  echo "  install new version from lgcore delivery from"
+  echo "  - usb: usb key slotted on master blade"
+  echo "  - file: file stored in a special repository"
+  echo
+  echo " options are:"
+  echo " -h: help message"
+  echo " -r: change repository (default is $REPOSITORY)"
+  echo " -v: version"
+  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;;
+    -r) shift; REPOSITORY=$1;;
+    -v) echo "$PROGNAME version $VER"; exit 0;;
+    file|usb) MODE=$1;;
+    *) usage 1;;
+    esac
+    shift
+done
+
+# check mode
+
+[ "$MODE" ] || { fail "need mode (file or usb)"; exit 1; }
+
+# check repository
+
+DIR=
+case "$MODE" in
+file) DIR=$REPOSITORY;;
+usb)
+    DIR=/media/floppy0
+    check mount /dev/sdb1 $DIR
+    trap "umount $DIR;" 0 1 2 15
+esac
+
+# look for file
+
+echo -n "look for delivery file: "
+LIV=$(find $DIR -name liv\*.sfx 2>$TMPLOG | sort | tail -1)
+[ -f "$LIV" ] && pass OK || { fail KO; cat $TMPLOG; exit 1; }
+rm -f $TMPLOG
+
+# install lgcore delivery
+
+check bash $LIV
+
+# vim:set tabstop=4 expandtab shiftwidth=4: