ports/mail/automx/files/patch-src-automx-test
Chris Rees ebe8a24550 Fix bashism
PR:		ports/164901
Submitted by:	Martin Waschbuesch
2015-12-31 18:04:31 +00:00

76 lines
2.2 KiB
Text

--- src/automx-test.orig 2014-04-26 16:16:55 UTC
+++ src/automx-test
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# automx - auto configuration service
# Copyright (c) 2011-2013 [*] sys4 AG
@@ -19,17 +19,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
+# Ported to sh to avoid a dependency on bash by crees@FreeBSD.org
+#
VERSION="0.10.2"
trap clean_exit EXIT
-function clean_exit() {
- [[ -f "$OLREQUEST" ]] && rm "$OLREQUEST"
- [[ -f "$MBREQUEST" ]] && rm "$MBREQUEST"
- [[ -f "$MBCRESPONSE" ]] && rm "$MBCRESPONSE"
+clean_exit() {
+ [ -f "$OLREQUEST" ] && rm "$OLREQUEST"
+ [ -f "$MBREQUEST" ] && rm "$MBREQUEST"
+ [ -f "$MBCRESPONSE" ] && rm "$MBCRESPONSE"
}
# We need a mail address
-if [[ $1 ]]; then
+if [ -n "$1" ]; then
PROFILE="$1"
else
echo "Provide the mail address for which configuration settings should be retrieved."
@@ -44,7 +46,7 @@ MBCRESPONSE="$(mktemp /tmp/${PROGRAM_NAM
# Test Mozilla schema
AUTOCONF="autoconfig.$DOMAIN"
-if [[ $(dig +short $AUTOCONF) ]]; then
+if [ -n "$(dig +short $AUTOCONF)" ]; then
CON="http://$AUTOCONF/mail/config-v1.1.xml?emailaddress=$PROFILE"
echo
echo "Testing Autoconfig ..."
@@ -60,13 +62,13 @@ fi
# Test Microsoft schema
AUTODISC="autodiscover.$DOMAIN"
-if [[ -z $(dig +short $AUTODISC) ]]; then
+if [ -z "$(dig +short $AUTODISC)" ]; then
# default domain does not exist, try to discover non-default
AUTODISC="$(dig +short -t srv _autodiscover._tcp.$DOMAIN)"
- AUTODISC="${AUTODISC//* /}"
+ AUTODISC="${AUTODISC##* }"
AUTODISC="${AUTODISC%.*}"
fi
-if [[ $AUTODISC ]]; then
+if [ -n "$AUTODISC" ]; then
# Test Microsoft Outlook schema
CON="https://$AUTODISC/autodiscover/autodiscover.xml"
cat <<-REQ >$OLREQUEST
@@ -111,13 +113,13 @@ fi
# Test mobileconfig schema
AUTODISC="autodiscover.$DOMAIN"
-if [[ -z $(dig +short $AUTODISC) ]]; then
+if [ -z "$(dig +short $AUTODISC)" ]; then
# default domain does not exist, try to discover non-default
AUTODISC="$(dig +short -t srv _autodiscover._tcp.$DOMAIN)"
- AUTODISC="${AUTODISC//* /}"
+ AUTODISC="${AUTODISC##* }"
AUTODISC="${AUTODISC%.*}"
fi
-if [[ $AUTODISC ]]; then
+if [ -n "$AUTODISC" ]; then
# Test Apple mobileconfig schema
CON="https://$AUTODISC/mobileconfig"