puppet/modules/rhizo_base/files/var/SysmoBTS/maint.sh
Keith Whyte 6a88c29144 BTS management:
Add a noupdate option to the opkg script to try
updating the packages without actually running an
update (maybe we already have the latest lists)

Tweak the maint and timing for it to temporarily push
fixed manager binary.

In opkg-1, install on BTS0 in order
to download the packages before copying them to the
local system.
2021-05-28 01:14:57 +02:00

71 lines
1.7 KiB
Bash

#!/bin/bash
# This script should be updated from time to time
# with nightly tasks for the BTS
# Consider when making modifications that
# running the script more than once is expected to be safe.
if [ "$PWD" != "/var/SysmoBTS" ]; then
OLDPWD=$PWD
cd /var/SysmoBTS
fi
SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/tmp/known-$RANDOM"
. /home/rhizomatica/bin/vars.sh
for bts in "${!BTS[@]}" ; do
scp $SSH_OPTS authorized_keys root@${BTS[$bts]}:/home/root/.ssh/
if [ "$?" != "0" ] ; then
echo "No ssh access to BTS?"
continue
fi
# Commands to run on all BTS:
# Nothing to do.
_modelNR=$(ssh $SSH_OPTS ${BTS[$bts]} sysmobts-util model-nr)
if [ "$?" == "127" ]; then
echo "No sysmobts-util?"
continue
fi
_trxNR=$(ssh $SSH_OPTS ${BTS[$bts]} sysmobts-util trx-nr)
if [ "$?" != "0" ] ; then
echo "TRX Number?"
continue
fi
if [ "$_modelNR" == "65535" ] && [ "$_trxNR" == "255" ] ; then
echo "Looks like a SysmoBTS"
# Nothing to do
fi
if [ "$_modelNR" == "2050" ] && [ "$_trxNR" == "0" ] ; then
# Master Verified.
echo "BTS is a 2050 Master"
scp $SSH_OPTS mgr root@${BTS[$bts]}:/bin/
ssh $SSH_OPTS root@${BTS[$bts]} "chmod 750 /bin/mgr"
gunzip -c sysmobts-mgr-arm.gz > sysmobts-mgr
scp $SSH_OPTS sysmobts-mgr root@${BTS[$bts]}:/usr/bin/
ssh $SSH_OPTS root@${BTS[$bts]} "chmod 755 /usr/bin/sysmobts-mgr ; systemctl restart sysmobts-mgr"
# things to do
scp $SSH_OPTS rc.local root@${BTS[$bts]}:/etc/rc.local
ssh $SSH_OPTS root@${BTS[$bts]} "chmod 750 /etc/rc.local"
fi
if [ "$_trxNR" == "1" ] ; then
# Slave Verified.
echo "BTS is a 2050 Slave"
# Nothing to do.
fi
done
if [ "$OLDPWD" != "" ]; then
cd $OLDPWD
fi