Files
Anand 8170b5c354 Fix release workflow: restore +x on shell scripts, harden zip install
scripts/build.sh, get.sh, and scripts/linux/*.sh had lost their executable
bit in git (core.fileMode=false on this Windows checkout meant a local
chmod +x never made it into the index) — release.yml invokes
scripts/build.sh directly rather than via `bash`, so the CI job failed
immediately with exit code 126 (permission denied). Also invoke it via
`bash` explicitly as a second line of defense, and fix the zip-install
step's `||`/`&&` operator precedence (it always ran apt-get regardless of
whether zip was already present, harmless but not what it looked like).

Verified locally end-to-end: scripts/build.sh all now builds and packages
all 6 platform targets and every checksum verifies.
2026-09-03 14:18:45 +05:30

46 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Stops and removes the ferrum systemd service and binary. Configuration
# (/etc/ferrum) and data (/var/lib/ferrum) are kept by default — pass
# --purge to remove those too, and --purge-user to also drop the 'ferrum'
# system user.
#
# Usage: sudo ./uninstall.sh [--purge] [--purge-user]
set -euo pipefail
if [ "$(id -u)" -ne 0 ]; then
echo "error: must be run as root (sudo ./uninstall.sh)" >&2
exit 1
fi
purge=false
purge_user=false
for arg in "$@"; do
case "$arg" in
--purge) purge=true ;;
--purge-user) purge_user=true ;;
*) echo "unknown argument: $arg" >&2; exit 1 ;;
esac
done
echo "==> Stopping and disabling ferrum.service"
systemctl disable --now ferrum.service 2>/dev/null || true
echo "==> Removing systemd unit and binary"
rm -f /etc/systemd/system/ferrum.service
systemctl daemon-reload
rm -f /usr/local/bin/ferrum
if $purge; then
echo "==> Purging /etc/ferrum and /var/lib/ferrum"
rm -rf /etc/ferrum /var/lib/ferrum
else
echo "==> Keeping /etc/ferrum and /var/lib/ferrum (pass --purge to remove them)"
fi
if $purge_user; then
echo "==> Removing system user 'ferrum'"
userdel ferrum 2>/dev/null || true
fi
echo "==> Done."