Skip to content

Commit

Permalink
pi-gen github action
Browse files Browse the repository at this point in the history
  • Loading branch information
ampledata committed Aug 16, 2024
1 parent 17dd75f commit 735fee2
Show file tree
Hide file tree
Showing 21 changed files with 78 additions and 138 deletions.
18 changes: 18 additions & 0 deletions ansible/roles/dronecot/tasks/dronecot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,21 @@
- name: Install DroneCOT Debian package
ansible.builtin.apt:
deb: /usr/src/{{ dronecot_deb }}

- name: Copy reset_wlan.sh to /usr/local/sbin
ansible.builtin.copy:
src: "{{ shared_files }}/uas/reset_wlan.sh"
dest: /usr/local/sbin/
mode: "0755"

- name: Create /etc/systemd/service/dronecot.service.d
ansible.builtin.file:
path: /etc/systemd/service/dronecot.service.d
state: directory
mode: "0755"

- name: Copy execprestart.conf to /etc/systemd/service/dronecot.service.d
ansible.builtin.copy:
src: "{{ shared_files }}/uas/execprestart.conf"
dest: /etc/systemd/service/dronecot.service.d/
mode: "0644"
4 changes: 3 additions & 1 deletion pi-gen/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,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
9 changes: 4 additions & 5 deletions pi-gen/config
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash
#
# AryaOS config
#
# pi-gen config for AryaOS
Expand All @@ -16,8 +18,7 @@
#

# shellcheck disable=SC2034
AOS_FLAVOR="AryaOS"
IMG_NAME="aryaos"
IMG_NAME="aryaos-$(git describe --exact-match --tags HEAD 2>/dev/null || git rev-parse --short HEAD)"
PI_GEN_RELEASE="AryaOS: The Operating System for Modern Situational Awareness."
TARGET_HOSTNAME="aryaos"
FIRST_USER_NAME="pi"
Expand All @@ -33,8 +34,6 @@ KEYBOARD_LAYOUT="English (US)"
KEYBOARD_KEYMAP="us"
ENABLE_SSH=1
APT_PROXY="http://172.17.2.88:3142"
DUMP1090_RECEIVER_SERIAL="stx:1090:0"
DUMP978_RECEIVER_SERIAL="stx:978:0"
COMITUP_WEB_PORT="9080"
# Hack: This is a workaround for the fact that the shared_files directory is not being copied to the build directory.
SHARED_FILES="../../../shared_files"
export SHARED_FILES="../../../shared_files"
2 changes: 2 additions & 0 deletions pi-gen/stage03-base/prerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi

export SHARED_FILES=../shared_files
6 changes: 4 additions & 2 deletions pi-gen/stage04-wifi/00-install/00-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,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 All @@ -15,4 +17,4 @@
#

# FIXME DEPRECATED: Replace old NetworkManager Python module. https://github.com/snstac/aryaos/issues/54
install -v -m 644 "${SHARED_FILES/aryaos/NetworkManager.py" "${ROOTFS_DIR}/usr/lib/python3/dist-packages/NetworkManager.py"
install -v -m 644 "${SHARED_FILES}/aryaos/NetworkManager.py" "${ROOTFS_DIR}/usr/lib/python3/dist-packages/NetworkManager.py"
4 changes: 3 additions & 1 deletion pi-gen/stage04-wifi/00-install/02-run-chroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,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
14 changes: 8 additions & 6 deletions pi-gen/stage04-wifi/00-install/03-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,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 All @@ -18,8 +20,8 @@
# sed --follow-symlinks -i -E -e "s/SERVER_PORT = 80/SERVER_PORT = ${COMITUP_WEB_PORT}/" /usr/share/comitup/web/comitupweb.py
sed --follow-symlinks -i -E -e "s/port=80/port=9080/" "${ROOTFS_DIR}/usr/share/comitup/web/comitupweb.py"

