From 53a0bf58133db54d77bdfa14b4cbbc550e913e53 Mon Sep 17 00:00:00 2001 From: Erich Blume Date: Fri, 16 Jan 2026 22:36:28 -0800 Subject: [PATCH] Fix macOS compatibility in kiwix torrent sync script BSD head (macOS) doesn't support negative line counts like GNU head. Use `sed '$d'` instead of `head -n -1` to remove the last line. Co-Authored-By: Claude Opus 4.5 --- ansible/roles/kiwix/templates/kiwix-sync-torrents.sh.j2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ansible/roles/kiwix/templates/kiwix-sync-torrents.sh.j2 b/ansible/roles/kiwix/templates/kiwix-sync-torrents.sh.j2 index d95d7dd..4a293b3 100644 --- a/ansible/roles/kiwix/templates/kiwix-sync-torrents.sh.j2 +++ b/ansible/roles/kiwix/templates/kiwix-sync-torrents.sh.j2 @@ -16,7 +16,8 @@ if [[ ! -f "$TORRENT_LIST" ]]; then fi # Get current torrents from transmission (extract names, skip header/footer) -current_torrents=$(transmission-remote -l 2>/dev/null | tail -n +2 | head -n -1 | awk '{print $NF}' || true) +# Note: Use sed '$d' instead of head -n -1 for macOS compatibility +current_torrents=$(transmission-remote -l 2>/dev/null | tail -n +2 | sed '$d' | awk '{print $NF}' || true) added=0 skipped=0