-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # .github/workflows/build.yml
- Loading branch information
Showing
30 changed files
with
185 additions
and
196 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,61 @@ | ||
#!/bin/bash | ||
|
||
# Check arguments | ||
if [ -z "$1" ]; then | ||
echo "sailtrack-build: missing argument: DIETPI_IMG_NAME" | ||
echo "Usage: sailtrack-build DIETPI_IMG_NAME OUTPUT_IMG_NAME" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$2" ]; then | ||
echo "sailtrack-build: missing argument: OUTPUT_IMG_NAME" | ||
echo "Usage: sailtrack-build DIETPI_IMG_NAME OUTPUT_IMG_NAME" | ||
exit 1 | ||
fi | ||
|
||
# Set variables | ||
DIETPI_IMG_NAME=$1 | ||
OUTPUT_IMG_NAME=$2 | ||
|
||
# Download and extract image | ||
wget -N "https://dietpi.com/downloads/images/$DIETPI_IMG_NAME.7z" -P /tmp/sailtrack-build || exit 1 | ||
7z e -aoa -o"/tmp/sailtrack-build/$DIETPI_IMG_NAME" "/tmp/sailtrack-build/$DIETPI_IMG_NAME.7z" | ||
|
||
# Mount image | ||
FP_LOOP=$(losetup --show -f -P "/tmp/sailtrack-build/$DIETPI_IMG_NAME/$DIETPI_IMG_NAME.img") | ||
mkdir /tmp/sailtrack-build/mnt | ||
mount "${FP_LOOP}p2" /tmp/sailtrack-build/mnt | ||
mount "${FP_LOOP}p1" /tmp/sailtrack-build/mnt/boot | ||
|
||
# Copy files | ||
cp -v LICENSE /tmp/sailtrack-build/mnt/boot/sailtrack-LICENSE.txt | ||
cp -v README.md /tmp/sailtrack-build/mnt/boot/sailtrack-README.md | ||
cp -v dietpi.txt /tmp/sailtrack-build/mnt/boot/dietpi.txt | ||
cp -v Automation_Custom_Script.sh /tmp/sailtrack-build/mnt/boot/Automation_Custom_Script.sh | ||
cp -vr sailtrack /tmp/sailtrack-build/mnt/boot/sailtrack | ||
cp -vrT rootfs /tmp/sailtrack-build/mnt | ||
|
||
# Unmount image | ||
umount -R /tmp/sailtrack-build/mnt | ||
losetup -d "$FP_LOOP" | ||
|
||
# Rename image | ||
mv "/tmp/sailtrack-build/$DIETPI_IMG_NAME/$DIETPI_IMG_NAME.img" "/tmp/sailtrack-build/$DIETPI_IMG_NAME/$OUTPUT_IMG_NAME.img" | ||
|
||
# Update hashes | ||
echo -n "Generating hashes..." | ||
cat << _EOF_ > "/tmp/sailtrack-build/$DIETPI_IMG_NAME/hash.txt" | ||
FILE: $OUTPUT_IMG_NAME.img | ||
DATE: $(date -u) | ||
MD5: $(md5sum "/tmp/sailtrack-build/$DIETPI_IMG_NAME/$OUTPUT_IMG_NAME.img" | mawk '{print $1}') | ||
SHA1: $(sha1sum "/tmp/sailtrack-build/$DIETPI_IMG_NAME/$OUTPUT_IMG_NAME.img" | mawk '{print $1}') | ||
SHA256: $(sha256sum "/tmp/sailtrack-build/$DIETPI_IMG_NAME/$OUTPUT_IMG_NAME.img" | mawk '{print $1}') | ||
_EOF_ | ||
echo "done" | ||
|
||
# Update README | ||
cp -v README.md "/tmp/sailtrack-build/$DIETPI_IMG_NAME" | ||
|
||
# Create archive | ||
(( $(free -m | mawk '/Mem:/{print $2}') < 1750 && $(nproc) > 2 )) && limit_threads='-mmt2' | ||
7z a -m0=lzma2 -mx=9 $limit_threads "$OUTPUT_IMG_NAME.7z" "/tmp/sailtrack-build/$DIETPI_IMG_NAME/*" |
This file was deleted.
Oops, something went wrong.
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,25 @@ | ||
name: Publish GitHub Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
env: | ||
DIETPI_IMG_NAME: DietPi_RPi-ARMv8-Bullseye | ||
OUTPUT_IMG_NAME: SailTrack-Core_RPi-ARMv8-Bullseye | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Run SailTrack-Build | ||
run: sudo ./.build/sailtrack-build ${{ env.DIETPI_IMG_NAME }} ${{ env.OUTPUT_IMG_NAME }} | ||
|
||
- name: Publish release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: ${{ env.OUTPUT_IMG_NAME }}.7z | ||
generate_release_notes: true |
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
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 |
---|---|---|
@@ -1,42 +1,32 @@ | ||
. /boot/dietpi/func/dietpi-globals | ||
|
||
# Configure WiFi Hotspot | ||
/boot/dietpi/func/dietpi-set_hardware wifimodules onboard_enable | ||
/boot/dietpi/func/dietpi-set_hardware wificountrycode "$(sed -n '/^[[:blank:]]*AUTO_SETUP_NET_WIFI_COUNTRY_CODE=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)" | ||
|
||
# Configure RTC Module | ||
G_AGP fake-hwclock | ||
G_CONFIG_INJECT "dtoverlay=i2c-rtc,ds3231" "dtoverlay=i2c-rtc,ds3231" /boot/config.txt | ||
G_EXEC sed -i "/systemd/,/fi/s/^/#/" /lib/udev/hwclock-set | ||
G_EXEC sed -i "/--systz/s/^/#/" /lib/udev/hwclock-set | ||
|
||
# Install packages | ||
G_AGI avahi-daemon | ||
G_AGI telegraf | ||
G_EXEC pip3 install -r /boot/sailtrack/sailtrackd/requirements.txt | ||
# Configure X708 HAT | ||
G_CONFIG_INJECT "alias poweroff=/boot/sailtrack/sailtrack-x708_softsd" "alias poweroff=/boot/sailtrack/sailtrack-x708_softsd" /etc/bash.bashrc | ||
|
||
# Remove unused services | ||
G_EXEC rm /etc/systemd/system/dietpi-vpn.service | ||
G_EXEC rm /etc/systemd/system/dietpi-cloudshell.service | ||
|
||
# Merge filesystem | ||
G_EXEC cp -rT /boot/rootfs / | ||
G_EXEC rm -r /boot/rootfs | ||
# Uninstall OpenSSH Client | ||
/boot/dietpi/dietpi-software uninstall 0 | ||
|
||
# Install Telegraf | ||
G_AGI telegraf | ||
|
||
# Enable services | ||
for s in /etc/systemd/system/sailtrack*.service; do G_EXEC systemctl enable "$s"; done | ||
G_EXEC systemctl enable sailtrack-x708_asd | ||
G_EXEC systemctl enable sailtrack-x708_pwr | ||
G_CONFIG_INJECT "+ telegraf" "+ telegraf" /boot/dietpi/.dietpi-services_include_exclude | ||
for s in /etc/systemd/system/sailtrackd*.service; do | ||
servicename=$(basename "$s" .service) | ||
G_CONFIG_INJECT "+ $servicename" "+ $servicename" /boot/dietpi/.dietpi-services_include_exclude | ||
/boot/dietpi/dietpi-services dietpi_controlled "$servicename" | ||
done | ||
/boot/dietpi/dietpi-services dietpi_controlled telegraf | ||
G_CONFIG_INJECT "+ sailtrack-status" "+ sailtrack-status" /boot/dietpi/.dietpi-services_include_exclude | ||
G_EXEC /boot/dietpi/dietpi-services dietpi_controlled telegraf | ||
G_EXEC /boot/dietpi/dietpi-services dietpi_controlled sailtrack-status | ||
|
||
# Configure DietPi Banner | ||
index=0 | ||
for i in 1 1 1 0 0 1 0 0 0 0 0 0 0 0; do | ||
echo "aENABLED[$((index++))]=$i" >> /boot/dietpi/.dietpi-banner | ||
settings=(1 1 1 0 0 1 0 1 0 0 0 0 0 0 0 0) | ||
for i in "${!settings[@]}"; do | ||
G_CONFIG_INJECT "aENABLED\[$i]=" "aENABLED[$i]=${settings[$i]}" /boot/dietpi/.dietpi-banner | ||
done | ||
|
||
# Remove DietPi-VPN | ||
G_EXEC rm /etc/systemd/system/dietpi-vpn.service | ||
# Reboot after first boot is completed | ||
(while [ -f "/root/AUTO_CustomScript.sh" ]; do sleep 1; done; /usr/sbin/reboot) > /dev/null 2>&1 & | ||
|
||
# Reboot | ||
(while [ "$(</boot/dietpi/.install_stage)" != 2 ]; do sleep 1; done; /usr/sbin/reboot) > /dev/null 2>&1 & |
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
Oops, something went wrong.