mirror of
https://github.com/zerotier/edge.git
synced 2026-05-22 16:25:05 -07:00
53 lines
850 B
Bash
Executable File
53 lines
850 B
Bash
Executable File
#!/bin/sh
|
|
|
|
PREFIX=
|
|
|
|
. "$PREFIX/lib/libalpine.sh"
|
|
|
|
usage() {
|
|
cat <<-__EOF__
|
|
usage: setup-sshd [-h] [-c choice of SSH daemon]
|
|
|
|
Setup sshd daemon
|
|
|
|
options:
|
|
-h Show this help
|
|
-c Choice of SSH daemon: openssh dropbear none
|
|
__EOF__
|
|
exit 1
|
|
}
|
|
|
|
while getopts "hc:" opt; do
|
|
case $opt in
|
|
h) usage;;
|
|
c) sshdchoice="$OPTARG";;
|
|
esac
|
|
done
|
|
|
|
if [ "$sshdchoice" = "" ]; then
|
|
echo -n "Which SSH server? ('openssh', 'dropbear' or 'none') [openssh] "
|
|
default_read sshdchoice "openssh"
|
|
fi
|
|
|
|
if [ "$sshdchoice" = "none" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
pkgs="$sshdchoice"
|
|
if [ "$sshdchoice" = "openssh" ] && apk info --quiet --installed acf-core; then
|
|
pkgs="$pkgs acf-openssh"
|
|
fi
|
|
|
|
apk add --quiet $pkgs
|
|
|
|
svc=
|
|
case "$sshdchoice" in
|
|
openssh) svc=sshd;;
|
|
dropbear) svc=dropbear;;
|
|
esac
|
|
|
|
if [ -n "$svc" ]; then
|
|
rc-update add $svc default
|
|
rc-service $svc start
|
|
fi
|