setup-container: chmod the binary and improve missing-binary hint

When downloading a release asset over HTTP the executable bit is lost,
so checking '-x' would always fail. Check existence instead and chmod
unconditionally. Update the error message to cover the three common
install paths.
This commit is contained in:
Asger Weirsøe
2026-05-27 15:21:02 +02:00
parent 8652fcfbba
commit ed90151a24
+18 -3
View File
@@ -30,11 +30,26 @@ if ! command -v microsocks >/dev/null 2>&1; then
rm -rf "$tmp"
fi
# 3. Install fetch-service binary (forventes pushet ind af host-scriptet)
if [[ ! -x /usr/local/bin/weircon-random-proxy ]]; then
echo "ERR: /usr/local/bin/weircon-random-proxy mangler — push den fra host'en først" >&2
# 3. Install fetch-service binary.
# Forventes pushet/lagt på plads af brugeren før dette script køres
# (enten via `pct push` fra Proxmox-hosten, eller lokalt med `cp`).
BIN=/usr/local/bin/weircon-random-proxy
if [[ ! -f "$BIN" ]]; then
cat >&2 <<EOF
ERR: $BIN mangler.
Læg binæren på plads med én af:
- fra Proxmox-host: pct push <ctid> ./weircon-random-proxy $BIN --perms 0755
- fra inde i LXC: cp /path/to/weircon-random-proxy $BIN
chmod +x $BIN
- download release: curl -fLo $BIN https://<gitea>/<owner>/weircon-random-proxy/releases/download/<tag>/weircon-random-proxy
chmod +x $BIN
Kør derefter setup-container.sh igen.
EOF
exit 1
fi
chmod +x "$BIN"
# 4. Helper-scripts
install -Dm755 "$SCRIPT_DIR/netns-up.sh" /usr/local/sbin/weircon-netns-up