forked from finn/tinyboard
offboard-spoke.sh: run as root, remove sudo from python3 install
This commit is contained in:
@@ -28,8 +28,20 @@ check_deps() {
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
die "Run as the hub user, not root."
|
||||
[ "$(id -u)" -eq 0 ] || die "Run as root"
|
||||
|
||||
if ! command -v python3 >/dev/null 2>&1; then
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
apt-get install -y -q python3
|
||||
elif command -v dnf >/dev/null 2>&1; then
|
||||
dnf install -y -q python3
|
||||
elif command -v yum >/dev/null 2>&1; then
|
||||
yum install -y -q python3
|
||||
elif command -v pacman >/dev/null 2>&1; then
|
||||
pacman -S --noconfirm python
|
||||
else
|
||||
die "python3 not found and no supported package manager to install it"
|
||||
fi
|
||||
fi
|
||||
|
||||
check_deps rclone crontab python3
|
||||
|
||||
@@ -162,12 +162,13 @@ for DIRECTIVE in "GatewayPorts yes" "AllowTcpForwarding yes" "ClientAliveInterva
|
||||
done
|
||||
|
||||
SSH_SVC=""
|
||||
if systemctl list-unit-files ssh.service >/dev/null 2>&1 && systemctl enable ssh 2>/dev/null; then
|
||||
if systemctl list-unit-files ssh.service >/dev/null 2>&1; then
|
||||
SSH_SVC="ssh"
|
||||
elif systemctl list-unit-files sshd.service >/dev/null 2>&1 && systemctl enable sshd 2>/dev/null; then
|
||||
elif systemctl list-unit-files sshd.service >/dev/null 2>&1; then
|
||||
SSH_SVC="sshd"
|
||||
fi
|
||||
if [ -n "$SSH_SVC" ]; then
|
||||
systemctl enable "$SSH_SVC" 2>/dev/null || true
|
||||
systemctl restart "$SSH_SVC"
|
||||
info "SSH server restarted."
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user