0c68fb2461
- kit-connect SPK (ipq806x): postinst with hub registration, start-stop-status, connect-daemon management, Tailscale + reverse SSH tunnel integration - syno-balance SPK (noarch, test build): SmartWAN-aware dual-WAN load balancer with 6-factor scoring engine, syno-daemon lifecycle - Busfleet hub: register.sh (port pool 2230-2299), Python HTTP server, systemd service, port-registry.json with x4078/x5925 assignments - .gitignore: exclude SSH keys (*_id_ed25519), SPK artifacts (*.spk) Gitea releases: - kit-connect v0.1-0001 → x5925-kit-connect-v1 (production) - syno-balance v0.1-0001 → syno-balance-test-v1 (prerelease) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
# kit-connect postinst — register with hub, set up config
|
|
PKG_DIR="/var/packages/kit-connect/target"
|
|
CONF="/etc/kit-connect/connect.conf"
|
|
LOG_TAG="kit-connect"
|
|
|
|
log() { logger -t "$LOG_TAG" -p local0.warn "$*"; }
|
|
|
|
mkdir -p /etc/kit-connect "$PKG_DIR/var"
|
|
|
|
# If config doesn't exist, create from template
|
|
if [ ! -f "$CONF" ]; then
|
|
cp "$PKG_DIR/conf/connect.conf" "$CONF"
|
|
fi
|
|
|
|
# Prompt for device ID if not set
|
|
DEVICE_ID=$(cat /etc/busrouter/device-id 2>/dev/null || echo "")
|
|
if [ -z "$DEVICE_ID" ]; then
|
|
DEVICE_ID=$(hostname 2>/dev/null || echo "unknown")
|
|
fi
|
|
|
|
# Write device ID into config
|
|
sed -i "s/^DEVICE_ID=.*/DEVICE_ID=$DEVICE_ID/" "$CONF" 2>/dev/null
|
|
|
|
# Set hostname for Tailscale
|
|
sed -i "s/^TAILSCALE_HOSTNAME=.*/TAILSCALE_HOSTNAME=$DEVICE_ID/" "$CONF" 2>/dev/null
|
|
|
|
# Install tailscale binaries if not present
|
|
if [ ! -f /usr/local/bin/tailscale ]; then
|
|
if [ -f "$PKG_DIR/bin/tailscale" ]; then
|
|
cp "$PKG_DIR/bin/tailscale" "$PKG_DIR/bin/tailscaled" /usr/local/bin/ 2>/dev/null
|
|
chmod +x /usr/local/bin/tailscale /usr/local/bin/tailscaled 2>/dev/null
|
|
fi
|
|
fi
|
|
|
|
# Set key permissions
|
|
chmod 600 "$PKG_DIR/bin/connect_id_ed25519" 2>/dev/null
|
|
|
|
# Try hub registration (non-fatal — daemon retries)
|
|
curl -s --connect-timeout 10 "http://162.243.83.36:8080/api/register/${DEVICE_ID}" 2>/dev/null || true
|
|
|
|
log "postinst complete — device=${DEVICE_ID}"
|
|
exit 0
|