Commit e85f3810 authored by Jeff Bilyk's avatar Jeff Bilyk
Browse files

setup-sshd: cleanups and add command line options

parent b75c7351
...@@ -6,39 +6,48 @@ PREFIX= ...@@ -6,39 +6,48 @@ PREFIX=
usage() { usage() {
cat <<__EOF__ cat <<__EOF__
usage: setup-sshd [-hnp] usage: setup-sshd [-h] [-c choice of SSH daemon]
Setup sshd Setup sshd daemon
options: options:
-h Show this help -h Show this help
-c Choice of SSH daemon: openssh dropbear none
__EOF__ __EOF__
exit 1 exit 1
} }
while getopts "hn" opt; do while getopts "hc:" opt; do
case $opt in case $opt in
h) usage;; h) usage;;
c) sshdchoice="$OPTARG";;
esac esac
done done
echo "Sshd to setup? (openssh, dropbear, none) [openssh]" if [ "$sshdchoice" = "" ]; then
default_read setupsshd "openssh" echo "sshd to setup? (openssh, dropbear, none) [openssh]"
if [ "$setupsshd" = "none" ]; then default_read sshdchoice "openssh"
if [ "$sshdchoice" = "none" ]; then
exit 0 exit 0
fi fi
acfinstalled="`apk version acf-core -q | awk '{print $1}'`" acfinstalled="`apk version acf-core -q | awk '{print $1}'`"
if [ "setupsshd" = "openssh"]; then if [ "$sshdchoice" = "openssh" ]; then
if [ "$acfinstalled" != "ERROR:" ]; then if [ "$acfinstalled" != "ERROR:" ]; then
apk add acf-openssh -q apk add acf-openssh -q
else else
apk add openssh -q apk add openssh -q
fi fi
elif [ "setupsshd" = "dropbear"]; then elif [ "$sshdchoice" = "dropbear" ]; then
apk add dropbear apk add dropbear
fi fi
/etc/init.d/sshd start if [ -e /etc/init.d/sshd ]; then
rc-update add sshd default /etc/init.d/sshd start
rc-update add sshd default
echo "$sshdchoice failed to install"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment