- Add scripts/systemd/install.sh to handle placeholder substitution (__PROJECT_DIR__, __USER__) and systemd unit installation in one command - Simplify manual install instructions in SettingsPage and config.sh to reference the new install script - Preserve existing home.html and home.css in reset-site.sh instead of overwriting with templates - Add comments/ and partials/ to preserved directories list - Fix nav removal in mkdocs.yml using Python regex instead of fragile sed Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
1.1 KiB
Bash
Executable File
36 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# =============================================================================
|
|
# Install Changemaker Lite systemd units
|
|
# Substitutes __PROJECT_DIR__ and __USER__ placeholders with actual values.
|
|
# Usage: sudo ./scripts/systemd/install.sh
|
|
# =============================================================================
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
|
INSTALL_USER="${SUDO_USER:-$(whoami)}"
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
echo "ERROR: Must run as root (use sudo)." >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "Installing systemd units..."
|
|
echo " Project dir: ${PROJECT_DIR}"
|
|
echo " User: ${INSTALL_USER}"
|
|
|
|
for unit in "${SCRIPT_DIR}"/changemaker-upgrade.*; do
|
|
filename="$(basename "$unit")"
|
|
sed \
|
|
-e "s|__PROJECT_DIR__|${PROJECT_DIR}|g" \
|
|
-e "s|__USER__|${INSTALL_USER}|g" \
|
|
"$unit" > "/etc/systemd/system/${filename}"
|
|
echo " Installed ${filename}"
|
|
done
|
|
|
|
systemctl daemon-reload
|
|
systemctl enable --now changemaker-upgrade.path
|
|
|
|
echo "Done. Status:"
|
|
systemctl status changemaker-upgrade.path --no-pager
|