diff --git a/recipes-support/swupdate/swupdate.inc b/recipes-support/swupdate/swupdate.inc
index 9f40881..700d5a1 100644
--- a/recipes-support/swupdate/swupdate.inc
+++ b/recipes-support/swupdate/swupdate.inc
@@ -8,9 +8,18 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3"
 inherit cml1 update-rc.d systemd pkgconfig
 
 SRC_URI = "git://github.com/sbabic/swupdate.git;protocol=https \
-     file://defconfig \
-     file://swupdate \
-     "
+    file://defconfig \
+    file://swupdate \
+    file://swupdate.sh \
+    file://swupdate.service \
+    file://swupdate.socket.tmpl \
+    file://swupdate-usb.rules \
+    file://swupdate-usb@.service \
+    file://swupdate-progress.service \
+    file://tmpfiles-swupdate.conf \
+    file://10-mongoose-args \
+    file://90-start-progress \
+"
 
 PACKAGES =+ " \
     ${PN}-client \
@@ -30,6 +39,7 @@ FILES_${PN}-lua += "${libdir}/lua/"
 FILES_${PN}-progress = " \
     ${bindir}/swupdate-progress \
     ${systemd_system_unitdir}/swupdate-progress.service \
+    ${libdir}/swupdate/conf.d/90-start-progress \
 "
 FILES_${PN}-usb = " \
     ${sysconfdir}/udev/rules.d/swupdate-usb.rules \
@@ -54,8 +64,9 @@ FILES_${PN}-www = " \
 RDEPENDS_${PN}-usb += "${PN}-client"
 
 # The tools package is deprecated, it is an empty meta package for backward compatibility
-RDEPENDS_${PN}-tools += "${PN}-client ${PN}-progress ${PN}-tools-hawkbit ${PN}-usb"
-
+RDEPENDS_${PN}-tools += "${PN}-client ${PN}-progress ${PN}-tools-hawkbit \
+    ${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}-usb','',d)} \
+"
 
 S = "${WORKDIR}/git/"
 
