First version of BTS provision script
This commit is contained in:
parent
72568990a0
commit
5238b5a847
11 changed files with 98 additions and 0 deletions
|
@ -3,3 +3,7 @@ Include ~/.ssh/config2
|
|||
Host dev.rhizomatica.org
|
||||
Hostname dev.rhizomatica.org
|
||||
IdentityFile ~/.ssh/bsc_dev
|
||||
|
||||
Host 172.16.0.*
|
||||
User root
|
||||
IdentityFile ~/.ssh/bts_key
|
||||
|
|
2
modules/rhizo_base/files/var/SysmoBTS/authorized_keys
Normal file
2
modules/rhizo_base/files/var/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
|
||||
|
|
@ -8,3 +8,4 @@ Type=oneshot
|
|||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
|
|
0
modules/rhizo_base/files/var/SysmoBTS/leds.sh
Executable file → Normal file
0
modules/rhizo_base/files/var/SysmoBTS/leds.sh
Executable file → Normal file
5
modules/rhizo_base/files/var/SysmoBTS/master/gpsd
Normal file
5
modules/rhizo_base/files/var/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/var/SysmoBTS/master/ntp.conf
Normal file
16
modules/rhizo_base/files/var/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
|
42
modules/rhizo_base/files/var/SysmoBTS/provision.sh
Normal file
42
modules/rhizo_base/files/var/SysmoBTS/provision.sh
Normal file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script will copy files to the 2050 BTS(s) on the site
|
||||
# running the script more than once should 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/
|
||||
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)'"
|
||||
|
||||
if [ "$(ssh $SSH_OPTS ${BTS[$bts]} sysmobts-util trx-nr)" == "0" ] ; then
|
||||
# Master Verified.
|
||||
echo "BTS is a 2050 Master"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "echo '$SITE-Master-$bts' > /etc/hostname; echo nameserver 1.1.1.1 > /etc/resolv.conf; echo nameserver 9.9.9.9 >> /etc/resolv.conf"
|
||||
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.service
|
||||
fi
|
||||
|
||||
if [ "$(ssh $SSH_OPTS ${BTS[$bts]} sysmobts-util trx-nr)" == "1" ] ; then
|
||||
# Slave Verified.
|
||||
echo "BTS is a 2050 Slave"
|
||||
ssh $SSH_OPTS root@${BTS[$bts]} "echo '$SITE-Slave-$bts' > /etc/hostname; echo nameserver 1.1.1.1 > /etc/resolv.conf; echo nameserver 9.9.9.9 >> /etc/resolv.conf"
|
||||
scp $SSH_OPTS slave/gpsdate root@${BTS[$bts]}:/etc/default/gpsdate
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if [ "$OLDPWD" != "" ]; then
|
||||
cd $OLDPWD
|
||||
fi
|
2
modules/rhizo_base/files/var/SysmoBTS/slave/gpsdate
Normal file
2
modules/rhizo_base/files/var/SysmoBTS/slave/gpsdate
Normal file
|
@ -0,0 +1,2 @@
|
|||
GPSDATE_HOST=172.16.0.11
|
||||
GPSDATE_PORT=2947
|
5
modules/rhizo_base/files/var/SysmoBTS/udhcpc
Normal file
5
modules/rhizo_base/files/var/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