diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-10-06 13:02:40 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-10-06 13:05:10 +0000 |
commit | 76db5482a6585ab96923d1f6e9f6e5cda89ccc21 (patch) | |
tree | dd94bddcff56877c5d7724b17a6eb02e9880f972 | |
parent | 7f62ff7e22aceddc35f25780174aabe686d41d88 (diff) | |
download | alpine-conf-76db5482a6585ab96923d1f6e9f6e5cda89ccc21.zip |
setup-sshd: clean up code a bit
-rwxr-xr-x | setup-sshd.in | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/setup-sshd.in b/setup-sshd.in index 714279b..11a074f 100755 --- a/setup-sshd.in +++ b/setup-sshd.in @@ -25,7 +25,7 @@ while getopts "hc:" opt; do done if [ "$sshdchoice" = "" ]; then - echo "sshd to setup? (openssh, dropbear, none) [openssh]" + echo -n "Remote administration with sshd? (openssh, dropbear, none) [openssh] " default_read sshdchoice "openssh" fi @@ -33,21 +33,21 @@ if [ "$sshdchoice" = "none" ]; then exit 0 fi -acfinstalled="`apk version acf-core -q | awk '{print $1}'`" - -if [ "$sshdchoice" = "openssh" ]; then - if [ "$acfinstalled" != "ERROR:" ]; then - apk add acf-openssh -q - else - apk add openssh -q - fi -elif [ "$sshdchoice" = "dropbear" ]; then - apk add dropbear +pkgs="$sshdchoice" +if [ "$sshdchoice" = "openssh" ] && apk info --quiet --installed acf-core; then + pkgs="$pkgs acf-openssh" fi -if [ -e /etc/init.d/sshd ]; then - /etc/init.d/sshd start - rc-update add sshd default -else - echo "$sshdchoice failed to install" +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 + |