3edbf1284b
Sockets are ephemeral IPC endpoints with PID-based names — they get recreated on every samba restart and can't be backed up meaningfully. Was causing every nightly rsync to USB to recopy them.
39 lines
1.2 KiB
Bash
Executable File
39 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Copies system config files into the repo and commits if anything changed.
|
|
# File mapping is defined in system/tracked-configs.
|
|
# Intended to run via cron (e.g., daily).
|
|
set -euo pipefail
|
|
|
|
REPO="/opt/argento"
|
|
|
|
# Copy each tracked config into the repo
|
|
while IFS=: read -r src dest; do
|
|
[ -z "$src" ] && continue
|
|
[[ "$src" = \#* ]] && continue
|
|
if [ -f "$src" ]; then
|
|
cp "$src" "$REPO/$dest"
|
|
fi
|
|
done < "$REPO/system/tracked-configs"
|
|
|
|
sed -i 's/^password .*/password REDACTED/' "$REPO/system/msmtprc"
|
|
|
|
# Mirror samba's binary passdb files into the repo so backup.sh's standard
|
|
# rsync of /opt/argento/ picks them up. Gitignored — credential hashes don't
|
|
# belong in version control, but they DO need to ride along on the USB backup.
|
|
install -d -m 700 "$REPO/system/samba-private"
|
|
rsync -a --delete --exclude='msg.sock/' /var/lib/samba/private/ "$REPO/system/samba-private/"
|
|
|
|
# Sync root crontab
|
|
crontab -l > "$REPO/system/root-crontab" 2>/dev/null || true
|
|
|
|
cd "$REPO"
|
|
|
|
# Stage and check if anything changed
|
|
git add system/
|
|
if git diff --cached --quiet; then
|
|
exit 0
|
|
fi
|
|
|
|
git commit -m "auto: sync system configs"
|
|
git push || echo "Push failed (remote ahead?) — committed locally, will push next time."
|