#!/bin/sh
# Root helper for Captain Kill Switch's in-app updater on apt-repo installs.
# Refreshes ONLY the CKS repo's package list, then installs the newest
# captain-kill-switch from it. Shipped at /usr/libexec/ so polkit's auth
# dialog names a specific, auditable program (never `pkexec sh -c`).
set -eu
LIST=/etc/apt/sources.list.d/captain-kill-switch.list
[ -f "$LIST" ] || { echo "captain-kill-switch apt source is not configured" >&2; exit 1; }
apt-get update \
  -o Dir::Etc::sourcelist="$LIST" \
  -o Dir::Etc::sourceparts=/dev/null \
  -o APT::Get::List-Cleanup=0
DEBIAN_FRONTEND=noninteractive apt-get install -y captain-kill-switch
