summaryrefslogtreecommitdiff
path: root/setup-sshd.in
blob: d7f3986b46bb0425ba1c297894c79e2329a74cb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh

PREFIX=

. "$PREFIX/lib/libalpine.sh"

usage() {
        cat <<__EOF__
usage: setup-sshd [-hnp]

Setup sshd

options:
 -h  Show this help
__EOF__
        exit 1
}

while getopts "hn" opt; do
        case $opt in
		h) usage;;
        esac
done

echo "Sshd to setup? (openssh, dropbear, none) [openssh]"
default_read setupsshd "openssh"
if [ "$setupsshd" = "none" ]; then 
	exit 0
fi

acfinstalled="`apk version acf-core -q | awk '{print $1}'`"

if [ "setupsshd" = "openssh"]; then
	if [ "$acfinstalled" != "ERROR:" ]; then
		apk add acf-openssh -q
	else
		apk add openssh -q
	fi
elif [ "setupsshd" = "dropbear"]; then
	apk add dropbear
fi

/etc/init.d/sshd start
rc-update add sshd default