Skip to content

Commit

Permalink
removing pi-gen from ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
ampledata committed Aug 15, 2024
1 parent 0905bea commit c9394d9
Show file tree
Hide file tree
Showing 254 changed files with 46,819 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/deploy/
/pi-gen/
/config.local
.DS_Store
4 changes: 4 additions & 0 deletions pi-gen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/deploy/
/pi-gen/
/config.local
.DS_Store
48 changes: 48 additions & 0 deletions pi-gen/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# AryaOS Makefile
#
# 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.
#


build: pi-gen
sudo ./build.sh

pi-gen:
git clone --branch arm64 https://github.com/RPI-Distro/pi-gen.git
touch ./pi-gen/stage2/SKIP_IMAGES ./pi-gen/stage2/SKIP_NOOBS

copy:
rsync -va ../../aryaos kelp.local:~/src/SNS/

sync: copy

skip:
touch pi-gen/stage0/SKIP
touch pi-gen/stage1/SKIP
touch pi-gen/stage2/SKIP

unskip:
rm -f */SKIP
rm -f pi-gen/*/SKIP

copyback:
scp pi-gen/deploy/image*.zip [email protected]:~

skip3:
touch stage3*/SKIP

skip4:
touch stage4*/SKIP

skip5:
touch stage5*/SKIP
18 changes: 18 additions & 0 deletions pi-gen/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# AryaOS build.sh
#
# 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.
#

# shellcheck disable=SC2164
(cd ./pi-gen; ./build.sh -c ../config)
39 changes: 39 additions & 0 deletions pi-gen/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# AryaOS config
#
# pi-gen config for AryaOS
#
# 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.
#

# shellcheck disable=SC2034
AOS_FLAVOR="AryaOS"
IMG_NAME="aryaos-2.0.0-beta01"
PI_GEN_RELEASE="AryaOS: The Operating System for Modern Situational Awareness."
TARGET_HOSTNAME="aryaos"
FIRST_USER_NAME="pi"
FIRST_USER_PASS="aryaos415"
STAGE_LIST="stage0 stage1 stage2 ../stage03-base ../stage04-wifi ../stage05-node-red ../stage06-common ../stage07-air ../stage08-sea ../stage09-uas ../stage10-docker"
DISABLE_FIRST_BOOT_USER_RENAME=1
RELEASE="bookworm"
WPA_ESSID="AryaOS-WiFi"
WPA_PASSWORD="aryaos415"
WPA_COUNTRY="US"
LOCALE_DEFAULT="en_US.UTF-8"
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"
SHARED_FILES="../shared_files"
21 changes: 21 additions & 0 deletions pi-gen/stage03-base/00-install/00-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
gpsd
gpsd-clients

python3-pip
python3-cryptography

rtl-sdr
librtlsdr-dev

tcpdump
netcat-openbsd
nmap
socat
net-tools

git
tmux
vim
curl
wget
build-essential
34 changes: 34 additions & 0 deletions pi-gen/stage03-base/00-install/00-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash -e
# AryaOS 00-run.sh
#
# Establishes base configuration for AryaOS on the build machine.
#
# 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.
#

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/"

# 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}/"

# ZeroTier
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/"
42 changes: 42 additions & 0 deletions pi-gen/stage03-base/00-install/01-run-chroot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash -e
# AryaOS 01-run-chroot.sh
#
# Establishes base configuration for AryaOS on the build image.
#
# 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.
#


# RFC UUID
systemctl enable set_uuid
systemctl set-default multi-user


# Zerotier
/usr/local/sbin/install_zt.sh


# PyTAK
wget https://github.com/snstac/pytak/releases/latest/download/pytak_latest_all.deb
apt install -f ./pytak_latest_all.deb

wget https://github.com/snstac/takproto/releases/latest/download/takproto_latest_all.deb
apt install -f ./takproto_latest_all.deb

wget https://github.com/snstac/asyncinotify/releases/download/v4.0.9-4/python3-asyncinotify_4.0.9-1_all.deb
apt install -f ./python3-asyncinotify_4.0.9-1_all.deb

# Wireshark
echo "wireshark-common wireshark-common/install-setuid boolean true" | debconf-set-selections
echo "tshark-common tshark-common/install-setuid boolean true" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive apt install tshark -y
19 changes: 19 additions & 0 deletions pi-gen/stage03-base/prerun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash -e
# AryaOS prerun.sh
#
# 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.
#

if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi
2 changes: 2 additions & 0 deletions pi-gen/stage04-wifi/00-install/00-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
iptables
comitup
18 changes: 18 additions & 0 deletions pi-gen/stage04-wifi/00-install/00-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash -e
# AryaOS 00-run.sh
#
# 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.
#

# 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"
17 changes: 17 additions & 0 deletions pi-gen/stage04-wifi/00-install/02-run-chroot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -e
# AryaOS 02-run-chroot.sh
#
# 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.
#

systemctl enable NetworkManager
25 changes: 25 additions & 0 deletions pi-gen/stage04-wifi/00-install/03-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash -e
# AryaOS 03-run.sh
#
# 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.
#

# The main branch of comitup uses a different syntax.
# 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/"
19 changes: 19 additions & 0 deletions pi-gen/stage04-wifi/prerun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash -e
# AryaOS prerun.sh
#
# 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.
#

if [ ! -d "${ROOTFS_DIR}" ]; then
copy_previous
fi
2 changes: 2 additions & 0 deletions pi-gen/stage05-node-red/00-install/00-packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
npm
sudo
17 changes: 17 additions & 0 deletions pi-gen/stage05-node-red/00-install/00-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -e
# AryaOS run.sh
#
# 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.
#

install -v -m 755 files/update-nodejs-and-nodered "${ROOTFS_DIR}/usr/local/sbin"
49 changes: 49 additions & 0 deletions pi-gen/stage05-node-red/00-install/01-run-chroot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash -e
# AryaOS run-chroot.sh
#
# Node-RED intaller and setup script for AryaOS.
#
# 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.
#

id node-red || adduser --disabled-password --gecos 'Node-RED Service User' node-red

# FIXME: I don't think this is required?
usermod -aG sudo node-red
# Let node-red see systemd logs:
usermod -aG adm node-red
# Let node-red get GPU stats:
usermod -aG video node-red
# Let node-red get SDR info:
usermod -aG plugdev node-red

# Install Node-RED using the node-red installer:
bash /usr/local/sbin/update-nodejs-and-nodered --confirm-install --nodered-user=node-red --confirm-root --no-init

# Install Node-RED pallet modules:
cd /home/node-red/.node-red
npm install node-red-contrib-tak
npm install node-red-contrib-sitx
npm install node-red-contrib-tfr2cot
npm install node-red-contrib-web-worldmap
npm install node-red-dashboard
npm install node-red-node-ui-table
npm install node-red-contrib-ui-upload
npm install node-red-contrib-qrcode-generator
npm install axios

mkdir -p /home/node-red/tmpConf

chown -R node-red:node-red /home/node-red

systemctl enable nodered
Loading

0 comments on commit c9394d9

Please sign in to comment.