Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 connman (1.36-2.0antix1) unstable; urgency=medium
 .
   * antiX changes - thanks Craig
Author: anticapitalista <antix@operamail.com>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2020-05-08

--- connman-1.36.orig/scripts/connman.in
+++ connman-1.36/scripts/connman.in
@@ -1,8 +1,13 @@
 #!/bin/sh
 
+
+date >> /tmp/resolv.log
+ls -ltrh /etc/resolv.conf* >> /tmp/resolv.log
+cat /etc/resolv.conf >> /tmp/resolv.log
+
 ### BEGIN INIT INFO
 # Provides:       connman
-# Required-Start: $remote_fs $syslog dbus
+# Required-Start: $remote_fs $syslog resolvconf dbus
 # Required-Stop:  $remote_fs $syslog dbus
 # Default-Start:  2 3 4 5
 # Default-Stop:   0 1 6
@@ -10,26 +15,38 @@
 ### END INIT INFO
 
 
-DAEMON=@sbindir@/connmand
+DAEMON=/usr/sbin/connmand
 DESC="Connection Manager"
 NAME=connmand
 . /lib/lsb/init-functions
 
-if [ -f @sysconfdir@/default/connman ] ; then
-	. @sysconfdir@/default/connman
+if [ -f /etc/default/connman ] ; then
+	. /etc/default/connman
 fi
 
-if [ "CONNMAN_RUNSTATEDIR_RESOLVCONF" != "no" ] ; then
-    mkdir -p @runstatedir@/connman
-    ln -sf @runstatedir@/connman/resolv.conf /etc/
+DNS_PROXY='yes'
+if [ -n $DAEMON_OPTS ]; then
+	echo $DAEMON_OPTS | grep -F -q 'nodnsproxy' && DNS_PROXY='no'
 fi
 
 do_start() {
+	if [ $DNS_PROXY = 'yes' ]; then
+		mkdir -p /run/connman/ || return
+		if [ -f /etc/resolv.conf ]; then
+			ln /etc/resolv.conf /etc/connman/
+		fi
+		ln -sf /run/connman/resolv.conf /etc/ || return
+	fi
 	start-stop-daemon --start --oknodo --exec $DAEMON -- $DAEMON_OPTS
 }
 
 do_stop() {
-	start-stop-daemon --stop --oknodo --quiet --exec $DAEMON
+	start-stop-daemon --stop --oknodo --quiet --exec $DAEMON || return
+	local _rc=$?
+	if [ $DNS_PROXY = 'yes' ]; then
+		mv /etc/connman/resolv.conf /etc/
+	fi
+	return $_rc
 }
 
 get_pid() {
