aboutsummaryrefslogtreecommitdiff
path: root/mail/automx/files/patch-src-automx-test
blob: 0862b19f24ba732b70efb49497a9d51cdce17c76 (plain) (blame)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
--- 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"