Skip to content

Commit

Permalink
renaming files
Browse files Browse the repository at this point in the history
  • Loading branch information
ampledata committed Mar 29, 2024
1 parent 4ec518d commit 19e842f
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 0 deletions.
19 changes: 19 additions & 0 deletions stage5-common/00-install/files/LINCOT-config.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# AryaOS LINCOT-config.txt
#
# LINCOT Env configuration file.
#
# Copyright Sensors & Signals LLC https://www.snstac.com/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#


CALLSIGN=""
35 changes: 35 additions & 0 deletions stage5-common/00-install/files/LINCOT.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# AryaOS LINCOT.service
#
# LINCOT service for systemd
#
# Copyright Sensors & Signals LLC https://www.snstac.com/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

[Unit]
Description=LINCOT Linux GPSD to TAK Gateway
Documentation=https://github.com/SNSTAC/LINCOT
Wants=network.target
After=network.target

[Service]
User=lincot
Type=simple
RuntimeDirectoryMode=0755
ExecStart=/usr/local/sbin/run_LINCOT.sh
SyslogIdentifier=LINCOT
KillSignal=SIGINT
Restart=on-failure
RestartSec=20

[Install]
WantedBy=default.target
58 changes: 58 additions & 0 deletions stage5-common/00-install/files/run_LINCOT.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash
# AryaOS run_LINCOT.sh
#
# Startup file for LINCOT.
#
# Copyright Sensors & Signals LLC https://www.snstac.com/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set -a
AOS_CONFIG="/boot/${AOS_FLAVOR:-AryaOS}-config.txt"

if [-f $AOS_CONFIG ]; then
. $AOS_CONFIG
else
echo "$AOS_CONFIG doesn't exist, exiting."
exit 1
fi

LINCOT_CONF="/boot/LINCOT-config.txt"

if [ -f $LINCOT_CONF ]; then
. $LINCOT_CONF
else
echo "$LINCOT_CONF doesn't exist, initializing."
echo 'CALLSIGN=""' >> $LINCOT_CONF
fi

if ! grep -qs -e 'CALLSIGN' $LINCOT_CONF; then
echo "Adding empty CALLSIGN to $LINCOT_CONF"
echo 'CALLSIGN=""' >> $LINCOT_CONF
fi

if [ -z "$NODE_ID" ]; then
echo "NODE_ID not set, will retry..."
exit 1
fi

if [ -z "$CALLSIGN" ]; then
echo "CALLSIGN not set"
NEW_CALLSIGN="${AOS_FLAVOR:-AryaOS}-${NODE_ID: -4}"
sed --follow-symlinks -i -E -e "s/CALLSIGN.*/CALLSIGN=$NEW_CALLSIGN/" $LINCOT_CONF
logger "AryaOS LINCOT callsign is now set to: $NEW_CALLSIGN"
export CALLSIGN=$NEW_CALLSIGN
fi

set +a

/usr/local/bin/lincot

0 comments on commit 19e842f

Please sign in to comment.