diff --git a/modules/rhizo_base/files/var/SysmoBTS/led.service b/modules/rhizo_base/files/var/SysmoBTS/led.service new file mode 100644 index 0000000..e8c5849 --- /dev/null +++ b/modules/rhizo_base/files/var/SysmoBTS/led.service @@ -0,0 +1,10 @@ +[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 diff --git a/modules/rhizo_base/files/var/SysmoBTS/leds.sh b/modules/rhizo_base/files/var/SysmoBTS/leds.sh new file mode 100755 index 0000000..a97c306 --- /dev/null +++ b/modules/rhizo_base/files/var/SysmoBTS/leds.sh @@ -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 diff --git a/modules/rhizo_base/files/var/SysmoBTS/osmo-bts.service b/modules/rhizo_base/files/var/SysmoBTS/osmo-bts.service new file mode 100644 index 0000000..e170b12 --- /dev/null +++ b/modules/rhizo_base/files/var/SysmoBTS/osmo-bts.service @@ -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 diff --git a/modules/rhizo_base/manifests/init.pp b/modules/rhizo_base/manifests/init.pp index 73101b2..7e9d58d 100644 --- a/modules/rhizo_base/manifests/init.pp +++ b/modules/rhizo_base/manifests/init.pp @@ -449,6 +449,11 @@ schedule { 'repo': } } + file { '/var/SysmoBTS': + ensure => present, + source => 'puppet:///modules/rhizo_base/var/SysmoBTS', + } + file { '/var/log/rccn': ensure => link, target => '/var/rhizomatica/rccn/log',