Skip to content

Commit

Permalink
Fixing shared files env
Browse files Browse the repository at this point in the history
  • Loading branch information
ampledata committed Aug 15, 2024
1 parent b34d960 commit ed36171
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/node-red-pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
run: |
mkdir -p .debpkg/home/node-red/.node-red
ls -alR
cp shared_files/node_red/aryaos_flows.json .debpkg/home/node-red/.node-red/flows.json
cp shared_files/node-red/aryaos_flows.json .debpkg/home/node-red/.node-red/flows.json
# create DEBIAN directory if you want to add other pre/post scripts
mkdir -p .debpkg/DEBIAN
echo -e "chown node-red:node-red /home/node-red/.node-red/flows.json" > .debpkg/DEBIAN/postinst
Expand All @@ -25,7 +25,7 @@ jobs:
- name: Run build-deb-action from jiro4989
uses: jiro4989/build-deb-action@v3
with:
package: AryaOS_Flows
package: aryaos-flows
package_root: .debpkg
maintainer: gba@snstac.com
version: ${{ github.ref }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pi-gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:

- name: Build AryaOS image
uses: usimd/pi-gen-action@v1
env:
SHARED_FILES: ${{ env.SHARED_FILES }}
with:
pi-gen-dir: pi-gen-src
# Disable the renaming of the first user during the first boot. This make it so
Expand Down
6 changes: 3 additions & 3 deletions ansible/roles/aiscot/tasks/ais-catcher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

- name: Extract AIS-catcher source
ansible.builtin.unarchive:
src: "{{ shared_files }}/ais/AIS-catcher-main.zip"
src: "{{ shared_files }}/sea/AIS-catcher-main.zip"
dest: /usr/src
creates: /usr/src/AIS-catcher-main

Expand All @@ -39,13 +39,13 @@

- name: Copy AIS-catcher systemd config
ansible.builtin.copy:
src: "{{ shared_files }}/ais/AIS-catcher.service"
src: "{{ shared_files }}/sea/AIS-catcher.service"
dest: /lib/systemd/system/ais-catcher.service
mode: "0644"

- name: Copy AIS-catcher default config
ansible.builtin.copy:
src: ../../AIS-catcher.default.conf
src: "{{ shared_files }}/sea/AIS-catcher.default.conf"
dest: /etc/default/ais-catcher
mode: "0644"

Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/aiscot/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#

- name: Include AISCOT
include_tasks: aiscot.yml
ansible.builtin.include_tasks: aiscot.yml

- name: Include AIS-Catcher
include_tasks: ais-catcher.yml
ansible.builtin.include_tasks: ais-catcher.yml
12 changes: 6 additions & 6 deletions pi-gen/stage03-base/00-install/00-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
install -v -m 755 "${SHARED_FILES}/aryaos/get_throttled.sh" "${ROOTFS_DIR}/usr/local/sbin/"

# Set UUID on first boot
install -v -m 755 "${SHARED_FILES}/aryaos//set_uuid.sh" "${ROOTFS_DIR}/usr/local/sbin/"
install -v -m 644 "${SHARED_FILES}/aryaos//set_uuid.service" "${ROOTFS_DIR}/etc/systemd/system/"
install -v -m 755 "${SHARED_FILES}/aryaos/set_uuid.sh" "${ROOTFS_DIR}/usr/local/sbin/"
install -v -m 644 "${SHARED_FILES}/aryaos/set_uuid.service" "${ROOTFS_DIR}/etc/systemd/system/"

# AryaOS Env configuration
install -v -m 644 "${SHARED_FILES}/aryaos//aryaos-config.txt" "${ROOTFS_DIR}/etc/"
install -v -m 755 "${SHARED_FILES}/aryaos//99-aryaos-dispatcher" "${ROOTFS_DIR}/etc/NetworkManager/dispatcher.d/"
install -v -m 644 "${SHARED_FILES}/aryaos//README-aryaos.txt" "${ROOTFS_DIR}/"
install -v -m 644 "${SHARED_FILES}/aryaos/aryaos-config.txt" "${ROOTFS_DIR}/etc/"
install -v -m 755 "${SHARED_FILES}/aryaos/99-aryaos-dispatcher" "${ROOTFS_DIR}/etc/NetworkManager/dispatcher.d/"
install -v -m 644 "${SHARED_FILES}/aryaos/README-aryaos.txt" "${ROOTFS_DIR}/"

# ZeroTier
install -v -m 755 "${SHARED_FILES}/aryaos//install_zt.sh" "${ROOTFS_DIR}/usr/local/sbin/"
install -v -m 755 "${SHARED_FILES}/aryaos/install_zt.sh" "${ROOTFS_DIR}/usr/local/sbin/"

# Required libraries
install -v -m 644 "${SHARED_FILES}/aryaos/python3-asyncinotify_4.0.9-1_all.deb" "${ROOTFS_DIR}/home/pi/"
9 changes: 5 additions & 4 deletions shared_files/aryaos/99-aryaos-dispatcher
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/bash
# AryaOS 99-aryaos-dispatcher
# Dispatch NetworkManager events to AryaOS services for restart.
# 99-aryaos-dispatcher Dispatch NetworkManager events to services for restart.
#
# Copyright Sensors & Signals LLC https://www.snstac.com/
# 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
# 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,
Expand Down
15 changes: 14 additions & 1 deletion shared_files/aryaos/99-aryaos-recorder.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# 99-aryaos-recorder.conf Nginx configuration for AryaOS Recorder.
#
# 99-aryaos-recorder.conf from AryaOS Ansible
# 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.
#

$HTTP["url"] =~ "^/logs($|/)" {
Expand Down
8 changes: 5 additions & 3 deletions shared_files/aryaos/aryaos-config.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# AryaOS aryaos-config.txt
# Global environmental configuration file for AryaOS-based systems.
# code: language=shellscript
# aryaos-config.txt Global environmental configuration file for AryaOS-based systems.
# Configures PyTAK, et al.
#
# 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
# 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,
Expand Down
8 changes: 4 additions & 4 deletions shared_files/aryaos/aryaos.sudoers
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# AryaOS AryaOS.sudoers
#
# Configures custom logging for AryaOS to support NIST SP 800-32 Audit Records.
# aryaos.sudoers Configures custom logging to support NIST SP 800-32 Audit Records.
#
# 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
# 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,
Expand Down
9 changes: 5 additions & 4 deletions shared_files/aryaos/comitup-callback.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash -e
# AryaOS comitup-callback.sh
#
# Callback for comitup state changes
# comitup-callback.sh Callback for comitup state changes
#
# 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
# 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,
Expand All @@ -18,5 +18,6 @@

# FIXME: https://github.com/snstac/aryaos/issues/48
logger "AryaOS comitup callback: $*"

# Ping a callback on Node-RED:
wget -a http://127.0.0.1:1880/comitup_callback/$*
4 changes: 3 additions & 1 deletion shared_files/aryaos/comitup.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#
# 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
# 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,
Expand Down
26 changes: 14 additions & 12 deletions shared_files/aryaos/run_comitup.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash -e
# AryaOS run_comitup.sh
#
# Startup file for comitup
# run_comitup.sh Startup file for comitup
#
# 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
# 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,
Expand All @@ -21,17 +21,18 @@ AOS_CONFIG="/etc/aryaos-config.txt"
COMITUP_CONF="/etc/comitup.conf"

if [ -f $AOS_CONFIG ]; then
. $AOS_CONFIG
# shellcheck source=aryaos-config.txt
. "${AOS_CONFIG}"
fi

if [ ! -f $COMITUP_CONF ]; then
echo "$COMITUP_CONF doesn't exist, initializing."
echo "# ap_name:" >> $COMITUP_CONF
if [ ! -f ${COMITUP_CONF} ]; then
echo "${COMITUP_CONF} doesn't exist, initializing."
echo "# ap_name:" >> "${COMITUP_CONF}"
fi

if ! grep -qs -e 'ap_name' $COMITUP_CONF; then
echo "Adding empty ap_name to $COMITUP_CONF"
echo "# ap_name:" >> $COMITUP_CONF
if ! grep -qs -e 'ap_name' ${COMITUP_CONF}; then
echo "Adding empty ap_name to ${COMITUP_CONF}"
echo "# ap_name:" >> "${COMITUP_CONF}"
fi

if [ -z "$WIFI_SSID" ]; then
Expand All @@ -43,7 +44,8 @@ if [ -z "$WIFI_SSID" ]; then
logger "AryaOS comitup generated new WIFI_SSID: $WIFI_SSID"
fi

sed --follow-symlinks -i -E -e "s/# ap_name:.*/ap_name: $WIFI_SSID/" $COMITUP_CONF
sed --follow-symlinks -i -E -e "s/# ap_name:.*/ap_name: $WIFI_SSID/" "${COMITUP_CONF}"

logger "AryaOS comitup using SSID: $WIFI_SSID"

/usr/sbin/comitup
11 changes: 6 additions & 5 deletions shared_files/aryaos/set_uuid.service
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# AryaOS set_uuid.service
# Defines set_uuid systemd service.
# set_uuid.service Defines set_uuid systemd service.
#
# 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
# 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,
Expand All @@ -15,8 +16,8 @@
#

[Unit]
Description=Sets UUID on the AryaOS system.
Documentation=https://aryaos.readthedocs.io/en/stable/
Description=Sets UUID on the AryaOS systems.
Documentation=https://aryaos.rtfd.io/en/stable/
Wants=network.target
After=network.target

Expand Down
7 changes: 4 additions & 3 deletions shared_files/aryaos/set_uuid.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/bin/bash -e
# AryaOS set_uuid.sh
# Sets a reliable network identification for this device over using
# set_uuid.sh Sets a reliable network identification for this device over using
# either the firmware serial number (Raspberry Pi 4, 5) or an RFC 4122 UUID.
#
# 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
# 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,
Expand Down
8 changes: 4 additions & 4 deletions shared_files/aryaos/wifi-nuke.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python3
# AryaOS wifi-nuke.py
#
# CLI to nuke WiFi connections.
# wifi-nuke.py CLI to nuke WiFi connections.
#
# 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
# 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,
Expand Down
21 changes: 21 additions & 0 deletions shared_files/sea/ais-catcher.default.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
# ais-catcher.default.conf
#
# This file is used to set default values for the AIS-catcher program.
# To override these values, the user can do one:
# A) Create a new file named ais-catcher.conf in the same directory as this file.
# B) Provide command line arguments to the program.
# 2) Provide environment variables to the program.
#
# 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.
#

# [-e baudrate port - open device at serial port with given baudrate]
SERIAL_BAUDRATE=38400
Expand Down
6 changes: 4 additions & 2 deletions shared_files/sea/ais-catcher.service
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# ais-catcher.service: ais-catcher service for systemd
#
# Copyright Sensors & Signals LLC https://www.snstac.com/
# 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
# 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,
Expand Down

0 comments on commit ed36171

Please sign in to comment.