Files
alpine-server-setup/update.sh
2025-09-23 20:55:46 +02:00

34 lines
823 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
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.policy.json"
awall enable "$POLICY_NAME.policy"
done
cd "$base_dir"
done
echo "Activating firewall..."
awall activate