-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |