Files
sharedinbox/deploy.sh
Thomas SharedInboxandClaude Sonnet 4.6 f7fbb9cf7b fix: enforce non-root execution in Taskfile and shell scripts
Adds a root-user guard to Taskfile's _preflight task (the shared
precondition for all local task commands) and to five scripts that can
be invoked directly outside of `task`. Also adds `rm -f` before
writing ~/.ssh/dagger_key in setup_dagger_remote.sh to safely remove
any existing file or symlink before writing the new key.

Closes #414

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 22:46:08 +02:00

23 lines
764 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
[ "$(id -u)" != "0" ] || { echo "ERROR: Do not run as root. See DEVELOPMENT.md."; exit 1; }
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
# Load .env into environment
set -a
# shellcheck source=.env
source "$REPO_DIR/.env"
set +a
# SSH_PRIVATE_KEY must not live in .env (dagger parses .env and chokes on multiline values)
export SSH_PRIVATE_KEY=$(cat "$HOME/.ssh/id_ed25519")
# Add nix profile and nix store tools (task, dagger) to PATH
export PATH="$HOME/.nix-profile/bin:$PATH"
for pkg in "*go-task-*/bin/task" "*dagger-*/bin/dagger" "*fgj-*/bin/fgj"; do
bin=$(ls -d /nix/store/$pkg 2>/dev/null | sort -V | tail -1)
[ -n "$bin" ] && export PATH="$(dirname "$bin"):$PATH"
done
exec python3 "$REPO_DIR/deploy_cron.py"