@@ -140,12 +151,36 @@ python () {
         depends = d.getVar('DEPENDS', False)
         d.setVar('DEPENDS', depends + ' librsync')
 
+    if 'CONFIG_MONGOOSE=y\n' in features:
+        d.setVar('SWUPDATE_MONGOOSE', 'true')
+    else:
+        d.setVar('SWUPDATE_MONGOOSE', 'false')
+
     if 'CONFIG_MONGOOSE_WEB_API_V2=y\n' in features:
         d.setVar('SWUPDATE_WWW', 'webapp')
 
     if 'CONFIG_BOOTLOADER_EBG=y\n' in features:
         depends = d.getVar('DEPENDS', False)
         d.setVar('DEPENDS', depends + ' efibootguard')
+
+    # Values not used here might be used in a bbappend
+    d.setVar('SWUPDATE_SOCKET_CTRL_PATH', '/tmp/sockinstctrl')
+    d.setVar('SWUPDATE_SOCKET_PROGRESS_PATH', '/tmp/swupdateprog')
+    d.setVar('SWUPDATE_HW_COMPATIBILITY_FILE', '/etc/hwrevision')
+    d.setVar('SWUPDATE_SW_VERSIONS_FILE', '/etc/sw-versions')
+    for feature in features:
+        if feature.startswith('CONFIG_SOCKET_CTRL_PATH='):
+            ctrl_path = feature.split('=')[1].strip()
+            d.setVar('SWUPDATE_SOCKET_CTRL_PATH', ctrl_path)
+        elif feature.startswith('CONFIG_SOCKET_PROGRESS_PATH='):
+            prog_path = feature.split('=')[1].strip()
+            d.setVar('SWUPDATE_SOCKET_PROGRESS_PATH', prog_path)
+        elif feature.startswith('CONFIG_HW_COMPATIBILITY_FILE='):
+            hwrev_file = feature.split('=')[1].strip()
+            d.setVar('SWUPDATE_HW_COMPATIBILITY_FILE', hwrev_file)
+        elif feature.startswith('CONFIG_SW_VERSIONS_FILE='):
+            swver_file = feature.split('=')[1].strip()
+            d.setVar('SWUPDATE_SW_VERSIONS_FILE', swver_file)
 }
 
 do_configure () {
@@ -155,29 +190,53 @@ do_configure () {
 }
 
 do_compile() {
-  unset LDFLAGS
-  oe_runmake
+    unset LDFLAGS
+    oe_runmake
 }
 
 do_install () {
-
-  oe_runmake install
-
-  install -m 0755 -d ${D}/www
-  if [ -d ${S}/web-app ];then
-	cp -R --no-dereference --preserve=mode,links -v ${S}/examples/www/v2/* ${D}/www
-  else
-	install -m 0755 ${S}/www/* ${D}/www
-  fi
-
-  install -d ${D}${sysconfdir}/init.d
-  install -m 755 ${WORKDIR}/swupdate ${D}${sysconfdir}/init.d
+    oe_runmake install
+
+    install -m 0755 -d ${D}/www
+    if [ -d ${S}/web-app ];then
+        cp -R --no-dereference --preserve=mode,links -v ${S}/examples/www/v2/* ${D}/www
+    else
+        install -m 0755 ${S}/www/* ${D}/www
+    fi
+
+    install -d ${D}${sysconfdir}/init.d
+    install -m 755 ${WORKDIR}/swupdate ${D}${sysconfdir}/init.d
+
+    # shell based configuration loader allows to place code snippets into this folder
+    install -d ${D}${libdir}/swupdate/conf.d
+    install -m 755 ${WORKDIR}/swupdate.sh ${D}${libdir}/swupdate
+    if ${SWUPDATE_MONGOOSE}; then
+        install -m 644 ${WORKDIR}/10-mongoose-args ${D}${libdir}/swupdate/conf.d/
+    fi
+    install -d ${D}${systemd_unitdir}/system
+    install -m 644 ${WORKDIR}/swupdate.service ${D}${systemd_system_unitdir}
+    install -m 644 ${WORKDIR}/swupdate.socket.tmpl ${D}${systemd_system_unitdir}/swupdate.socket
+    sed -e "s,@@SWUPDATE_SOCKET_CTRL_PATH@@,${SWUPDATE_SOCKET_CTRL_PATH},g" \
+        -e "s,@@SWUPDATE_SOCKET_PROGRESS_PATH@@,${SWUPDATE_SOCKET_PROGRESS_PATH},g" \
+        -i ${D}${systemd_system_unitdir}/swupdate.socket
+    install -m 644 ${WORKDIR}/swupdate-usb@.service ${D}${systemd_system_unitdir}
+    install -m 644 ${WORKDIR}/swupdate-progress.service ${D}${systemd_system_unitdir}
+
+    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+        install -d ${D}${libdir}/tmpfiles.d
+        install -m 0644 ${WORKDIR}/tmpfiles-swupdate.conf ${D}${libdir}/tmpfiles.d/swupdate.conf
+        install -d ${D}${sysconfdir}/udev/rules.d
+        install -m 0644 ${WORKDIR}/swupdate-usb.rules ${D}${sysconfdir}/udev/rules.d/
+    else
+        # in case of systemd there is a service file, for sysv init we need to start it as well
+        install -m 0644 ${WORKDIR}/90-start-progress ${D}${libdir}/swupdate/conf.d/
+    fi
 }
 
 INITSCRIPT_NAME = "swupdate"
 INITSCRIPT_PARAMS = "defaults 70"
 
 SYSTEMD_PACKAGES = "${PN} ${PN}-progress ${PN}-usb"
-SYSTEMD_SERVICE_${PN} = "swupdate.service"
+SYSTEMD_SERVICE_${PN} = "swupdate.service swupdate.socket"
 SYSTEMD_SERVICE_${PN}-progress = "swupdate-progress.service"
 SYSTEMD_SERVICE_${PN}-usb = "swupdate-usb@.service"
diff --git a/recipes-support/swupdate/swupdate/10-mongoose-args b/recipes-support/swupdate/swupdate/10-mongoose-args
new file mode 100644
index 0000000..896e66b
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/10-mongoose-args
@@ -0,0 +1 @@
+SWUPDATE_WEBSERVER_ARGS="-r /www ${SWUPDATE_MONGOOSE_EXTRA_ARGS:--p 8080}"
diff --git a/recipes-support/swupdate/swupdate/90-start-progress b/recipes-support/swupdate/swupdate/90-start-progress
new file mode 100644
index 0000000..74ecd46
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/90-start-progress
@@ -0,0 +1 @@
+exec /usr/bin/swupdate-progress -w -p -r &
diff --git a/recipes-support/swupdate/swupdate/swupdate b/recipes-support/swupdate/swupdate/swupdate
index 5e31864..5ef894f 100644
--- a/recipes-support/swupdate/swupdate/swupdate
+++ b/recipes-support/swupdate/swupdate/swupdate
@@ -30,7 +30,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
 
 DESC="swupdate"
 NAME="swupdate"
-DAEMON=/usr/bin/swupdate
+DAEMON=/usr/lib/swupdate/swupdate.sh
 PIDFILE=/var/run/$NAME.pid
 
 . /etc/init.d/functions || exit 1
@@ -57,7 +57,7 @@ do_start() {
 	*)
 		echo "Starting $DESC ..."
 		cd /home/root
-		exec $DAEMON -v -w "-r /www $SWUPDATE_MONGOOSE_EXTRA_ARGS" $SWUPDATE_EXTRA_ARGS &
+		exec $DAEMON &
 		exit 0
 		;;
 	esac
diff --git a/recipes-support/swupdate/swupdate-2019.04/swupdate-progress.service b/recipes-support/swupdate/swupdate/swupdate-progress.service
similarity index 61%
rename from recipes-support/swupdate/swupdate-2019.04/swupdate-progress.service
rename to recipes-support/swupdate/swupdate/swupdate-progress.service
index de80b16..212d151 100644
--- a/recipes-support/swupdate/swupdate-2019.04/swupdate-progress.service
+++ b/recipes-support/swupdate/swupdate/swupdate-progress.service
@@ -1,6 +1,9 @@
 [Unit]
 Description=swupdate progress service
-Requires=swupdate.service
+Before=swupdate.service
 
 [Service]
 ExecStart=/usr/bin/swupdate-progress -r -w
+
+[Install]
+WantedBy=swupdate.service
diff --git a/recipes-support/swupdate/swupdate-2019.04/swupdate-usb.rules b/recipes-support/swupdate/swupdate/swupdate-usb.rules
similarity index 100%
rename from recipes-support/swupdate/swupdate-2019.04/swupdate-usb.rules
rename to recipes-support/swupdate/swupdate/swupdate-usb.rules
diff --git a/recipes-support/swupdate/swupdate-2019.04/swupdate-usb@.service b/recipes-support/swupdate/swupdate/swupdate-usb@.service
similarity index 100%
rename from recipes-support/swupdate/swupdate-2019.04/swupdate-usb@.service
rename to recipes-support/swupdate/swupdate/swupdate-usb@.service
diff --git a/recipes-support/swupdate/swupdate-2019.04/swupdate.service b/recipes-support/swupdate/swupdate/swupdate.service
similarity index 59%
rename from recipes-support/swupdate/swupdate-2019.04/swupdate.service
rename to recipes-support/swupdate/swupdate/swupdate.service
index b585616..a3d8d19 100644
--- a/recipes-support/swupdate/swupdate-2019.04/swupdate.service
+++ b/recipes-support/swupdate/swupdate/swupdate.service
@@ -4,9 +4,7 @@ Documentation=https://github.com/sbabic/swupdate
 Documentation=https://sbabic.github.io/swupdate
 
 [Service]
-ExecStartPre=-/usr/bin/swupdate-env
-EnvironmentFile=-/tmp/swupdate.env
-ExecStart=/usr/bin/swupdate -v -w "-r /www" $SWUPDATE_EXTRA_ARGS
+ExecStart=/usr/lib/swupdate/swupdate.sh
 KillMode=mixed
 
 [Install]
diff --git a/recipes-support/swupdate/swupdate/swupdate.sh b/recipes-support/swupdate/swupdate/swupdate.sh
new file mode 100644
index 0000000..8798e2d
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/swupdate.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# Override these variables in sourced script(s) located
+# in /usr/lib/swupdate/conf.d or /etc/swupdate/conf.d
+SWUPDATE_ARGS="-v ${SWUPDATE_EXTRA_ARGS}"
+SWUPDATE_WEBSERVER_ARGS=""
+SWUPDATE_SURICATTA_ARGS=""
+
+# source all files from /etc/swupdate/conf.d and /usr/lib/swupdate/conf.d/
+# A file found in /etc replaces the same file in /usr
+for f in `(test -d /usr/lib/swupdate/conf.d/ && ls -1 /usr/lib/swupdate/conf.d/; test -d /etc/swupdate/conf.d && ls -1 /etc/swupdate/conf.d) | sort -u`; do
+  if [ -f /etc/swupdate/conf.d/$f ]; then
+    . /etc/swupdate/conf.d/$f
+  else
+    . /usr/lib/swupdate/conf.d/$f
+  fi
+done
+
+#  handle variable escaping in a simmple way. Use exec to forward open filedescriptors from systemd open.
+if [ "$SWUPDATE_WEBSERVER_ARGS" != "" -a  "$SWUPDATE_SURICATTA_ARGS" != "" ]; then
+  exec /usr/bin/swupdate $SWUPDATE_ARGS -w "$SWUPDATE_WEBSERVER_ARGS" -u "$SWUPDATE_SURICATTA_ARGS"
+elif [ "$SWUPDATE_WEBSERVER_ARGS" != "" ]; then
+  exec /usr/bin/swupdate $SWUPDATE_ARGS -w "$SWUPDATE_WEBSERVER_ARGS"
+elif [ "$SWUPDATE_SURICATTA_ARGS" != "" ]; then
+  exec /usr/bin/swupdate $SWUPDATE_ARGS -u "$SWUPDATE_SURICATTA_ARGS"
+else
+  exec /usr/bin/swupdate $SWUPDATE_ARGS
+fi
diff --git a/recipes-support/swupdate/swupdate/swupdate.socket.tmpl b/recipes-support/swupdate/swupdate/swupdate.socket.tmpl
new file mode 100644
index 0000000..5dbcbbd
--- /dev/null
+++ b/recipes-support/swupdate/swupdate/swupdate.socket.tmpl
@@ -0,0 +1,11 @@
+[Unit]
+Description=SWUpdate socket listener
+Documentation=https://github.com/sbabic/swupdate
+Documentation=https://sbabic.github.io/swupdate
+
+[Socket]
+ListenStream=@@SWUPDATE_SOCKET_CTRL_PATH@@
+ListenStream=@@SWUPDATE_SOCKET_PROGRESS_PATH@@
+
+[Install]
+WantedBy=sockets.target
diff --git a/recipes-support/swupdate/swupdate-2019.04/systemd-tmpfiles-swupdate.conf b/recipes-support/swupdate/swupdate/tmpfiles-swupdate.conf
similarity index 60%
rename from recipes-support/swupdate/swupdate-2019.04/systemd-tmpfiles-swupdate.conf
rename to recipes-support/swupdate/swupdate/tmpfiles-swupdate.conf
index b374ddc..4743672 100644
--- a/recipes-support/swupdate/swupdate-2019.04/systemd-tmpfiles-swupdate.conf
+++ b/recipes-support/swupdate/swupdate/tmpfiles-swupdate.conf
@@ -1,3 +1,2 @@
 X /tmp/datadst
 X /tmp/scripts
-X /tmp/swupdate.env
diff --git a/recipes-support/swupdate/swupdate_2019.04.bb b/recipes-support/swupdate/swupdate_2019.04.bb
index 5b0fb78..9d1528e 100644
--- a/recipes-support/swupdate/swupdate_2019.04.bb
+++ b/recipes-support/swupdate/swupdate_2019.04.bb
@@ -1,13 +1,5 @@
 require swupdate.inc
 
-SRC_URI += " \
-     file://swupdate.service \
-     file://swupdate-usb.rules \
-     file://swupdate-usb@.service \
-     file://swupdate-progress.service \
-     file://systemd-tmpfiles-swupdate.conf \
-     "
-
 SRCREV = "d39f4b8e00ef1929545b66158e45b82ea922bf81"
 
 do_install_append () {
@@ -16,15 +8,4 @@ do_install_append () {
     test -f ${D}${bindir}/client && mv ${D}${bindir}/client ${D}${bindir}/swupdate-client
     test -f ${D}${bindir}/hawkbitcfg && mv ${D}${bindir}/hawkbitcfg ${D}${bindir}/swupdate-hawkbitcfg
     test -f ${D}${bindir}/sendtohawkbit && mv ${D}${bindir}/sendtohawkbit ${D}${bindir}/swupdate-sendtohawkbit
-
-    install -d ${D}${systemd_system_unitdir}
-    install -m 644 ${WORKDIR}/swupdate.service ${D}${systemd_system_unitdir}
-    install -m 644 ${WORKDIR}/swupdate-usb@.service ${D}${systemd_system_unitdir}
-    install -m 644 ${WORKDIR}/swupdate-progress.service ${D}${systemd_system_unitdir}
-    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
-        install -d ${D}${libdir}/tmpfiles.d
-        install -m 0644 ${WORKDIR}/systemd-tmpfiles-swupdate.conf ${D}${libdir}/tmpfiles.d/swupdate.conf
-        install -d ${D}${sysconfdir}/udev/rules.d
-        install -m 0644 ${WORKDIR}/swupdate-usb.rules ${D}${sysconfdir}/udev/rules.d/
-    fi
 }
diff --git a/recipes-support/swupdate/swupdate_git.bb b/recipes-support/swupdate/swupdate_git.bb
index 8eef04e..5f95580 100644
--- a/recipes-support/swupdate/swupdate_git.bb
+++ b/recipes-support/swupdate/swupdate_git.bb
@@ -4,7 +4,3 @@ DEFAULT_PREFERENCE = "-1"
 
 SRCREV ?= "045a618a725d0a2fce64161f10101c0004ac5d85"
 PV = "2019.04+git${SRCPV}"
-
-SYSTEMD_SERVICE_${PN} += " \
-    swupdate.socket \
-"
