# this script automaticly sets up the progam and makes it executeable. #!/usr/bin/env bash set -euo pipefail PREFIX_BIN="/usr/local/bin" SYSTEMD_DIR="/etc/systemd/system" REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" main_script="$(find "$REPO_DIR" -maxdepth 1 -type f -name "killswitch*" ! -name "*.target" | head -n 1)" target_file="$(find "$REPO_DIR" -maxdepth 1 -type f -name "*.target" | head -n 1)" if [[ -z "${main_script:-}" ]]; then echo "main script not found" exit 1 fi if [[ -z "${target_file:-}" ]]; then echo "systemd target not found" exit 1 fi echo "installing cli" install -m 755 "$main_script" "$PREFIX_BIN/$(basename "$main_script")" echo "installing systemd target" install -m 644 "$target_file" "$SYSTEMD_DIR/$(basename "$target_file")" echo "reloading systemd" systemctl daemon-reload echo "done" echo "binary: $PREFIX_BIN/$(basename "$main_script")" echo "target: $SYSTEMD_DIR/$(basename "$target_file")"