39 lines
1.0 KiB
Bash
39 lines
1.0 KiB
Bash
#!/bin/bash
|
|
# Install blair-sync-rustdesk-via-ga.sh from Gitea raw URL. Run on pve as root.
|
|
set -euo pipefail
|
|
|
|
BASE_URL="${BLAIR_SYNC_BASE_URL:-https://git.easygoingaming.com/Davoguha/blair-pve-sync-temp/raw/main}"
|
|
TARGET='/usr/local/sbin/blair-sync-rustdesk-via-ga.sh'
|
|
SHARE_COPY='/tank/blair-share/tools/golden/host/sync-rustdesk-via-guest-agent.sh'
|
|
CRON='/etc/cron.d/blair-rustdesk-sync'
|
|
LOG='/var/log/blair-rustdesk-sync.log'
|
|
|
|
echo "=== Download sync script ==="
|
|
curl -fsSL "$BASE_URL/blair-sync-rustdesk-via-ga.sh" -o "$TARGET"
|
|
chmod +x "$TARGET"
|
|
sed -i 's/\r$//' "$TARGET" 2>/dev/null || true
|
|
|
|
mkdir -p "$(dirname "$SHARE_COPY")"
|
|
cp -f "$TARGET" "$SHARE_COPY"
|
|
chmod +x "$SHARE_COPY"
|
|
|
|
echo "=== shebang check ==="
|
|
head -1 "$TARGET" | od -An -tx1
|
|
file "$TARGET"
|
|
|
|
echo "=== cron ==="
|
|
printf '%s\n' "*/5 * * * * root $TARGET >> $LOG 2>&1" > "$CRON"
|
|
chmod 644 "$CRON"
|
|
cat "$CRON"
|
|
|
|
echo "=== dry run ==="
|
|
BLAIR_VERBOSE=1 "$TARGET" --dry-run
|
|
|
|
echo "=== live run ==="
|
|
"$TARGET"
|
|
|
|
echo "=== VM 230 description ==="
|
|
qm config 230 | grep ^description || true
|
|
|
|
echo "=== done ==="
|