Move the SysmoBTS source directory
This commit is contained in:
parent
203f92084c
commit
89c7f9ad59
36 changed files with 10 additions and 10 deletions
9
modules/rhizo_base/files/SysmoBTS/README.md
Normal file
9
modules/rhizo_base/files/SysmoBTS/README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
Sysmo BTS Management
|
||||
--------------------
|
||||
|
||||
These are some scripts to help ensure that configuration and installed
|
||||
packages, etc is as desired on sysmoBTS equipment.
|
||||
|
||||
There's nothing automated or even auto-"magic" here. This is just a
|
||||
bunch of tools to help you if you already know what you are doing.
|
||||
|
2
modules/rhizo_base/files/SysmoBTS/authorized_keys
Normal file
2
modules/rhizo_base/files/SysmoBTS/authorized_keys
Normal file
|
@ -0,0 +1,2 @@
|
|||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDB91GjYXXkQmawOsLuGIBM3/V6BoCuXYiFr+Zokn+zTi9g1WwFL+wR4W2KSdGwUZT1TUi1O2IeQiQhQnR9A0eBLLYAgLVIP+Zs10k34qbPeMP7fdUr73hFQU9ruTCLtfczL4EqouXov6EybVX31f5OHvhDRPwNn6ERfpD3RZK0D0D5KaJLSWqL7fgQiPLbDD2+WzZlJWTcdiT3TQc0AmpYL0MG8GZYJXZy4pJWY3tigBSMoNbOyEOQ1/wMAWhs+NjmECz/95AkEFUg/WxvDKcnd70mxckvgMrTJu1Gn2u4FtQ9c164GOgVIg36KEV+a+DyNdvptmtyY+cm1zsCWCub
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
src/gz uri-all-0 http://OPKG_CREDS@downloads.sysmocom.de/generic/sysmobts/201705-nightly/ipk/all
|
||||
src/gz uri-armv5te-0 http://OPKG_CREDS@downloads.sysmocom.de/generic/sysmobts/201705-nightly/ipk/armv5te
|
||||
src/gz uri-sysmobts_v2-0 http://OPKG_CREDS@downloads.sysmocom.de/generic/sysmobts/201705-nightly/ipk/sysmobts_v2
|
32
modules/rhizo_base/files/SysmoBTS/bts
Normal file
32
modules/rhizo_base/files/SysmoBTS/bts
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/expect -f
|
||||
|
||||
spawn telnet localhost 4241
|
||||
expect ">"
|
||||
send "enable\r"
|
||||
expect "#"
|
||||
send "logging enable\r"
|
||||
expect "#"
|
||||
send "logging level all everything\r"
|
||||
expect "#"
|
||||
send "logging print category 1\r"
|
||||
expect "#"
|
||||
|
||||
send "logging level rr notice\r"
|
||||
expect "#"
|
||||
send "logging level oml info\r"
|
||||
expect "#"
|
||||
send "logging level pag info\r"
|
||||
expect "#"
|
||||
send "logging level rsl info\r"
|
||||
expect "#"
|
||||
send "logging level rll notice\r"
|
||||
expect "#"
|
||||
send "logging level meas notice\r"
|
||||
expect "#"
|
||||
send "logging level pcu info\r"
|
||||
expect "#"
|
||||
|
||||
send "logging filter all 1\r"
|
||||
expect "#"
|
||||
interact
|
||||
|
35
modules/rhizo_base/files/SysmoBTS/check.sh
Normal file
35
modules/rhizo_base/files/SysmoBTS/check.sh
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
|
||||
exec 2> /dev/null
|
||||
|
||||
SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
||||
. /home/rhizomatica/bin/vars.sh
|
||||
|
||||
|
||||
for bts in "${!BTS[@]}" ; do
|
||||
|
||||
_model=$(ssh $SSH_OPTS ${BTS[$bts]} sysmobts-util model-nr)
|
||||
echo "BTS $bts is model $_model"
|
||||
if [ "$_model" != "2050" ]; then continue; fi
|
||||
|
||||
if [ "$(ssh $SSH_OPTS ${BTS[$bts]} sysmobts-util trx-nr)" == "0" ] ; then
|
||||
# Master Verified.
|
||||
echo "BTS $bts is a 2050 Master"
|
||||
ssh $SSH_OPTS ${BTS[$bts]} "osmo-bts-sysmo -V | grep BTS\ version; osmo-pcu -V | grep PCU\ version"
|
||||
ssh $SSH_OPTS ${BTS[$bts]} "uname -a"
|
||||
if [ "$(ssh $SSH_OPTS ${BTS[$bts]} 'grep 201705 /etc/opkg/base-feeds.conf >/dev/null; echo $?')" == "0" ] ; then
|
||||
echo "Feed is 201705"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$(ssh $SSH_OPTS ${BTS[$bts]} sysmobts-util trx-nr)" == "1" ] ; then
|
||||
# Slave Verified.
|
||||
echo "BTS $bts is a 2050 Slave"
|
||||
ssh $SSH_OPTS ${BTS[$bts]} "osmo-bts-sysmo -V | grep BTS\ version; osmo-pcu -V | grep PCU\ version"
|
||||
ssh $SSH_OPTS ${BTS[$bts]} "uname -a"
|
||||
if [ "$(ssh $SSH_OPTS ${BTS[$bts]} 'grep 201705 /etc/opkg/base-feeds.conf >/dev/null; echo $?')" == "0" ] ; then
|
||||
echo "Feed is 201705"
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
9
modules/rhizo_base/files/SysmoBTS/chk_masq
Normal file
9
modules/rhizo_base/files/SysmoBTS/chk_masq
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
. /home/rhizomatica/bin/vars.sh
|
||||
|
||||
/sbin/iptables -t nat -vnL | egrep "MASQUERADE.*all.*$_PUB_IF.*172.16.0.0/16.*0.0.0.0/0"
|
||||
if [ $? != 0 ] ; then
|
||||
# Add the Masquerade RULE
|
||||
iptables -t nat -I POSTROUTING -s 172.16.0.0/16 -o $_PUB_IF -j MASQUERADE
|
||||
fi
|
BIN
modules/rhizo_base/files/SysmoBTS/expect_5.45-r1.0_armv5te.ipk
Normal file
BIN
modules/rhizo_base/files/SysmoBTS/expect_5.45-r1.0_armv5te.ipk
Normal file
Binary file not shown.
9
modules/rhizo_base/files/SysmoBTS/interfaces
Normal file
9
modules/rhizo_base/files/SysmoBTS/interfaces
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
address _IP_
|
||||
netmask 255.255.255.0
|
||||
gateway 172.16.0.1
|
11
modules/rhizo_base/files/SysmoBTS/led.service
Normal file
11
modules/rhizo_base/files/SysmoBTS/led.service
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=Flash the LED
|
||||
Before=getty@tty1.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/etc/init.d/leds.sh r timer fast
|
||||
Type=oneshot
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
41
modules/rhizo_base/files/SysmoBTS/leds.sh
Normal file
41
modules/rhizo_base/files/SysmoBTS/leds.sh
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Control the LED on a SysmoBTS 2050
|
||||
# We have a Red and a Green LED in one
|
||||
# Both on = Orange.
|
||||
|
||||
_AL=/sys/class/leds/activity_led/
|
||||
_OL=/sys/class/leds/online_led/
|
||||
_B=brightness
|
||||
_T=trigger
|
||||
_D=delay_on
|
||||
_DO=delay_off
|
||||
|
||||
if [ "$1" == "green" -o "$1" == "g" ]; then
|
||||
_L=$_AL
|
||||
fi
|
||||
|
||||
if [ "$1" == "red" -o "$1" == "r" ]; then
|
||||
_L=$_OL
|
||||
fi
|
||||
|
||||
if [ "$1" == "reset" ]; then
|
||||
echo 0 > $_AL$_B
|
||||
echo 0 > $_OL$_B
|
||||
fi
|
||||
|
||||
if [ "$2" == "on" ]; then
|
||||
echo 1 > $_L$_B
|
||||
fi
|
||||
|
||||
if [ "$2" == "off" ]; then
|
||||
echo 0 > $_L$_B
|
||||
fi
|
||||
|
||||
if [ "$2" == "timer" -o "$2" == "cpu0" ]; then
|
||||
echo $2 > $_L$_T
|
||||
if [ "$3" == fast ]; then
|
||||
echo 50 > $_L$_D
|
||||
echo 100 > $_L$_DO
|
||||
fi
|
||||
fi
|
Binary file not shown.
76
modules/rhizo_base/files/SysmoBTS/maint.sh
Normal file
76
modules/rhizo_base/files/SysmoBTS/maint.sh
Normal file
|
@ -0,0 +1,76 @@
|
|||
#!/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 pcu-ns root@${BTS[$bts]}:/bin/
|
||||
scp $SSH_OPTS tgl-s root@${BTS[$bts]}:/bin/tgl
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "chmod 750 /bin/pcu-ns /bin/tgl"
|
||||
#gunzip -c sysmobts-mgr-arm.gz > sysmobts-mgr
|
||||
#ssh $SSH_OPTS root@${BTS[$bts]} "systemctl stop 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"
|
||||
scp $SSH_OPTS pcu-ns root@${BTS[$bts]}:/bin/
|
||||
scp $SSH_OPTS tgl-m root@${BTS[$bts]}:/bin/tgl
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "chmod 750 /bin/pcu-ns /bin/tgl"
|
||||
# Nothing to do.
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if [ "$OLDPWD" != "" ]; then
|
||||
cd $OLDPWD
|
||||
fi
|
5
modules/rhizo_base/files/SysmoBTS/master/gpsd
Normal file
5
modules/rhizo_base/files/SysmoBTS/master/gpsd
Normal file
|
@ -0,0 +1,5 @@
|
|||
# If you must specify a non-NMEA driver, uncomment and modify the next line
|
||||
GPSD_SOCKET="/var/run/gpsd.sock"
|
||||
GPSD_OPTIONS="-n -G"
|
||||
GPS_DEVICES="/dev/ttyS2"
|
||||
|
16
modules/rhizo_base/files/SysmoBTS/master/ntp.conf
Normal file
16
modules/rhizo_base/files/SysmoBTS/master/ntp.conf
Normal file
|
@ -0,0 +1,16 @@
|
|||
driftfile /etc/ntp.drift
|
||||
|
||||
# GPS Serial data reference (NTP0)
|
||||
server 127.127.28.0
|
||||
fudge 127.127.28.0 refid GPS
|
||||
|
||||
# GPS PPS reference (NTP1)
|
||||
server 127.127.28.1 prefer
|
||||
fudge 127.127.28.1 refid PPS
|
||||
|
||||
# Defining a default security setting
|
||||
|
||||
restrict 127.0.0.1 mask 255.255.255.0
|
||||
restrict 0.0.0.0 netmask 0.0.0.0 nomodify notrap
|
||||
|
||||
logfile /var/log/ntp.log
|
23
modules/rhizo_base/files/SysmoBTS/mgr
Normal file
23
modules/rhizo_base/files/SysmoBTS/mgr
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/expect -f
|
||||
|
||||
spawn telnet localhost 4252
|
||||
expect ">"
|
||||
send "enable\r"
|
||||
expect "#"
|
||||
send "logging enable\r"
|
||||
expect "#"
|
||||
send "logging level all everything\r"
|
||||
expect "#"
|
||||
send "logging print category 1\r"
|
||||
expect "#"
|
||||
|
||||
|
||||
send "logging level set-all error\r"
|
||||
expect "#"
|
||||
|
||||
send "logging filter all 1\r"
|
||||
expect "#"
|
||||
|
||||
send "show manager\r"
|
||||
expect "#"
|
||||
interact
|
64
modules/rhizo_base/files/SysmoBTS/opkg-1.sh
Executable file
64
modules/rhizo_base/files/SysmoBTS/opkg-1.sh
Executable file
|
@ -0,0 +1,64 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script will upgrade osmo-* daemons on the BTS
|
||||
# Depending on circumstances, this might not 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
|
||||
|
||||
rm -rf ./opkg
|
||||
mkdir opkg
|
||||
mkdir opkg/cache
|
||||
|
||||
for bts in "${!BTS[@]}" ; do
|
||||
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "systemctl restart gpsdate"
|
||||
if [ "$(ssh $SSH_OPTS ${BTS[$bts]} 'grep 201705 /etc/opkg/base-feeds.conf >/dev/null; echo $?')" == "0" ] ; then
|
||||
grep OPKG_CREDS base-feeds-nightly.conf > /dev/null
|
||||
if [ "$?" == "0" ]; then
|
||||
sed -i s/OPKG_CREDS/$OPKG_CREDS/g base-feeds-nightly.conf
|
||||
fi
|
||||
if [ $bts == 0 ]; then
|
||||
if [ "$1" != "noupdate" ] ; then
|
||||
scp $SSH_OPTS base-feeds-nightly.conf root@${BTS[$bts]}:/etc/opkg/base-feeds.conf
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin opkg clean; opkg update"
|
||||
fi
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin opkg install osmo-bts osmo-pcu sysmobts-util ntp ipaccess-utils osmo-bts-remote"
|
||||
scp $SSH_OPTS -r root@${BTS[$bts]}:/var/lib/opkg/* opkg
|
||||
scp $SSH_OPTS -r root@${BTS[$bts]}:/var/cache/opkg/* opkg/cache
|
||||
fi
|
||||
if [ $bts != 0 ] ; then
|
||||
scp $SSH_OPTS -r opkg/* root@${BTS[$bts]}:/var/lib/opkg/
|
||||
scp $SSH_OPTS -r opkg/cache/* root@${BTS[$bts]}:/var/cache/opkg/
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin opkg install osmo-bts osmo-pcu sysmobts-util ntp ipaccess-utils osmo-bts-remote"
|
||||
fi
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin opkg remove libosmoabis6 libosmogsm13 libosmovty3 libosmovty4"
|
||||
|
||||
|
||||
fi
|
||||
|
||||
#if [ "$(ssh $SSH_OPTS ${BTS[$bts]} 'ls /usr/bin/osmo-bts-sysmo-nitb 2> /dev/null; echo $?')" == "2" ] ; then
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "systemctl stop osmo-bts"
|
||||
gunzip -c osmo-bts-sysmo-arm-cf7a.gz > osmo-bts-sysmo-nitb
|
||||
scp $SSH_OPTS osmo-bts-sysmo-nitb root@${BTS[$bts]}:/usr/bin/
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "chmod 755 /usr/bin/osmo-bts-sysmo-nitb"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "cd /usr/bin; mv osmo-bts-sysmo osmo-bts-sysmo.opkg ; ln -s osmo-bts-sysmo-nitb osmo-bts-sysmo; systemctl start osmo-bts"
|
||||
#fi
|
||||
#if [ "$(ssh $SSH_OPTS ${BTS[$bts]} 'ls /usr/bin/osmo-pcu-nitb 2> /dev/null; echo $?')" == "2" ] ; then
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "systemctl stop osmo-pcu"
|
||||
gunzip -c osmo-pcu-arm-54211.gz > osmo-pcu-nitb
|
||||
scp $SSH_OPTS osmo-pcu-nitb root@${BTS[$bts]}:/usr/bin/
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "chmod 755 /usr/bin/osmo-pcu-nitb"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "cd /usr/bin; mv osmo-pcu osmo-pcu.opkg ; ln -s osmo-pcu-nitb osmo-pcu; systemctl start osmo-pcu"
|
||||
#fi
|
||||
|
||||
done
|
||||
|
||||
if [ "$OLDPWD" != "" ]; then
|
||||
cd $OLDPWD
|
||||
fi
|
||||
|
36
modules/rhizo_base/files/SysmoBTS/opkg-split.sh
Normal file
36
modules/rhizo_base/files/SysmoBTS/opkg-split.sh
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script will upgrade osmo-* daemons on the BTS
|
||||
# Depending on circumstances, this might not 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
|
||||
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "systemctl restart gpsdate"
|
||||
|
||||
grep OPKG_CREDS base-feeds-nightly.conf > /dev/null
|
||||
if [ "$?" == "0" ]; then
|
||||
sed -i s/OPKG_CREDS/$OPKG_CREDS/g base-feeds-nightly.conf
|
||||
fi
|
||||
|
||||
if [ "$1" != "noupdate" ] ; then
|
||||
echo "Updating Feed..."
|
||||
scp $SSH_OPTS base-feeds-nightly.conf root@${BTS[$bts]}:/etc/opkg/base-feeds.conf
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin opkg update"
|
||||
fi
|
||||
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin opkg install osmo-bts osmo-pcu sysmobts-util ntp ipaccess-utils osmo-bts-remote"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin opkg remove libosmoabis6 libosmogsm13 libosmovty3 libosmovty4"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "systemctl enable osmo-pcu; systemctl start osmo-pcu"
|
||||
|
||||
done
|
||||
|
||||
if [ "$OLDPWD" != "" ]; then
|
||||
cd $OLDPWD
|
||||
fi
|
53
modules/rhizo_base/files/SysmoBTS/opkg.sh
Normal file
53
modules/rhizo_base/files/SysmoBTS/opkg.sh
Normal file
|
@ -0,0 +1,53 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script will upgrade osmo-* daemons on the BTS
|
||||
# Depending on circumstances, this might not 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
|
||||
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "systemctl restart gpsdate"
|
||||
_modelNR=$(ssh $SSH_OPTS ${BTS[$bts]} sysmobts-util model-nr)
|
||||
_trxNR=$(ssh $SSH_OPTS ${BTS[$bts]} sysmobts-util trx-nr)
|
||||
|
||||
if [ "$(ssh $SSH_OPTS ${BTS[$bts]} 'grep 201705 /etc/opkg/base-feeds.conf >/dev/null; echo $?')" == "0" ] ; then
|
||||
|
||||
grep OPKG_CREDS base-feeds-nightly.conf > /dev/null
|
||||
if [ "$?" == "0" ]; then
|
||||
sed -i s/OPKG_CREDS/$OPKG_CREDS/g base-feeds-nightly.conf
|
||||
fi
|
||||
if [ "$1" != "noupdate" ] ; then
|
||||
scp $SSH_OPTS base-feeds-nightly.conf root@${BTS[$bts]}:/etc/opkg/base-feeds.conf
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin opkg update"
|
||||
fi
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin opkg install osmo-bts osmo-pcu sysmobts-util ntp ipaccess-utils osmo-bts-remote"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin opkg remove libosmoabis6 libosmogsm13 libosmovty3 libosmovty4"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "systemctl enable osmo-pcu; systemctl start osmo-pcu"
|
||||
|
||||
fi
|
||||
|
||||
#if [ "$(ssh $SSH_OPTS ${BTS[$bts]} 'ls /usr/bin/osmo-bts-sysmo-nitb 2> /dev/null; echo $?')" == "2" ] ; then
|
||||
gunzip -c osmo-bts-sysmo-arm-cf7a.gz > osmo-bts-sysmo-nitb
|
||||
scp $SSH_OPTS osmo-bts-sysmo-nitb root@${BTS[$bts]}:/usr/bin/
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "chmod 755 /usr/bin/osmo-bts-sysmo-nitb"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "cd /usr/bin; mv osmo-bts-sysmo osmo-bts-sysmo.opkg ; ln -s osmo-bts-sysmo-nitb osmo-bts-sysmo"
|
||||
#fi
|
||||
#if [ "$(ssh $SSH_OPTS ${BTS[$bts]} 'ls /usr/bin/osmo-pcu-nitb 2> /dev/null; echo $?')" == "2" ] ; then
|
||||
gunzip -c osmo-pcu-arm-54211.gz > osmo-pcu-nitb
|
||||
scp $SSH_OPTS osmo-pcu-nitb root@${BTS[$bts]}:/usr/bin/
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "chmod 755 /usr/bin/osmo-pcu-nitb"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "cd /usr/bin; mv osmo-pcu osmo-pcu.opkg ; ln -s osmo-pcu-nitb osmo-pcu; systemctl restart osmo-bts"
|
||||
#fi
|
||||
|
||||
done
|
||||
|
||||
if [ "$OLDPWD" != "" ]; then
|
||||
cd $OLDPWD
|
||||
fi
|
||||
|
BIN
modules/rhizo_base/files/SysmoBTS/osmo-bts-sysmo-arm-cf7a.gz
Executable file
BIN
modules/rhizo_base/files/SysmoBTS/osmo-bts-sysmo-arm-cf7a.gz
Executable file
Binary file not shown.
24
modules/rhizo_base/files/SysmoBTS/osmo-bts.service
Normal file
24
modules/rhizo_base/files/SysmoBTS/osmo-bts.service
Normal file
|
@ -0,0 +1,24 @@
|
|||
[Unit]
|
||||
Description=osmo-bts for sysmocom sysmoBTS
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStartPre=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness'
|
||||
ExecStartPre=/bin/sh -c 'echo cpu0 > /sys/class/leds/online_led/trigger'
|
||||
ExecStart=/usr/bin/osmo-bts-sysmo -s -c /etc/osmocom/osmo-bts-sysmo.cfg -M
|
||||
ExecStopPost=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness'
|
||||
ExecStopPost=/bin/sh -c 'echo none > /sys/class/leds/online_led/trigger'
|
||||
ExecStopPost=/bin/sh -c 'echo 1 > /sys/class/leds/online_led/brightness'
|
||||
ExecStopPost=/bin/sh -c 'cat /lib/firmware/sysmobts-v?.bit > /dev/fpgadl_par0 ; sleep 3s; cat /lib/firmware/sysmobts-v?.out > /dev/dspdl_dm644x_0; sleep 1s'
|
||||
Restart=always
|
||||
RestartSec=2
|
||||
RestartPreventExitStatus=1
|
||||
|
||||
# The msg queues must be read fast enough
|
||||
CPUSchedulingPolicy=rr
|
||||
CPUSchedulingPriority=1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Alias=sysmobts.service
|
||||
Alias=osmo-bts.service
|
BIN
modules/rhizo_base/files/SysmoBTS/osmo-pcu-arm-54211.gz
Executable file
BIN
modules/rhizo_base/files/SysmoBTS/osmo-pcu-arm-54211.gz
Executable file
Binary file not shown.
35
modules/rhizo_base/files/SysmoBTS/pcu
Normal file
35
modules/rhizo_base/files/SysmoBTS/pcu
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/expect -f
|
||||
|
||||
spawn telnet localhost 4240
|
||||
expect ">"
|
||||
send "enable\r"
|
||||
expect "#"
|
||||
send "logging enable\r"
|
||||
expect "#"
|
||||
send "logging level all everything\r"
|
||||
expect "#"
|
||||
send "logging print category 1\r"
|
||||
expect "#"
|
||||
|
||||
send "logging level l1if info\r"
|
||||
expect "#"
|
||||
send "logging level rlcmac info\r"
|
||||
expect "#"
|
||||
send "logging level rlcmacmeas notice\r"
|
||||
expect "#"
|
||||
send "logging level tbf info\r"
|
||||
expect "#"
|
||||
send "logging level tbful info\r"
|
||||
expect "#"
|
||||
send "logging level tbfdl info\r"
|
||||
expect "#"
|
||||
send "logging level rlcmacsched info\r"
|
||||
expect "#"
|
||||
|
||||
send "logging level set-all error\r"
|
||||
expect "#"
|
||||
|
||||
send "logging filter all 1\r"
|
||||
expect "#"
|
||||
interact
|
||||
|
11
modules/rhizo_base/files/SysmoBTS/pcu-ns
Normal file
11
modules/rhizo_base/files/SysmoBTS/pcu-ns
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/expect -f
|
||||
|
||||
spawn telnet localhost 4240
|
||||
expect ">"
|
||||
send "enable\r"
|
||||
expect "#"
|
||||
send "show ns\r"
|
||||
expect "#"
|
||||
send "exit\r"
|
||||
expect "#"
|
||||
|
84
modules/rhizo_base/files/SysmoBTS/provision.sh
Normal file
84
modules/rhizo_base/files/SysmoBTS/provision.sh
Normal file
|
@ -0,0 +1,84 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script will copy files to the 2050 BTS(s) on the site
|
||||
# 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
|
||||
scp $SSH_OPTS udhcpc root@${BTS[$bts]}:/etc/default/udhcpc
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "echo 'root:$BTSPASS' | /usr/sbin/chpasswd"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "date -s '$(date)'"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "find /etc -name resolv.conf -type l -exec rm {} \;"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "echo nameserver 1.1.1.1 > /etc/resolv.conf; echo nameserver 9.9.9.9 >> /etc/resolv.conf"
|
||||
scp $SSH_OPTS osmo-pcu.cfg root@${BTS[$bts]}:/etc/osmocom/osmo-pcu.cfg
|
||||
scp $SSH_OPTS osmo-bts_$bts.cfg root@${BTS[$bts]}:/etc/osmocom/osmo-bts-sysmo.cfg
|
||||
scp $SSH_OPTS pcu bts mgr root@${BTS[$bts]}:/bin/
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "chmod 750 /bin/pcu /bin/bts /bin/mgr"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "expect -v 2>/dev/null"
|
||||
|
||||
if [ "$?" != "0" ]; then
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "mkdir /tmp/ipk"
|
||||
scp $SSH_OPTS *.ipk root@${BTS[$bts]}:/tmp/ipk/
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "opkg install /tmp/ipk/*.ipk"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "rm -r /tmp/ipk"
|
||||
fi
|
||||
|
||||
_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"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "echo '$SITE-$bts' > /etc/hostname"
|
||||
scp $SSH_OPTS master/gpsd root@${BTS[$bts]}:/etc/default/gpsd
|
||||
scp $SSH_OPTS master/ntp.conf root@${BTS[$bts]}:/etc/ntp.conf
|
||||
fi
|
||||
|
||||
if [ "$_trxNR" == "0" ] ; then
|
||||
# Master Verified.
|
||||
echo "BTS is a 2050 Master"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "echo '$SITE-Master-$bts' > /etc/hostname"
|
||||
scp $SSH_OPTS rc.local root@${BTS[$bts]}:/etc/rc.local
|
||||
scp $SSH_OPTS master/gpsd root@${BTS[$bts]}:/etc/default/gpsd
|
||||
scp $SSH_OPTS master/ntp.conf root@${BTS[$bts]}:/etc/ntp.conf
|
||||
scp $SSH_OPTS leds.sh root@${BTS[$bts]}:/etc/init.d/leds.sh
|
||||
scp $SSH_OPTS led.service root@${BTS[$bts]}:/lib/systemd/system/led.service
|
||||
scp $SSH_OPTS osmo-bts.service root@${BTS[$bts]}:/lib/systemd/system/osmo-bts-sysmo.service
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "systemctl enable led.service"
|
||||
fi
|
||||
|
||||
if [ "$_trxNR" == "1" ] ; then
|
||||
# Slave Verified.
|
||||
echo "BTS is a 2050 Slave"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "echo '$SITE-Slave-$bts' > /etc/hostname"
|
||||
scp $SSH_OPTS rc.local root@${BTS[$bts]}:/etc/rc.local
|
||||
scp $SSH_OPTS slave/gpsdate root@${BTS[$bts]}:/etc/default/gpsdate
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if [ "$OLDPWD" != "" ]; then
|
||||
cd $OLDPWD
|
||||
fi
|
2
modules/rhizo_base/files/SysmoBTS/pwr
Normal file
2
modules/rhizo_base/files/SysmoBTS/pwr
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
watch sbts2050-util sbts2050-pwr-status
|
6
modules/rhizo_base/files/SysmoBTS/rc.local
Normal file
6
modules/rhizo_base/files/SysmoBTS/rc.local
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Turn on 2050 PA so that osmo-bts can do power ramping.
|
||||
if [ `/usr/bin/sysmobts-util model-nr` == '2050' ] ; then
|
||||
/usr/bin/sbts2050-util sbts2050-pwr-enable 1 1 1
|
||||
fi
|
58
modules/rhizo_base/files/SysmoBTS/route.sh
Normal file
58
modules/rhizo_base/files/SysmoBTS/route.sh
Normal file
|
@ -0,0 +1,58 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Script to add the default route to the networking
|
||||
# configuration.
|
||||
|
||||
# !!!!! WARNING !!!!!
|
||||
# Be VERY careful with this one, as
|
||||
# a messed up /etc/network/interfaces will lock
|
||||
# you out of the unit and you'll have to physically
|
||||
# connect with a serial cable.
|
||||
# FIXME. Find a better way.
|
||||
|
||||
|
||||
if [ "$1" != "reckless" ] ; then
|
||||
echo "Do NOT run this script!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
|
||||
. /home/rhizomatica/bin/vars.sh
|
||||
|
||||
|
||||
CMD='grep -xF " gateway 172.16.0.1" /etc/network/interfaces || grep gateway\ :alpha: /etc/network/interfaces || echo " gateway 172.16.0.1" >> /etc/network/interfaces'
|
||||
|
||||
for bts in "${!BTS[@]}" ; do
|
||||
|
||||
awk 'BEGIN {while (x++<80) printf "-"}' ; echo
|
||||
ssh $SSH_OPTS ${BTS[$bts]} "cat /etc/network/interfaces"
|
||||
if [ $? != 0 ] ; then echo "Conx. Failed" ; exit ; fi
|
||||
awk 'BEGIN {while (x++<80) printf "-"}' ; echo
|
||||
|
||||
echo "Should we add a gateway line to the above? (y/n)"
|
||||
read _ans
|
||||
|
||||
if [ "$_ans" == "y" ] ; then
|
||||
|
||||
ssh $SSH_OPTS ${BTS[$bts]} "$CMD"
|
||||
|
||||
else
|
||||
|
||||
echo "Copy interfaces file? (y/n)"
|
||||
read _ans
|
||||
if [ "$_ans" == "y" ] ; then
|
||||
|
||||
_rfile=/tmp/interfaces-$RANDOM
|
||||
cat interfaces | sed s/_IP_/${BTS[$bts]}/ > $_rfile
|
||||
scp $_rfile ${BTS[$bts]}:/etc/network/interfaces
|
||||
rm $_rfile
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
awk 'BEGIN {while (x++<80) printf "-"}' ; echo
|
||||
ssh $SSH_OPTS ${BTS[$bts]} "cat /etc/network/interfaces"
|
||||
awk 'BEGIN {while (x++<80) printf "-"}' ; echo
|
||||
echo "If that does not look OK, fix it now manually, otherwise you might be locked out on reboot"
|
||||
|
||||
done
|
21
modules/rhizo_base/files/SysmoBTS/scp-all.sh
Normal file
21
modules/rhizo_base/files/SysmoBTS/scp-all.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script will copy a file into /tmp on all the BTS
|
||||
# No overwrite checking will take place.
|
||||
|
||||
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 $1 root@${BTS[$bts]}:/tmp
|
||||
|
||||
done
|
||||
|
||||
if [ "$OLDPWD" != "" ]; then
|
||||
cd $OLDPWD
|
||||
fi
|
2
modules/rhizo_base/files/SysmoBTS/slave/gpsdate
Normal file
2
modules/rhizo_base/files/SysmoBTS/slave/gpsdate
Normal file
|
@ -0,0 +1,2 @@
|
|||
GPSDATE_HOST=172.16.0.11
|
||||
GPSDATE_PORT=2947
|
20
modules/rhizo_base/files/SysmoBTS/ssh-all.sh
Normal file
20
modules/rhizo_base/files/SysmoBTS/ssh-all.sh
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script will exec cmd on all the BTS
|
||||
|
||||
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
|
||||
|
||||
ssh -t $SSH_OPTS root@${BTS[$bts]} $*
|
||||
|
||||
done
|
||||
|
||||
if [ "$OLDPWD" != "" ]; then
|
||||
cd $OLDPWD
|
||||
fi
|
BIN
modules/rhizo_base/files/SysmoBTS/sysmobts-mgr-arm.gz
Normal file
BIN
modules/rhizo_base/files/SysmoBTS/sysmobts-mgr-arm.gz
Normal file
Binary file not shown.
BIN
modules/rhizo_base/files/SysmoBTS/tcl_8.6.6-r0.0_armv5te.ipk
Normal file
BIN
modules/rhizo_base/files/SysmoBTS/tcl_8.6.6-r0.0_armv5te.ipk
Normal file
Binary file not shown.
7
modules/rhizo_base/files/SysmoBTS/tgl-m
Normal file
7
modules/rhizo_base/files/SysmoBTS/tgl-m
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Toggle the power on the Master (reset)
|
||||
sbts2050-util sbts2050-pwr-enable 0 1 1
|
||||
sleep 1
|
||||
sbts2050-util sbts2050-pwr-enable 1 1 1
|
||||
|
7
modules/rhizo_base/files/SysmoBTS/tgl-s
Normal file
7
modules/rhizo_base/files/SysmoBTS/tgl-s
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Toggle the power on the Slave (reset)
|
||||
sbts2050-util sbts2050-pwr-enable 1 0 1
|
||||
sleep 1
|
||||
sbts2050-util sbts2050-pwr-enable 1 1 1
|
||||
|
5
modules/rhizo_base/files/SysmoBTS/udhcpc
Normal file
5
modules/rhizo_base/files/SysmoBTS/udhcpc
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Uncomment the following line, if udhcpc should not touch /etc/resolv.conf
|
||||
STATIC_DNS="yes"
|
||||
|
||||
# Uncomment the following line if udhcpc should not install a default route
|
||||
#INSTALL_DEFAULT_ROUTE="no"
|
Loading…
Add table
Add a link
Reference in a new issue