Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ builds:
- goos:
- linux
goarch:
- arm
- arm64
goarm:
- "7"
Expand Down
50 changes: 47 additions & 3 deletions _release/postinstall.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,48 @@
#!/bin/bash
systemctl daemon-reload
systemctl enable thermal-uploader.service
systemctl restart thermal-uploader.service
set -e

# --- Configuration ---
# Define all services and what systemd action should be taken.
# Format is "service.name:<none|restart|start>"
SERVICES_TO_MANAGE=(
"thermal-uploader.service:restart"
)

# Extract just the service names for the check
service_files=()
for config in "${SERVICES_TO_MANAGE[@]}"; do
service_files+=("${config%%:*}")
done

# Check all services at once to see if a reload is needed
if systemctl show "${service_files[@]}" --property=NeedDaemonReload | grep -q 'yes'; then
echo "systemd reports unit files have changed. Running daemon-reload..."
systemctl daemon-reload
else
echo "No service file changes detected. Skipping daemon-reload."
fi

# Process each service based on the configuration array
for service_config in "${SERVICES_TO_MANAGE[@]}"; do
SERVICE_NAME=${service_config%%:*}
ACTION=${service_config##*:}

echo "Processing service: $SERVICE_NAME"

if ! systemctl is-enabled --quiet "$SERVICE_NAME"; then
echo "Enabling '$SERVICE_NAME'..."
systemctl enable "$SERVICE_NAME"
else
echo "Service '$SERVICE_NAME' is already enabled."
fi

if [ "$ACTION" = "start" ]; then
echo "Starting '$SERVICE_NAME'..."
systemctl start "$SERVICE_NAME"
elif [ "$ACTION" = "restart" ]; then
echo "Restarting '$SERVICE_NAME'..."
systemctl restart "$SERVICE_NAME"
fi
done

echo "Post-installation script finished."
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/TheCacophonyProject/thermal-uploader

go 1.22.3
go 1.25.0

require (
github.com/TheCacophonyProject/go-api v1.2.3
Expand Down