forked from finn/tinyboard
add spoke registry, per-spoke crontab, and offboard-spoke.sh
This commit is contained in:
@@ -251,19 +251,6 @@ mkdir -p "$MOUNT_POINT"
|
||||
chown "$HUB_USER":"$HUB_USER" "$MOUNT_POINT"
|
||||
info "Mount point created at $MOUNT_POINT."
|
||||
|
||||
header "Crontab Setup"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
HELPER="$SCRIPT_DIR/../hubspoke-helper.sh"
|
||||
CRON_LINE="@reboot $HELPER hub start-background"
|
||||
EXISTING=$(crontab -u "$HUB_USER" -l 2>/dev/null || true)
|
||||
|
||||
if echo "$EXISTING" | grep -qF "hub start-background"; then
|
||||
warn "Crontab entry already exists, skipping."
|
||||
else
|
||||
(echo "$EXISTING"; echo "$CRON_LINE") | crontab -u "$HUB_USER" -
|
||||
info "Added @reboot crontab entry for rclone mount."
|
||||
fi
|
||||
|
||||
header "Hub Setup Complete"
|
||||
echo -e " Hub user: ${GREEN}$HUB_USER${NC}"
|
||||
echo -e " SSH config: ${GREEN}GatewayPorts yes, AllowTcpForwarding yes${NC}"
|
||||
|
||||
9
setup.sh
9
setup.sh
@@ -17,9 +17,10 @@ header "TinyBoard Setup"
|
||||
echo ""
|
||||
echo " 1) Set up this device as a new spoke"
|
||||
echo " 2) Onboard a new spoke from the hub"
|
||||
echo " 3) Set up this device as a new hub"
|
||||
echo " 3) Offboard a spoke from the hub"
|
||||
echo " 4) Set up this device as a new hub"
|
||||
echo ""
|
||||
read -rp "Choose [1/2/3]: " CHOICE
|
||||
read -rp "Choose [1/2/3/4]: " CHOICE
|
||||
|
||||
case "$CHOICE" in
|
||||
1)
|
||||
@@ -32,6 +33,10 @@ case "$CHOICE" in
|
||||
exec "$SCRIPT_DIR/hub/onboard-spoke.sh"
|
||||
;;
|
||||
3)
|
||||
info "Starting hub offboarding..."
|
||||
exec "$SCRIPT_DIR/hub/offboard-spoke.sh"
|
||||
;;
|
||||
4)
|
||||
[ "$(id -u)" -eq 0 ] || die "Hub setup must be run as root"
|
||||
info "Starting hub setup..."
|
||||
exec "$SCRIPT_DIR/hub/setup-hub.sh"
|
||||
|
||||
Reference in New Issue
Block a user