From patchwork Tue Oct 15 08:24:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Freihofer, Adrian" X-Patchwork-Id: 1176804 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::53b; helo=mail-ed1-x53b.google.com; envelope-from=swupdate+bncbaabbumes3wqkgqe4oivrwy@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=siemens.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="ZJJfZ9rx"; dkim-atps=neutral Received: from mail-ed1-x53b.google.com (mail-ed1-x53b.google.com [IPv6:2a00:1450:4864:20::53b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46spPy13fnz9sPT for ; Tue, 15 Oct 2019 19:24:52 +1100 (AEDT) Received: by mail-ed1-x53b.google.com with SMTP id a21sf11710589edt.19 for ; Tue, 15 Oct 2019 01:24:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1571127889; cv=pass; d=google.com; s=arc-20160816; b=sGX9gjYOJ/NV/pitb/cCPOEGhsnfHkip5S5QfxxsmN9oiAJIdqlznCOJc3Rtmf7w6k ZCSaXFVbr/a/fjAAVDcNXrYh6rKdv0WVKHpR7rpXauD+xlGJuEEKhruBbfJZdi8RgrCq zCpZFOnYFTHUwLh/lkxCvtCZamLvpvcP4Xd3VIr6J4C2shyEUvzB9QVeP03c9gvJk91/ ie2SlYp8rlb4SX8RvkJoa0Y4wyPNnr4oXOXB/bGBopWcfcu6JdXAwdHYuA5POK+jR2Kh y1qXs1yXj160bZY5lUhRoLT4F/i7hpMgXHxLkHPe3Y0Lh8NvAStgxlCbps2XMt3LGsw/ XfoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:mime-version:sender:dkim-signature; bh=mMCh5b8iB+Gww5NK0NbEhgBqQ01nT5h7lQOlIXsh5NA=; b=AiVePgf0QFSf9jvOnPPktmNHhchpflSd8WADz5GVmjXj49C9yEsGlIolO1XRite4wH 2jUhG9gIRRMfomy9GaD+9fdJlg9hkXyPOuwX8/mm/cWSNBwWu9KRfWsch/ScvtMS9qib toFR4lNlVoPQozI2/nEDt4bnq4hSuh05ezTJ7SulRqJcCH4TO+StaALjDat5icQh6RmH 9ziiXcYuLx0zSi5rONnIq9DlOyjTYpMBs5CrdZOhQU+SGxuthYupU3NdlM0Px0wmFxRk yN4KKoRXTrjBE2gZaGRCFWy6bx2wBvo1eeH9TpwQQNdiUQ5GjWLlwcvxuw82mCyq0tQu v21w== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of adrian.freihofer@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=adrian.freihofer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=mMCh5b8iB+Gww5NK0NbEhgBqQ01nT5h7lQOlIXsh5NA=; b=ZJJfZ9rxb0GUYbR7PpVWC+ZLDOs4caItmFluS7p09tHqMW9Ey9uG20nkm0JicqK9c0 vyfoSQrTtn1YFauxCm/tbsbcuyFG2yNi/dVA+btJFF/xZz8muHsP7V4gfgabv9pNU6rI hX8GeZt5bdbiQItG9ssRl+LwvuIvRUTCIZl/h7ViA3IaPE+C+P3bWR+Jw7KVi4aiG1C0 HB91YuWXpJDJCf3iUnzYdfe1QTEchO0J7578kz9QEZapYoe6oR4lyCAE9duO/4InO9Ua SYk+7EC66WOrJQjrf9ArY6hB1xTfhYBzGt/Fl7j88jH5ANTiD9/Sr8/zOz4kEgAf5ziD Uviw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=mMCh5b8iB+Gww5NK0NbEhgBqQ01nT5h7lQOlIXsh5NA=; b=o71XQVRD3o5WBgoCW0hAatbflJah5feLZ4iMXD4togj8SFD5VN2fulYxlgGegjbeLt oqDl7PL3HpWgU/CwarVNgFncQDMHs0JcBSawgMiMNdJVEp/hxoX4doGrH8GHNYzU93TH zftExOP+npbLMkVByLxMymcDdZnYdbF13xjZ3M3thzWTtvokCOGobY9u4zMBJ3toE6G/ llr5EJg85zOW1mJPpdfutAAalHjidbsjII+fOs+JT3mRz8ICYQeXWc68jpOZS9tR2tqD mZ/JlMFf+uPpvWxc4tbLZO1Uhya6ZwDbyYa9BNs6DTEvyfxq2OifTWCB0+h4L0mRSpFB 9tKQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: APjAAAWw9dxYLl1EcJMMMOIeDyP1EJGc6CIbPbNFjzMIhXbMHyoP5BAP HdblzNkGgf2g8a/hhBycOHY= X-Google-Smtp-Source: APXvYqzmoYioS9UyW2F8Tszp9Ta28qIdLuyXQoj5Dvakfry7L7RBzoBCRmrdrxNgQj9qShp/Sp+FCQ== X-Received: by 2002:a17:906:c801:: with SMTP id cx1mr33759349ejb.266.1571127889224; Tue, 15 Oct 2019 01:24:49 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a17:907:11c8:: with SMTP id va8ls4456446ejb.15.gmail; Tue, 15 Oct 2019 01:24:48 -0700 (PDT) X-Received: by 2002:a17:907:119c:: with SMTP id uz28mr33211643ejb.115.1571127888828; Tue, 15 Oct 2019 01:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571127888; cv=none; d=google.com; s=arc-20160816; b=lOGtLYnLAwydqZQViuwc2qcbwUGufAT7fu8yJLINmkmqnFfbG+f7ebj4wf84qTrHsz up2hUAXb5rGesbbiq+tvPMxOvWI9SfHdiexfXjFuwGrwGCFLiy6lFDmxReTBbykttBxG A8l58JsLD/xO/Yl1+KKOuJOjx+LFPa5UG0iLBn1tPLnU8640U3Bw+gapq79p2oK30AXI 8gD6nbWQxjXATD6pW1gRHOfxSoIieZ60o8QwYizvW119vkgOlyq/c+2RvE8xR1gLlfR3 4E6ORsmgnEwtcT4iuP/YqGbrAFka8FoVKKBLAhVWfohIyifZSMXbBc0WoQB3weT6Dadz ma/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=gxZ8PraoG7LZsKmIDabqDCiaIwtqPY9blyyUTZlzSIU=; b=P0XgdvD7QkL/5HHHViI4hxDBq66doYj2TnZ4ygBBMaG9C4PWnXRPA5pD0IhFMynU0b 4wRzJeUzoAhuLKJ049trQ23Bqy2QWbeYpOCBZKYUQKs6VeVnCDNYObgR0IY23+Z0bXwM UtckXUy80VcU4bqHnXb7t+HL8rg6IVzZUwzNFQPOXJa17sTDUt+f4it0se5kHjtM9MNM YV21LrXrkVv0c3EJqLzXZ+jknYWcQyyQ+pI43E88lPAul4cISQR0NvI/OY0ZBDWzUYVA Xc5qpVSxqRDADIL/M1Jg50+Tqry3MYltlNlw9v6Cw88g3knYj4VQWONARyUXtCalNiBM 1V9A== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of adrian.freihofer@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=adrian.freihofer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id d14si1095805edb.4.2019.10.15.01.24.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Oct 2019 01:24:48 -0700 (PDT) Received-SPF: pass (google.com: domain of adrian.freihofer@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id x9F8Om8P028474 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 15 Oct 2019 10:24:48 +0200 Received: from dev.vm6.ccp.siemens.com ([167.87.48.196]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTP id x9F8OlJY017875; Tue, 15 Oct 2019 10:24:47 +0200 Received: from dev.localdomain (localhost [127.0.0.1]) by dev.vm6.ccp.siemens.com (Postfix) with ESMTP id E3F072353A50; Tue, 15 Oct 2019 10:24:46 +0200 (CEST) From: Adrian Freihofer To: swupdate@googlegroups.com Cc: Adrian Freihofer Subject: [swupdate] [PATCH v4 1/2] systemd generic startup Date: Tue, 15 Oct 2019 10:24:33 +0200 Message-Id: <20191015082434.6750-2-adrian.freihofer@siemens.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191015082434.6750-1-adrian.freihofer@siemens.com> References: <20191015082434.6750-1-adrian.freihofer@siemens.com> X-Original-Sender: adrian.freihofer@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of adrian.freihofer@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=adrian.freihofer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , If SYSTEMD_SYSTEM_UNITDIR environment variable is passed to make install, a generic set of systemd service and socket files gets installed. For most projects starting swupdate requires some logic implemented in shell scripts. Therefore swupdate is started by a new shell script /usr/lib/swupdate/swupdate.sh. swupdate.sh evaluates code snippets from /usr/lib/swupdate/conf.d and /etc/swupdate/conf.d before swupdate gets started. All modes (file, webserver, webclient) of swupdate are supported. Users or distro maintainers are enabled to add simple code snippets adding arguments for swupdate to the following three variables: - SWUPDATE_ARGS - SWUPDATE_WEBSERVER_ARGS - SWUPDATE_DOWNLOAD_ARGS This allows to provide a "just works" configuration for Mongoose if it gets compiled. This was not the case with systemd before. Signed-off-by: Adrian Freihofer --- Makefile | 20 ++++++++++++++++++++ doc/source/swupdate.rst | 29 +++++++++++++++++------------ startup/systemd/10-mongoose-args | 1 + startup/systemd/swupdate-progress.service | 9 +++++++++ startup/systemd/swupdate-usb.rules | 2 ++ startup/systemd/swupdate-usb@.service | 8 ++++++++ startup/systemd/swupdate.service | 11 +++++++++++ startup/systemd/swupdate.sh | 28 ++++++++++++++++++++++++++++ startup/systemd/swupdate.socket | 11 +++++++++++ startup/systemd/tmpfiles-swupdate.conf | 2 ++ 10 files changed, 109 insertions(+), 12 deletions(-) create mode 100644 startup/systemd/10-mongoose-args create mode 100644 startup/systemd/swupdate-progress.service create mode 100644 startup/systemd/swupdate-usb.rules create mode 100644 startup/systemd/swupdate-usb@.service create mode 100644 startup/systemd/swupdate.service create mode 100644 startup/systemd/swupdate.sh create mode 100644 startup/systemd/swupdate.socket create mode 100644 startup/systemd/tmpfiles-swupdate.conf diff --git a/Makefile b/Makefile index d60c58e..2c23bef 100644 --- a/Makefile +++ b/Makefile @@ -461,6 +461,26 @@ install: all install -d ${DESTDIR}/usr/lib/lua/$(LUAVER); \ install -m 0755 ${lua_swupdate} $(DESTDIR)/usr/lib/lua/$(LUAVER); \ 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}; \ + ctrl_path=${CONFIG_SOCKET_CTRL_PATH}; progr_path=${CONFIG_SOCKET_PROGRESS_PATH}; \ + sed -i -e "s,@@SOCKET_CTRL_PATH@@,$${ctrl_path},g" \ + -e "s,@@SOCKET_PROGRESS_PATH@@,$${progr_path},g" \ + ${DESTDIR}${SYSTEMD_SYSTEM_UNITDIR}/swupdate.socket; \ + install -m 644 startup/systemd/swupdate.service ${DESTDIR}${SYSTEMD_SYSTEM_UNITDIR}; \ + install -d ${DESTDIR}/usr/lib/tmpfiles.d; \ + 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 tests: \ diff --git a/doc/source/swupdate.rst b/doc/source/swupdate.rst index 1ff08ef..0eea82b 100644 --- a/doc/source/swupdate.rst +++ b/doc/source/swupdate.rst @@ -520,22 +520,27 @@ configuration switch ``CONFIG_SYSTEMD``. If enabled, SWUpdate signals systemd about start-up completion and can make optional use of systemd's socket-based activation feature. -A sample systemd service unit file ``/etc/systemd/system/swupdate.service`` -may look like the following starting SWUpdate in suricatta daemon mode: +To install a generic set of service and socket files, pass the +`SYSTEMD_SYSTEM_UNITDIR` parameter, which points to `/lib/systemd/system` +for example, to the "make install" command. -:: +For further runtime adjustments, some shell code snippets can be added +to the `/usr/lib/swupdate/conf.d` or `/etc/swupdate/conf.d` folders. The +code snippets are processed by a full-featured shell in alphabetical order. +Files from /etc overwrite files from /usr/ with the same name. - [Unit] - Description=SWUpdate daemon - Documentation=https://github.com/sbabic/swupdate - Documentation=https://sbabic.github.io/swupdate +The purpose of these code snippets is to assign reasonable command line +parameters to swupdate. The following variables may be set: - [Service] - Type=notify - ExecStart=/usr/bin/swupdate -u '-t default -u http://localhost -i 25' +- SWUPDATE_ARGS +- SWUPDATE_WEBSERVER_ARGS +- SWUPDATE_DOWNLOAD_ARGS - [Install] - WantedBy=multi-user.target +A sample configuration file ``/usr/lib/swupdate/conf.d/10-suricatta`` +may look like the following starting SWUpdate in suricatta daemon mode: +:: + + SWUPDATE_DOWNLOAD_ARGS='-t default -u http://localhost -i 25' Started via ``systemctl start swupdate.service``, SWUpdate (re)creates its sockets on startup. For using socket-based diff --git a/startup/systemd/10-mongoose-args b/startup/systemd/10-mongoose-args new file mode 100644 index 0000000..896e66b --- /dev/null +++ b/startup/systemd/10-mongoose-args @@ -0,0 +1 @@ +SWUPDATE_WEBSERVER_ARGS="-r /www ${SWUPDATE_MONGOOSE_EXTRA_ARGS:--p 8080}" diff --git a/startup/systemd/swupdate-progress.service b/startup/systemd/swupdate-progress.service new file mode 100644 index 0000000..212d151 --- /dev/null +++ b/startup/systemd/swupdate-progress.service @@ -0,0 +1,9 @@ +[Unit] +Description=swupdate progress service +Before=swupdate.service + +[Service] +ExecStart=/usr/bin/swupdate-progress -r -w + +[Install] +WantedBy=swupdate.service diff --git a/startup/systemd/swupdate-usb.rules b/startup/systemd/swupdate-usb.rules new file mode 100644 index 0000000..7bba227 --- /dev/null +++ b/startup/systemd/swupdate-usb.rules @@ -0,0 +1,2 @@ +ACTION=="add", KERNEL=="sd*", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", TAG+="systemd", ENV{SYSTEMD_WANTS}+="swupdate-usb@%k.service" + diff --git a/startup/systemd/swupdate-usb@.service b/startup/systemd/swupdate-usb@.service new file mode 100644 index 0000000..eda9d15 --- /dev/null +++ b/startup/systemd/swupdate-usb@.service @@ -0,0 +1,8 @@ +[Unit] +Description=usb media swupdate service +Requires=swupdate-progress.service + +[Service] +ExecStartPre=/bin/mount /dev/%I /mnt +ExecStart=/bin/sh -c "swupdate-client -v /mnt/*.swu" +ExecStopPost=/bin/umount /mnt diff --git a/startup/systemd/swupdate.service b/startup/systemd/swupdate.service new file mode 100644 index 0000000..a3d8d19 --- /dev/null +++ b/startup/systemd/swupdate.service @@ -0,0 +1,11 @@ +[Unit] +Description=SWUpdate daemon +Documentation=https://github.com/sbabic/swupdate +Documentation=https://sbabic.github.io/swupdate + +[Service] +ExecStart=/usr/lib/swupdate/swupdate.sh +KillMode=mixed + +[Install] +WantedBy=multi-user.target diff --git a/startup/systemd/swupdate.sh b/startup/systemd/swupdate.sh new file mode 100644 index 0000000..d93ec85 --- /dev/null +++ b/startup/systemd/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_DOWNLOAD_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_DOWNLOAD_ARGS" != "" ]; then + exec /usr/bin/swupdate $SWUPDATE_ARGS -w "$SWUPDATE_WEBSERVER_ARGS" -u "$SWUPDATE_DOWNLOAD_ARGS" +elif [ "$SWUPDATE_WEBSERVER_ARGS" != "" ]; then + exec /usr/bin/swupdate $SWUPDATE_ARGS -w "$SWUPDATE_WEBSERVER_ARGS" +elif [ "$SWUPDATE_DOWNLOAD_ARGS" != "" ]; then + exec /usr/bin/swupdate $SWUPDATE_ARGS -d "$SWUPDATE_DOWNLOAD_ARGS" +else + exec /usr/bin/swupdate $SWUPDATE_ARGS +fi diff --git a/startup/systemd/swupdate.socket b/startup/systemd/swupdate.socket new file mode 100644 index 0000000..aeb7310 --- /dev/null +++ b/startup/systemd/swupdate.socket @@ -0,0 +1,11 @@ +[Unit] +Description=SWUpdate socket listener +Documentation=https://github.com/sbabic/swupdate +Documentation=https://sbabic.github.io/swupdate + +[Socket] +ListenStream=@@SOCKET_CTRL_PATH@@ +ListenStream=@@SOCKET_PROGRESS_PATH@@ + +[Install] +WantedBy=sockets.target diff --git a/startup/systemd/tmpfiles-swupdate.conf b/startup/systemd/tmpfiles-swupdate.conf new file mode 100644 index 0000000..4743672 --- /dev/null +++ b/startup/systemd/tmpfiles-swupdate.conf @@ -0,0 +1,2 @@ +X /tmp/datadst +X /tmp/scripts From patchwork Tue Oct 15 08:24:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Freihofer, Adrian" X-Patchwork-Id: 1176806 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::33c; helo=mail-wm1-x33c.google.com; envelope-from=swupdate+bncbaabbu4es3wqkgqekxwyzfy@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=siemens.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="hJO6NaGV"; dkim-atps=neutral Received: from mail-wm1-x33c.google.com (mail-wm1-x33c.google.com [IPv6:2a00:1450:4864:20::33c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46spPy513pz9sPV for ; Tue, 15 Oct 2019 19:24:54 +1100 (AEDT) Received: by mail-wm1-x33c.google.com with SMTP id n3sf8289439wmf.3 for ; Tue, 15 Oct 2019 01:24:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1571127891; cv=pass; d=google.com; s=arc-20160816; b=YFoF+mzr7t9bAEbsqdRr9iAhRiiXjMY5GO2GvsGJwTOxL+oiUSkfAkGecluF9Vd/Om f6vcQ9fHKuiPHa+CZj058b7IFoKISk9KLtWKUfmxRReNC3QDA8mZKFv0sxTPFgXTugER 9llVWysLvxRLS+jBN2BOCR17Q4YjI2ba1M9DRpgq50WuBQwqp2l++2ZCDRfpb5siBKoL t0r1CkUw86k1CxUZG/tzuhFXjvgdqZDMyTT5LBTj5t7TXGVAYiQZ5T6Z1mozZhEyhAVQ h+hVC/T+kL0nIjHSih5glbW8EJMmUNAAu/82fxr3hZHNJxHYV2UqGcDbaRpPSTUzs+EO R5qw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:mime-version:sender:dkim-signature; bh=57P69Mj3XgJw5J75zdWINB3/vUMG0iYUOw7TqdJiY6w=; b=BTpuDQipxFwx+x21Z2We2qQzRUQzPd5TwCh5meEa/WJLw1Bq+0q7mxpN5apiEzWgrP gXAmsoYeP9bnXxcjsIQ/dM9nofsnPyBLNm4WRDbU+8i+RHkXvym+a7UMnNyKfFTCKPOV 5I7tACbuYUu5+xAj2ivp24C7KwGYeO8zztOCcAZhE3ln+RaUg4A4cc+C+EqDBqRtYb+d kFleNTOLHCxSc+Pz5XVX/88Ez60i366xq1dfrfNO4M2nJWRMbjXnjIDZwVD/gQRE9go4 Lw9pobJCDBAnCNv+kPZnJsV4lLKjGaP+0r2wopho3pNlUCGyIDmr4P63N+BWPaB/ulS9 zZrQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of adrian.freihofer@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=adrian.freihofer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=57P69Mj3XgJw5J75zdWINB3/vUMG0iYUOw7TqdJiY6w=; b=hJO6NaGViFMKJ5OlwoXW1oOapGP3n+xcO0Hv3A5IfadY0QmbDYHZB8+DMtHT4mkl6P NGviU2IqfRRp5WDhwaCTXbObl6d7frWLjcgF6YFdy2UajBA/YZbcLP2yaqHjskXKBiIN zI9kJjJLJrxmHPpgRMcMyzEV7ouKJY3Fy9c5a7Lv+Nx+r5VxWOkqqIPmQu/jHct/UwKl QE1ZdqNtrQK8n++RJGCVY23Ohj5s/3kLiG2OGezgNDQJIYX1UVPdyenICYJk9cgRN+1g LbeziTTRliqY9Hegd38JMosDXak4bt7W3TNPMIz8VVz4tgsp2Z4aDWPVdEhLgnYxbUFj dGKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=57P69Mj3XgJw5J75zdWINB3/vUMG0iYUOw7TqdJiY6w=; b=rE1lPMXJovTOuww9Lc3yGlMKjZVzXGHVaY01+rKetWbjk1gu1dY12E7Rv8M8ZL343Y 2F/jluJ/IbtTajIqTjQoGf+k2PTGK0JHVIS2Ue+ZFhyDiBJ978+Uu3dpoMp8bnGiGZqx EFaEV9mThkwE3tBB6+8WzE+KHEMA/PkFBG7FyrMwC8qSevgdkZwT72iFm3Ar+C09y0Pj 3SL1KKAQ8tJ94TvfBfV49lKIlt0ytjpbLaZVD/30OoAfTyBSc1RIoRwJ8aC8Cf4h5VPA E4vjSSqYl2NCYZrp1UMlQddMWNzryzB3Sbt+eqZM0bLYpz1vD1yl0/v6YoHt8vEYw6S7 DkTw== Sender: swupdate@googlegroups.com X-Gm-Message-State: APjAAAXdLyLR2kgkFgWCkGvl0gdhQSpPCFKbUo5uzcT6Brn29grt1c14 gsBgF+n5zAqrMb3Lci5OnC0= X-Google-Smtp-Source: APXvYqwUbX9ZlpRaYdcw5YR74sBrjymuyn9jtSRzWxPdrv50JJdbmbv4nXuMzmeoo4Azx28XwUOIiQ== X-Received: by 2002:a5d:43c9:: with SMTP id v9mr28674205wrr.200.1571127891504; Tue, 15 Oct 2019 01:24:51 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:adf:db07:: with SMTP id s7ls6504434wri.6.gmail; Tue, 15 Oct 2019 01:24:51 -0700 (PDT) X-Received: by 2002:adf:cc8e:: with SMTP id p14mr31427911wrj.301.1571127891062; Tue, 15 Oct 2019 01:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571127891; cv=none; d=google.com; s=arc-20160816; b=dJJiAbCuBQmyjXFvZu1Tj+9g+wgKKA0OuECa9jfnpSrEEGLRePJQkJB/zBth52aRoP 2T0iV0/fatp3S+wEyWovN69Monfwdig15WaxwqprZb3Pfo62bAAV/CUABMdb7GUngGz2 jCDfpv8rT+katV9ZivhdN2IEwewAPi3XueYUoR7v4IcI1tjqQkJXWB2APcRx85duI6cI sk1h74VLGgnODhC6TgJ0u58vKt7QFHB/WFW4O8zD3EAcBC2Dc+O/xFYg91HxYUqXOtLG G+9fwtH4NgzaWrJGw3rzsnMqE3ILDFac8HlQ/EnuGb3ykbqvxkfhZmHlxaImgxtKc37j ZJzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=edBijeXqQKi+tQQUy+pNnAywO72hJKRpzmxH02G6anw=; b=Wp60p6PzGYPTZYFo61XsHkFElaVs7GtIVkfwpE2/HJ+uG4sbL3A4UjtYirs3aeOcq4 NDg4YTqT4Hk0p0QXjFl8jrM3z86E5n+3ROD12MRa7oSK0FRmo8hHnIuLnoS1Y0EkHlYV uRA8C1ne1X8iWX3PFeBenihH4OKmYNg4HCgsfhUYvJy+ChnN7xo61eRhBILnIheXk6wL s/dNpnbmUII6ykoBRg+acDNPl22Ws7vqC86msJ3jsZ8d39aKZ6J9i2ChdLTbyviHSzaB xTENOAVI0R+5gc/3HmD6nnr7ZVVF4+3DJHFj6HLYynZrig+w+ZNZ+9fNCi7iWjJJChnX LcxQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of adrian.freihofer@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=adrian.freihofer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id x8si1648269wmk.2.2019.10.15.01.24.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Oct 2019 01:24:51 -0700 (PDT) Received-SPF: pass (google.com: domain of adrian.freihofer@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id x9F8OoE6004965 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 15 Oct 2019 10:24:50 +0200 Received: from dev.vm6.ccp.siemens.com ([167.87.48.196]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id x9F8OnDN024704; Tue, 15 Oct 2019 10:24:49 +0200 Received: from dev.localdomain (localhost [127.0.0.1]) by dev.vm6.ccp.siemens.com (Postfix) with ESMTP id E72172353A50; Tue, 15 Oct 2019 10:24:48 +0200 (CEST) From: Adrian Freihofer To: swupdate@googlegroups.com Cc: Adrian Freihofer Subject: [swupdate] [PATCH v4 2/2] Add Kconfig option for new systemd files Date: Tue, 15 Oct 2019 10:24:34 +0200 Message-Id: <20191015082434.6750-3-adrian.freihofer@siemens.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191015082434.6750-1-adrian.freihofer@siemens.com> References: <20191015082434.6750-1-adrian.freihofer@siemens.com> X-Original-Sender: adrian.freihofer@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of adrian.freihofer@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=adrian.freihofer@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , This adds an option for the new systemd service files installation to menuconfig. The default configuration for the new SYSTEMD_SYSTEM_UNITDIR setting is an empty string. This allows a distro buildsystem to provide the path for systemd system unitdir as an environment variable. An empty string implies to not install the default systemd configuration files. The default behavior of make install does not change. --- Kconfig | 12 ++++++++++++ Makefile.flags | 3 +++ 2 files changed, 15 insertions(+) diff --git a/Kconfig b/Kconfig index 70907c9..882ee1e 100644 --- a/Kconfig +++ b/Kconfig @@ -105,6 +105,18 @@ config SYSTEMD Enable support for systemd's start-up completion notification and socket-based activation features. +config SYSTEMD_SYSTEM_UNITDIR + string "installation path for systemd unit files" + depends on SYSTEMD + default "" + help + Defines the path where systemd service and socket files get + installed to. By default (empty string) the systemd files + are installed to the path provided by the SYSTEMD_SYSTEM_UNITDIR + environment variable or are not installed if this variable is + undefined. To install a set of service files without defining + environment variables, you may set this to /lib/systemd/system. + config SCRIPTS bool "enable pre and postinstall scripts" default y diff --git a/Makefile.flags b/Makefile.flags index b880d32..0edd48c 100644 --- a/Makefile.flags +++ b/Makefile.flags @@ -180,6 +180,9 @@ endif ifeq ($(CONFIG_SYSTEMD),y) LDLIBS += systemd +ifneq ($(CONFIG_SYSTEMD_SYSTEM_UNITDIR),) +export SYSTEMD_SYSTEM_UNITDIR=$(CONFIG_SYSTEMD_SYSTEM_UNITDIR) +endif endif ifeq ($(CONFIG_BOOTLOADER_EBG),y)