install -v -m 644 files/comitup.conf "${ROOTFS_DIR}/etc/"
install -v -m 755 files/run_comitup.sh "${ROOTFS_DIR}/usr/local/sbin/"
install -v -m 755 files/comitup-callback.sh "${ROOTFS_DIR}/usr/local/sbin/"
install -v -m 644 files/comitup.service "${ROOTFS_DIR}/lib/systemd/system/"
install -v -m 644 files/comitup.json "${ROOTFS_DIR}/var/lib/comitup/"
install -v -m 644 "${SHARED_FILES}/aryaos/comitup.conf" "${ROOTFS_DIR}/etc/"
install -v -m 755 "${SHARED_FILES}/aryaos/run_comitup.sh" "${ROOTFS_DIR}/usr/local/sbin/"
install -v -m 755 "${SHARED_FILES}/aryaos/comitup-callback.sh" "${ROOTFS_DIR}/usr/local/sbin/"
install -v -m 644 "${SHARED_FILES}/aryaos/comitup.service" "${ROOTFS_DIR}/lib/systemd/system/"
install -v -m 644 "${SHARED_FILES}/aryaos/comitup.json" "${ROOTFS_DIR}/var/lib/comitup/"
2 changes: 2 additions & 0 deletions pi-gen/stage04-wifi/prerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi

export SHARED_FILES=../shared_files
2 changes: 2 additions & 0 deletions pi-gen/stage05-node-red/prerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi

export SHARED_FILES=../shared_files
2 changes: 2 additions & 0 deletions pi-gen/stage06-common/prerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi

export SHARED_FILES=../shared_files
2 changes: 2 additions & 0 deletions pi-gen/stage07-air/prerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi

export SHARED_FILES=../shared_files
2 changes: 2 additions & 0 deletions pi-gen/stage08-sea/prerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi

export SHARED_FILES=../shared_files
10 changes: 7 additions & 3 deletions pi-gen/stage09-uas/00-install/00-run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash -e
# AryaOS 00-run.sh
# 00-run.sh
#
# Copyright Sensors & Signals LLC https://www.snstac.com/
#
Expand All @@ -14,6 +14,10 @@
# limitations under the License.
#

rsync -va "${SHARED_FILES}/uas/docker-uas-broker" "${ROOTFS_DIR}/usr/src/"
rsync -va "${SHARED_FILES}/uas/docker-uas-sensor" "${ROOTFS_DIR}/usr/src/"

rsync -va "${SHARED_FILES}/uas/docker-uas-broker" "${ROOTFS_DIR}/home/pi/"
rsync -va "${SHARED_FILES}/uas/docker-uas-sensor" "${ROOTFS_DIR}/home/pi/"
install -v -m 755 "${SHARED_FILES}/uas/reset_wlan.sh" "${ROOTFS_DIR}/usr/local/sbin/"

mkdir -p "${ROOTFS_DIR}/etc/systemd/service/dronecot.service.d"
install -v -m 0644 "${SHARED_FILES}/uas/execprestart.conf" "${ROOTFS_DIR}/etc/systemd/service/dronecot.service.d"
2 changes: 1 addition & 1 deletion pi-gen/stage09-uas/00-install/01-run-chroot.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash -e
# AryaOS 01-run-chroot.sh
# 01-run-chroot.sh
#
# Copyright Sensors & Signals LLC https://www.snstac.com/
#
Expand Down
2 changes: 2 additions & 0 deletions pi-gen/stage09-uas/prerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi

export SHARED_FILES=../shared_files
2 changes: 2 additions & 0 deletions pi-gen/stage10-docker/prerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi

export SHARED_FILES=../shared_files
30 changes: 0 additions & 30 deletions shared_files/uas/AryaUAS.service

This file was deleted.

37 changes: 0 additions & 37 deletions shared_files/uas/DroneCOT.service

This file was deleted.

34 changes: 0 additions & 34 deletions shared_files/uas/enable_AryaUAS.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# AryaOS dronecot-config.txt
#
# dronecot Env configuration file.
# execprestart.conf Reset WLAN before starting the 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,3 +15,5 @@
# limitations under the License.
#

[Service]
ExecStartPre=/usr/local/sbin/reset_wlan.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/bash
# AryaOS run_dronecot.sh
#
# Startup file for dronecot.
# reset_wlan.sh Reset WLAN interfaces.
#
# 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 @@ -17,15 +17,11 @@
#

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

if [ -f $AOS_CONFIG ]; then
. $AOS_CONFIG
fi
AOS_CONFIG="/etc/aryaos-config.txt"

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

set +a
Expand All @@ -36,5 +32,3 @@ nmcli dev set wlan0 managed no || true
nmcli dev set wlan1 managed no || true
nmcli dev set wlan2 managed no || true
nmcli dev set wlan3 managed no || true

/usr/local/bin/dronecot

0 comments on commit 735fee2

Please sign in to comment.