forked from finn/tinyboard
fix SSH service detection across distros; fix misleading key copied message
This commit is contained in:
@@ -155,10 +155,14 @@ info "Adding $SPOKE_USER to docker group..."
|
||||
usermod -aG docker "$SPOKE_USER" 2>/dev/null || true
|
||||
|
||||
info "Enabling SSH server..."
|
||||
if systemctl enable ssh 2>/dev/null; then
|
||||
systemctl start ssh
|
||||
elif systemctl enable sshd 2>/dev/null; then
|
||||
systemctl start sshd
|
||||
SSH_SVC=""
|
||||
if systemctl list-unit-files ssh.service >/dev/null 2>&1 && systemctl enable ssh 2>/dev/null; then
|
||||
SSH_SVC="ssh"
|
||||
elif systemctl list-unit-files sshd.service >/dev/null 2>&1 && systemctl enable sshd 2>/dev/null; then
|
||||
SSH_SVC="sshd"
|
||||
fi
|
||||
if [ -n "$SSH_SVC" ]; then
|
||||
systemctl start "$SSH_SVC"
|
||||
else
|
||||
warn "Could not enable SSH service — please start it manually."
|
||||
fi
|
||||
@@ -252,9 +256,7 @@ if [[ "${DISABLE_PASS,,}" == "y" ]]; then
|
||||
warn "If you are connected via SSH, your session may drop."
|
||||
warn "Make sure you can reconnect using your key before continuing."
|
||||
read -rp "Press ENTER to restart SSH or CTRL+C to abort..."
|
||||
if systemctl restart ssh 2>/dev/null; then
|
||||
info "SSH restarted."
|
||||
elif systemctl restart sshd 2>/dev/null; then
|
||||
if [ -n "$SSH_SVC" ] && systemctl restart "$SSH_SVC" 2>/dev/null; then
|
||||
info "SSH restarted."
|
||||
else
|
||||
warn "Could not restart SSH — please restart it manually."
|
||||
|
||||
Reference in New Issue
Block a user