diff --git a/etc/install/rcg_stand_upgrade.sh b/etc/install/rcg_stand_upgrade.sh new file mode 100755 index 0000000000000000000000000000000000000000..ed1b2bfe98fcd7c44a6feccd059b94691bd8b1d0 --- /dev/null +++ b/etc/install/rcg_stand_upgrade.sh @@ -0,0 +1,241 @@ +#!/usr/bin/env bash +# +# script rcg_upgrade.sh - Upgrade RCG on front-end to 2.4 +# +# save current location +thisDir=`pwd` +rcgTag="2.4.1" +# +echo "RCG "${rcgTag}" upgrade to stand-alone front-end" +tmpFold=/var/tmp/RCG_Update +progFile=${tmpFold}/upgrade_progress.txt +if [ -f ${progFile} ]; then + echo "Resume upgrade" +else + while true; do + read -p "Do you want to proceed with the install?" yn + case $yn in + [Yy]* ) break;; + [Nn]* ) exit;; + * ) "Please answer yes or no";; + esac + done +# + mkdir -p ${tmpFold} + rm -rf ${tmpFold}/* + touch ${progFile} +fi +# +# check if downloads complete +# +downDone=`grep DownloadDone ${progFile}` +cfgTar=cdscfg-2_4.tar.gz +echo 'downDone' $downDone +if [ -z "$downDone" ]; then + echo "Downloading files using Kerberos login" + kname=`klist | grep Default` + if [ -z "$kname" ]; then + echo "Kerberos login not set - restart after doing kinit <albert.einstein>@LIGO.ORG" + exit + else + echo "kinit is good" + fi +# + webDir="https://llocds.ligo-la.caltech.edu/daq/software/upgrades" + downCfg=`grep DownloadCfg ${progFile}` + if [ -z "$downCfg" ]; then + echo "Download new environment configuration" + rm -f ${tmpFold}/${cfgTar} + curl --krb private ${webDir}/${cfgTar} > ${tmpFold}/${cfgTar} -u : + echo "DownloadCfg" `date` >> ${progFile} + else + echo "Download new environment configuration - ALREADY DONE" + fi +# + echo "DownloadDone" `date` >> ${progFile} +else + echo "Downloading files using Kerberos login - ALREADY DONE" +fi +# +# copy scripts +cpScrDone=`grep CopyScr ${progFile}` +scrDir=${tmpFold}/scripts +if [ -z "$cpScrDone" ]; then + echo "Copy install scripts to work area" + mkdir -p ${scrDir} + cp ${thisDir}/scripts/* ${scrDir} + echo "CopyScr" `date` >> ${progFile} +else + echo "Copy install scripts to work area - ALREADY DONE" +fi +# +# get list of models +mdlListDone=`grep GenModelList ${progFile}` +if [ -z "$mdlListDone" ]; then + ${scrDir}/gen_model_list.sh ${scrDir} + echo "GenModelList" `date` >> ${progFile} +else + echo "Get lists of models - ALREADY DONE" +fi +# +# Create EPICS snapshots +epicsBkupDone=`grep EpicsBackup ${progFile}` +if [ -z "$epicsBkupDone" ]; then + ${scrDir}/backup_epics.sh ${scrDir} + echo "EpicsBackup" `date` >> ${progFile} +else + echo "Create EPICS shapshots - ALREADY DONE" +fi +# +# Kill DAQ processes +daqKillDone=`grep DaqKilled ${progFile}` +if [ -z "$daqKillDone" ]; then + ${scrDir}/kill_daq.sh + echo "DaqKilled" `date` >> ${progFile} +else + echo "Kill DAQD,NDS - ALREADY DONE" +fi +# +# Stop sub-models +subStopDone=`grep SubStop ${progFile}` +if [ -z "$subStopDone" ]; then + ${scrDir}/stop_sub.sh ${scrDir} + echo "SubStop" `date` >> ${progFile} +else + echo "Stop sub-models - ALREADY DONE" +fi +# +# Stop IOP models +iopStopDone=`grep IopStop ${progFile}` +if [ -z "$iopStopDone" ]; then + ${scrDir}/stop_iops.sh ${scrDir} + echo "IopStop" `date` >> ${progFile} +else + echo "Stop IOP models - ALREADY DONE" +fi +# +# move and update userapps +appMoveDone=`grep UserAppMove ${progFile}` +if [ -z "$appMoveDone" ]; then + ${scrDir}/move_userapps.sh + echo "UserAppMove" `date` >> ${progFile} +else + echo "Move userapps to /opt/rtcds/userapps - ALREADY DONE" +fi +# +# Copy RCG to /opt/rtcds/rtscore +cpRcgDone=`grep CopyRcg ${progFile}` +rcgDir=/opt/rtcds/rtscore +if [ -z "$cpRcgDone" ]; then + echo "Copy this RCG in /opt/rtcds/rtscore" + mkdir -p ${rcgDir} + rcgPath=${thisDir%%/etc/install} + cp -Rp ${rcgPath} ${rcgDir} + rcgPtr=${rcgPath##/*/} + cd ${rcgDir} + rm -f release + ln -s ${rcgPtr} release + cd ${thisDir} + echo "CopyRcg" `date` >> ${progFile} +else + echo "Copy this RCG to /opt/rtcds/rtscore - ALREADY DONE" +fi +# +# install new cfg +cfgUpdateDone=`grep CfgUpdate ${progFile}` +if [ -z "$cfgUpdateDone" ]; then + echo "Install new cdscfg" + cd ${tmpFold} + tar -xzf ${cfgTar} + cd cdscfg/install + ./cfg_fe.sh + cd ${thisDir} + echo "CfgUpdate" `date` >> ${progFile} + echo "Now log out and log back in, then rerun this script to continue" +else + echo "Install new cdscfg - ALREADY DONE" +fi +# install new mbuf +# +mbufUpdateDone=`grep MbufUpdate ${progFile}` +if [ -z "$mbufUpdateDone" ]; then + ${scrDir}/new_mbuf.sh + echo "MbufUpdate" `date` >> ${progFile} +else + echo "Update mbuf - ALREADY DONE" +fi + +# install new awgtpman +awgTpUpdateDone=`grep AwgTpUpdate ${progFile}` +if [ -z "$awgTpUpdateDone" ]; then + ${scrDir}/new_awgtpman.sh ${rcgTag} + echo "AwgTpUpdate" `date` >> ${progFile} +else + echo "Update awgtpman - ALREADY DONE" +fi + +# install new real-time dataviewer +dvUpdateDone=`grep DvUpdate ${progFile}` +if [ -z "$dvUpdateDone" ]; then + ${scrDir}/new_dv.sh ${rcgTag} + echo "DvUpdate" `date` >> ${progFile} +else + echo "Update dataviewer - ALREADY DONE" +fi + +# create new build area +cfgRtBuildDone=`grep CfgRtBuild ${progFile}` +if [ -z "$cfgRtBuildDone" ]; then + echo "Configure real-time build area" + cd ${RTCDSROOT} + mkdir -p rtbuild + ${RCG_DIR}/configure + echo "CfgRtBuild" `date` >> ${progFile} +else + echo "Configure real-time build area - ALREADY DONE" +fi + +# Rebuild models +mdlBuildDone=`grep ModelBuild ${progFile}` +if [ -z "$mdlBuildDone" ]; then + ${scrDir}/remake_models.sh ${scrDir} + echo "ModelBuild" `date` >> ${progFile} +else + echo "Rebuild models with new RCG - ALREADY DONE" +fi + +# Rebuild stand-alone daqd +daqdBuildDone=`grep DaqdBuild ${progFile}` +if [ -z "$daqdBuildDone" ]; then + ${scrDir}/new_daqd.sh ${rcgTag} + echo "DaqdBuild" `date` >> ${progFile} +else + echo "Build new stand-alone daqd - ALREADY DONE" +fi + +# Rebuild nds +ndsBuildDone=`grep NdsBuild ${progFile}` +if [ -z "$ndsBuildDone" ]; then + ${scrDir}/new_nds.sh ${rcgTag} + echo "NdsBuild" `date` >> ${progFile} +else + echo "Build new nds - ALREADY DONE" +fi + +# Restart the models +mdlRestartDone=`grep ModelRestart ${progFile}` +if [ -z "$mdlRestartDone" ]; then + ${scrDir}/restart_models.sh ${scrDir} + echo "ModelRestart" `date` >> ${progFile} +else + echo "Restart models built with new RCG - ALREADY DONE" +fi + +# Restart DAQ, NDS +daqRestartDone=`grep DaqRestart ${progFile}` +if [ -z "$mdlRestartDone" ]; then + ${scrDir}/restart_daq.sh + echo "DaqRestart" `date` >> ${progFile} +else + echo "Restart DAQ built with new RCG - ALREADY DONE" +fi \ No newline at end of file diff --git a/etc/install/scripts/backup_epics.sh b/etc/install/scripts/backup_epics.sh new file mode 100755 index 0000000000000000000000000000000000000000..cfda0d182f8c54b92df62f8e6b8059e06503ee70 --- /dev/null +++ b/etc/install/scripts/backup_epics.sh @@ -0,0 +1,9 @@ +#!/bin/bash +source /opt/cdscfg/rtsetup.sh +cd /var/update +mkdir -p snapshots +for model in $(cat models/all_models.txt); do + snapFile=snapshots/${model}_backup.snap + reqFile=/opt/rtcds/${site}/${ifo}/target/${model}/${model}epics/autoBurt.req + burtrb -f ${reqFile} -o ${snapFile} +done diff --git a/etc/install/scripts/gen_model_list.sh b/etc/install/scripts/gen_model_list.sh new file mode 100755 index 0000000000000000000000000000000000000000..690ba0b09699f706bf23aebccd88e695ee258f2a --- /dev/null +++ b/etc/install/scripts/gen_model_list.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# script to get lists of models on test stand front-end +echo "Get lists of models" +# Were we passed UPDATE_DIR information on the command line? +if [ $# -gt 0 ]; then + UPDATE_DIR=$1 +else + if [ "$UPDATE_DIR" ]; then + UPDATE_DIR=${UPDATE_DIR} + else + UPDATE_DIR=/var/tmp/update + mkdir -p $UPDATE_DIR + fi +fi +mdlDir=${UPDATE_DIR}/models +mkdir -p ${mdlDir} +# +source /opt/cdscfg/rtsetup.sh +# +cd /opt/rtcds/${site}/${ifo}/target +# +ls -d ${ifo}* > ${mdlDir}/all_models.txt +echo "IOP models found:" +cat ${mdlDir}/all_models.txt | grep iop +cat ${mdlDir}/all_models.txt | grep iop > ${mdlDir}/iop_models.txt +# +echo "sub models found:" +cat ${mdlDir}/all_models.txt | grep -v iop +cat ${mdlDir}/all_models.txt | grep -v iop > ${mdlDir}/sub_models.txt \ No newline at end of file diff --git a/etc/install/scripts/kill_daq.sh b/etc/install/scripts/kill_daq.sh new file mode 100755 index 0000000000000000000000000000000000000000..d515035e2cccfdddedcef7ba8a9805edfde89eb2 --- /dev/null +++ b/etc/install/scripts/kill_daq.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +echo "Kill DAQD,NDS" +# remove DAQ from inittab and stop +sudo cp /etc/inittab /tmp/inittab0 +sudo cat /tmp/inittab0 | sed 's/fb:2345/#fb:2345/' > /tmp/inittab1 +sudo cat /tmp/inittab1 | sed 's/nds:2345/#nds:2345/' > /tmp/inittab2 +sudo cp /tmp/inittab2 /etc/inittab +sudo init q diff --git a/etc/install/scripts/move_userapps.sh b/etc/install/scripts/move_userapps.sh new file mode 100755 index 0000000000000000000000000000000000000000..7965eaec0536b4df9b1208c9ecaa327a2f08b0d5 --- /dev/null +++ b/etc/install/scripts/move_userapps.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +# script to re-locate userapps to /opt/rtcds +# +source /opt/cdscfg/rtsetup.sh +# +newHome=/opt/rtcds/userapps +newPath=${newHome}/release +if [ -d ${newHome} ]; then + echo "Userapps already moved to /opt/rtcds/userapps" + cd ${newHome} +else + mkdir -p ${newHome} + oldHome=/opt/rtcds/${site}/${ifo}/userapps + if [ -d ${oldHome} ]; then + echo "Move userapps to /opt/rtcds/userapps" + mv /opt/rtcds/${site}/${ifo}/userapps/* ${newHome} + cd ${newHome} + rm release + ln -s trunk release + else + echo "No userapps found - check out a fresh one" + appsSvn="https://redoubt.ligo-wa.caltech.edu/svn/cds_user_apps" + cd ${newHome} + svn co ${appsSvn} + ln -s cds_user_apps/trunk release + fi +fi +echo "Update userapps from cds_user_apps Subversion" +cd ${newHome} +svn update release + + diff --git a/etc/install/scripts/new_awgtpman.sh b/etc/install/scripts/new_awgtpman.sh new file mode 100755 index 0000000000000000000000000000000000000000..2a8c6b4ac39d6c60af90d810429d7f3779d3e83f --- /dev/null +++ b/etc/install/scripts/new_awgtpman.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# script to build new awgtpman +if [ $# -gt 0 ]; then + RCGTAG=$1 + echo " Build new awgtpman for RCG $RCGTAG" +else + echo " You need to add RCGTAG as input parameter" + exit +fi +# +source /opt/cdscfg/rtsetup.sh +# +cd ${RCG_DIR}/src/gds +make clean +make +cp -p awgtpman ${RTCDSROOT}/target/gds/bin/awgtpman-${RCGTAG} +cd ${RTCDSROOT}/target/gds/bin +mkdir -p bin_archive +mv awgtpman-${RCGTAG} bin_archive +cp -p awgtpman bin_archive/awgtpman-pre${RCGTAG} +cp -p bin_archive/awgtpman-${RCGTAG} awgtpman diff --git a/etc/install/scripts/new_daqd.sh b/etc/install/scripts/new_daqd.sh new file mode 100755 index 0000000000000000000000000000000000000000..9f36edf891cb36f9e8f2e9e512d316c1bca2db27 --- /dev/null +++ b/etc/install/scripts/new_daqd.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# script to build new daqd +if [ $# -gt 0 ]; then + RCGTAG=$1 + echo " Build new mbuf for RCG $RCGTAG" +else + echo " You need to add RCGTAG as input parameter" + exit +fi +# +source /opt/cdscfg/rtsetup.sh + +cdsCode +make standiop +cp -p build/standiop/daqd ${RTCDSROOT}/target/fb/daqd-${RCGTAG} +cd ${RTCDSROOT}/target/fb +mkdir -p bin_archive +mv daqd-${RCGTAG} bin_archive +cp -p daqd bin_archive/daqd-pre${RCGTAG} +cp -p bin_archive/daqd-${RCGTAG} daqd diff --git a/etc/install/scripts/new_dv.sh b/etc/install/scripts/new_dv.sh new file mode 100755 index 0000000000000000000000000000000000000000..94cc9cac744e2fe046a4957187d7fbaca769bee9 --- /dev/null +++ b/etc/install/scripts/new_dv.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# script to build new dataviewer +if [ $# -gt 0 ]; then + RCGTAG=$1 + echo " Build new dataviewer for RCG $RCGTAG" +else + echo " You need to add RCGTAG as input parameter" + exit +fi +# +source /opt/cdscfg/rtsetup.sh +# +cd /opt/rtapps +if [ -L dv ]; then + rm dv +elif [ -d dv ]; then + mv dv dv-pre${RCGTAG} +fi +# +cd ${RCG_DIR}/src/dv +make clean +make +make install +cd /opt/rtapps +mv dv dv-${RCGTAG} +ln -s dv-${RCGTAG} dv + diff --git a/etc/install/scripts/new_mbuf.sh b/etc/install/scripts/new_mbuf.sh new file mode 100755 index 0000000000000000000000000000000000000000..fff2fcac4612cd90c7c5418b5b1ede1888b8e686 --- /dev/null +++ b/etc/install/scripts/new_mbuf.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# script to build new mbuf +if [ $# -gt 0 ]; then + RCGTAG=$1 + echo " Build new mbuf for RCG $RCGTAG" +else + echo " You need to add RCGTAG as input parameter" + exit +fi +# +source /opt/cdscfg/rtsetup.sh + +cd ${RCG_DIR} +cd src/drv/mbuf +make +cd /lib/modules/2.6.34.1/kernel/drivers/mbuf +sudo bash -c "cp -p mbuf.ko mbuf.ko.old" +sudo bash -c "cp ${RCG_DIR}/src/drv/mbuf/mbuf.ko mbuf.ko.${RCGTAG}" +sudo bash -c "lsmod | grep mbuf && rmmod mbuf" +sudo bash -c "cp -p mbuf.ko.${RCGTAG} mbuf.ko" +sudo bash -c "insmod mbuf.ko" + diff --git a/etc/install/scripts/new_nds.sh b/etc/install/scripts/new_nds.sh new file mode 100755 index 0000000000000000000000000000000000000000..6eed6501e0b70038423b9bd1d7e3d407b8e194eb --- /dev/null +++ b/etc/install/scripts/new_nds.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# script to build new stand-alone NDS +if [ $# -gt 0 ]; then + RCGTAG=$1 + echo " Build new mbuf for RCG $RCGTAG" +else + echo " You need to add RCGTAG as input parameter" + exit +fi +# +source /opt/cdscfg/rtsetup.sh +# +cdsCode +make nds +cp -p build/nds/nds ${RTCDSROOT}/target/fb/nds-${RCGTAG} +cd ${RTCDSROOT}/target/fb +mkdir -p bin_archive +mv nds-${RCGTAG} bin_archive +cp -p nds bin_archive/nds-pre${RCGTAG} +cp -p bin_archive/nds-${RCGTAG} nds + + diff --git a/etc/install/scripts/remake_models.sh b/etc/install/scripts/remake_models.sh new file mode 100755 index 0000000000000000000000000000000000000000..847bb9aa558cfc31d4817fa2beff66c788028bed --- /dev/null +++ b/etc/install/scripts/remake_models.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# rebuild models with new RCG +echo "Rebuild models with new RCG" +# Were we passed UPDATE_DIR information on the command line? +if [ $# -gt 0 ]; then + UPDATE_DIR=$1 +else + if [ "$UPDATE_DIR" ]; then + UPDATE_DIR=${UPDATE_DIR} + else + UPDATE_DIR=/var/update +fi +mdlDir=${UPDATE_DIR}/models +# +source /opt/cdscfg/rtsetup.sh +# +cdsCode +# +for iopmodel in $(cat ${mdlDir}/iop_models.txt); do + make ${iopmodel} + make install-${iopmodel} +done +for model in $(cat ${mdlDir}/sub_models.txt); do + make ${model} + make install-${model} +done diff --git a/etc/install/scripts/restart_daq.sh b/etc/install/scripts/restart_daq.sh new file mode 100755 index 0000000000000000000000000000000000000000..4cc22bdc946a136699d1be0080bc7175383ac42b --- /dev/null +++ b/etc/install/scripts/restart_daq.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +# add DAQ to inittab and start +echo " Restart standalone DAQ, NDS" + +sudo cp /etc/inittab /tmp/inittab0 +sudo cat /tmp/inittab0 | sed 's/#fb:2345/fb:2345/' > /tmp/inittab1 +sudo cat /tmp/inittab1 | sed 's/#nds:2345/nds:2345/' > /tmp/inittab2 +sudo cp /tmp/inittab2 /etc/inittab +sudo init q diff --git a/etc/install/scripts/restart_models.sh b/etc/install/scripts/restart_models.sh new file mode 100755 index 0000000000000000000000000000000000000000..31aa8503f441c6e0144ee2c11b05f40f153cc6f9 --- /dev/null +++ b/etc/install/scripts/restart_models.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# restart models +echo "Restart models built with new RCG" +# Were we passed UPDATE_DIR information on the command line? +if [ $# -gt 0 ]; then + UPDATE_DIR=$1 +else + if [ "$UPDATE_DIR" ]; then + UPDATE_DIR=${UPDATE_DIR} + else + UPDATE_DIR=/var/update +fi +# +source /opt/cdscfg/rtsetup.sh +# +cd ${UPDATE_DIR} +for iopmodel in $(cat models/iop_models.txt); do + start${iopmodel} + snapFile=snapshots/${iopmodel}_backup.snap + burtwb -f ${snapFile} + start${iopmodel} +done +for model in $(cat models/sub_models.txt); do + start${model} + snapFile=snapshots/${model}_backup.snap + burtwb -f ${snapFile} + start${model} +done diff --git a/etc/install/scripts/stop_iops.sh b/etc/install/scripts/stop_iops.sh new file mode 100755 index 0000000000000000000000000000000000000000..04e7051c7b8b44f5d11ff05d5da3c03fcd100934 --- /dev/null +++ b/etc/install/scripts/stop_iops.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# stop IOP models +echo "Stop IOP models" +# allow input of update directory +if [ $# -gt 0 ]; then + UPDATE_DIR=$1 +else + if [ "$UPDATE_DIR" ]; then + UPDATE_DIR=${UPDATE_DIR} + else + UPDATE_DIR=/var/update +fi +# +source /opt/cdscfg/rtsetup.sh +# +cd ${UPDATE_DIR} +# +for model in $(cat models/iop_models.txt); do + kill${model} +done diff --git a/etc/install/scripts/stop_sub.sh b/etc/install/scripts/stop_sub.sh new file mode 100755 index 0000000000000000000000000000000000000000..345d5588e0daf63308a35a1230a160475995256e --- /dev/null +++ b/etc/install/scripts/stop_sub.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# stop sub-models +echo "Stop sub-models" +# allow input of update directory +if [ $# -gt 0 ]; then + UPDATE_DIR=$1 +else + if [ "$UPDATE_DIR" ]; then + UPDATE_DIR=${UPDATE_DIR} + else + UPDATE_DIR=/var/update +fi +# +source /opt/cdscfg/rtsetup.sh +# +cd ${UPDATE_DIR} +for model in $(cat models/sub_models.txt); do + kill${model} +done +