Files
alpine-server-setup/update.sh
Maurice aea521cba4 Update
2025-09-24 14:00:38 +02:00

35 lines
871 B
Bash

#!/bin/sh
base_dir=$(pwd)
echo "Updating service scripts..."
podman-openrc ./services /etc/init.d/
# Update services (awall policies, scripts)
for service in "./services"/*/; do
[ -d "$service" ] || continue
cd "$service" || continue
# Run install.sh if installing for the first time (if $1 is "install")
if [ "$1" = "install" ] && [ -f "install.sh" ]; then
read -n 1 -s -r -p "Press any key to install $service..."
source ./install.sh
fi
# Run update.sh if present
if [ -f "update.sh" ]; then
source ./update.sh
fi
# Symlink and activate each *.policy.json
for policy in *.policy.json; do
[ -e "$policy" ] || continue
POLICY_NAME="${policy%.policy.json}"
ln -sf "./$policy" "/etc/awall/optional/$POLICY_NAME.json"
awall enable "$POLICY_NAME"
done
cd "$base_dir"
done
echo "Activating firewall..."
awall activate