34 lines
1.0 KiB
Bash
Executable File
34 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
HOST="${HOST:-192.168.88.108}"
|
|
USER_NAME="${USER_NAME:-Admin}"
|
|
PASS="${PASS:-P@ssw0rd!}"
|
|
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
SCRIPT="$HERE/../powershell/setup-thunderbird.ps1"
|
|
CONFIG="$HERE/thunderbird-config.json"
|
|
LOG_DIR="$HERE/../../logs"
|
|
STAMP="$(date +%Y%m%d-%H%M%S)"
|
|
LOG="$LOG_DIR/setup-thunderbird-${HOST}-${STAMP}.log"
|
|
|
|
mkdir -p "$LOG_DIR"
|
|
|
|
SSH_OPTS=(-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=10)
|
|
|
|
if [[ ! -f "$CONFIG" ]]; then
|
|
echo "[!] Missing $CONFIG — please edit thunderbird-config.json first" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "[*] Uploading setup-thunderbird.ps1 and thunderbird-config.json"
|
|
sshpass -p "$PASS" scp "${SSH_OPTS[@]}" "$SCRIPT" "$CONFIG" \
|
|
"$USER_NAME@$HOST:C:/Users/$USER_NAME/" >/dev/null
|
|
|
|
echo "[*] Running setup on $HOST, log -> $LOG"
|
|
sshpass -p "$PASS" ssh "${SSH_OPTS[@]}" "$USER_NAME@$HOST" \
|
|
"powershell -NoProfile -ExecutionPolicy Bypass -File C:/Users/$USER_NAME/setup-thunderbird.ps1" \
|
|
2>&1 | tee "$LOG"
|
|
|
|
echo "[*] Done. Saved: $LOG"
|