diff mbox series

Make swupdate.sh independent from systemd

Message ID 20191104100733.29288-1-adrian.freihofer@siemens.com
State Rejected
Headers show
Series Make swupdate.sh independent from systemd | expand

Commit Message

Freihofer, Adrian Nov. 4, 2019, 10:07 a.m. UTC
Support installing the shell wrapper independently from systemd. This
allows to simplify also the configuration without systemd and to
implement sysvinit and systemd based setup allmost equal in Yocto.
---
 Kconfig                                | 15 +++++++++++++++
 Makefile                               | 12 +++++++-----
 Makefile.deps                          |  4 ++++
 startup/{systemd => }/10-mongoose-args |  0
 startup/{systemd => }/swupdate.sh      |  0
 5 files changed, 26 insertions(+), 5 deletions(-)
 rename startup/{systemd => }/10-mongoose-args (100%)
 rename startup/{systemd => }/swupdate.sh (100%)
diff mbox series

Patch

diff --git a/Kconfig b/Kconfig
index 882ee1e..dcf85f4 100644
--- a/Kconfig
+++ b/Kconfig
@@ -97,6 +97,20 @@  config CURL_SSL
 	bool
 	default n
 
+config SHELL_CONFIGURATOR
+	bool "swupdate shell wrapper"
+	default n
+	help
+	  Usually starting swupdate requires some information from the
+	  systemd, e.g. hardware version, currently active copy and others.
+	  Often a few shell code lines are used to evaluate the command line
+	  parameters of swupdate.
+	  This option installs a shell script which starts swupdate. The
+	  script is customizable. It sources shell code snippets from
+	  /usr/lib/swupdate/conf.d or /etc/swupdate/conf.d folders. The
+	  idea is to add command line paramters for swupdate to variables
+	  (SWUPDATE_ARGS, SWUPDATE_WEBSERVER_ARGS, SWUPDATE_DOWNLOAD_ARGS).
+
 config SYSTEMD
 	bool "enable systemd support"
 	depends on HAVE_LINUX
@@ -108,6 +122,7 @@  config SYSTEMD
 config SYSTEMD_SYSTEM_UNITDIR
 	string "installation path for systemd unit files"
 	depends on SYSTEMD
+	depends on SHELL_CONFIGURATOR
 	default ""
 	help
 	  Defines the path where systemd service and socket files get
diff --git a/Makefile b/Makefile
index 9b7f640..7796e6a 100644
--- a/Makefile
+++ b/Makefile
@@ -461,10 +461,15 @@  install: all
 		install -d ${DESTDIR}/usr/lib/lua/$(LUAVER); \
 		install -m 0755 ${lua_swupdate} $(DESTDIR)/usr/lib/lua/$(LUAVER); \
 	fi
+	if [ $(SHELL_CONFIGURATOR) = y ]; then \
+		install -d ${DESTDIR}/usr/lib/swupdate/conf.d; \
+		install -m 755 startup/swupdate.sh ${DESTDIR}/usr/lib/swupdate; \
+		if [ "x$(CONFIG_MONGOOSE)" == "xy" ]; then \
+			install -m 644 startup/10-mongoose-args ${DESTDIR}/usr/lib/swupdate/conf.d/; \
+		fi; \
+	fi
 	if [ "x${SYSTEMD_SYSTEM_UNITDIR}" != "x" ]; then \
 		install -d ${DESTDIR}${SYSTEMD_SYSTEM_UNITDIR}; \
-		install -d ${DESTDIR}/usr/lib/swupdate/conf.d; \
-		install -m 755 startup/systemd/swupdate.sh ${DESTDIR}/usr/lib/swupdate; \
 		install -m 644 startup/systemd/swupdate-progress.service ${DESTDIR}${SYSTEMD_SYSTEM_UNITDIR}; \
 		install -m 644 startup/systemd/swupdate-usb@.service ${DESTDIR}${SYSTEMD_SYSTEM_UNITDIR}; \
 		install -m 644 startup/systemd/swupdate.socket ${DESTDIR}${SYSTEMD_SYSTEM_UNITDIR}; \
@@ -477,9 +482,6 @@  install: all
 		install -m 0644 startup/systemd/tmpfiles-swupdate.conf ${DESTDIR}/usr/lib/tmpfiles.d/swupdate.conf; \
 		install -d ${DESTDIR}/etc/udev/rules.d; \
 		install -m 0644 startup/systemd/swupdate-usb.rules ${DESTDIR}/etc/udev/rules.d/; \
-		if [ "x$(CONFIG_MONGOOSE)" == "xy" ]; then \
-			install -m 644 startup/systemd/10-mongoose-args ${DESTDIR}/usr/lib/swupdate/conf.d/; \
-		fi; \
 	fi
 
 PHONY += run-tests
diff --git a/Makefile.deps b/Makefile.deps
index 512d4b8..138ad20 100644
--- a/Makefile.deps
+++ b/Makefile.deps
@@ -69,3 +69,7 @@  endif
 ifeq ($(HAVE_URIPARSER),)
 export HAVE_URIPARSER = y
 endif
+
+ifeq ($(SHELL_CONFIGURATOR),)
+export SHELL_CONFIGURATOR = y
+endif
diff --git a/startup/systemd/10-mongoose-args b/startup/10-mongoose-args
similarity index 100%
rename from startup/systemd/10-mongoose-args
rename to startup/10-mongoose-args
diff --git a/startup/systemd/swupdate.sh b/startup/swupdate.sh
similarity index 100%
rename from startup/systemd/swupdate.sh
rename to startup/swupdate.sh