From patchwork Thu Apr 16 19:02:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Weber X-Patchwork-Id: 1271860 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rockwellcollins.com Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4937rV2pPGz9s71 for ; Fri, 17 Apr 2020 05:02:17 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5E5E985F60; Thu, 16 Apr 2020 19:02:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AakhrOxAciWz; Thu, 16 Apr 2020 19:02:13 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5D8E985CFE; Thu, 16 Apr 2020 19:02:13 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id BA6B11BF3B0 for ; Thu, 16 Apr 2020 19:02:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B241186B67 for ; Thu, 16 Apr 2020 19:02:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eTGz7XrDhzgp for ; Thu, 16 Apr 2020 19:02:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from da1vs03.rockwellcollins.com (da1vs03.rockwellcollins.com [205.175.227.47]) by whitealder.osuosl.org (Postfix) with ESMTPS id B402581EAD for ; Thu, 16 Apr 2020 19:02:11 +0000 (UTC) IronPort-SDR: eTmEXs9/VnTl9BD3fKPufTy/DzoyiO6579gVabipfpKf/+AVgCDMFu0O2G/Bh0m/cp/6qtb+kb 3Lo5NtkdQDXmXtdXkqdb3mjG73JcgAP2OTBAc3Xyav7llmch3kKooQPQjc/gOGZzjHcGp1Ki7+ VLS8zfXXQINDMBKJqBdkvKW63epyuA0/l0MtJyExqb0aDP9ctR+CXNs+qrv0qM376rHRsOLoFJ nqvgPc23BW6SpixTg6Ok5GGoLs9lb2lpMaRHRRQV60SFxoRLS9vXqsY+mwCJRq6reVZVskl2uj 8UM= Received: from ofwda1n02.rockwellcollins.com (HELO dtulimr01.rockwellcollins.com) ([205.175.227.14]) by da1vs03.rockwellcollins.com with ESMTP; 16 Apr 2020 14:02:11 -0500 X-Received: from biscuits.rockwellcollins.lab (biscuits.rockwellcollins.lab [10.148.119.137]) by dtulimr01.rockwellcollins.com (Postfix) with ESMTP id 8831B60040; Thu, 16 Apr 2020 14:02:10 -0500 (CDT) From: Matt Weber To: buildroot@buildroot.org Date: Thu, 16 Apr 2020 14:02:09 -0500 Message-Id: <20200416190209.40757-1-matthew.weber@rockwellcollins.com> X-Mailer: git-send-email 2.17.1 Subject: [Buildroot] [PATCH v3] package/swupdate: add basic systemd service X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matt Weber , Sam Voss MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Sam Voss Signed-off-by: Sam Voss Signed-off-by: Matt Weber --- Test cfg for verifying systemd created the symlink: BR2_aarch64=y BR2_TOOLCHAIN_EXTERNAL=y BR2_INIT_SYSTEMD=y BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.16.7" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config" BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y BR2_PACKAGE_SWUPDATE=y BR2_TARGET_ROOTFS_EXT2=y Changes v2 -> v3 - During testing we found that the service killmode needed adjusting to prevent a hang/timeout during shutdown/reboot (https://github.com/sbabic/meta-swupdate/blob/master/recipes-support/swupdate/swupdate/swupdate.service) v1 -> v2 [Thomas P - Remove symlink because it is created by [231ad359bcc0] package/systemd: use host-systemctl preset all to enable units --- package/swupdate/swupdate.mk | 8 ++++++++ package/swupdate/swupdate.service | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 package/swupdate/swupdate.service diff --git a/package/swupdate/swupdate.mk b/package/swupdate/swupdate.mk index 2b51edb66d..f31b7f3883 100644 --- a/package/swupdate/swupdate.mk +++ b/package/swupdate/swupdate.mk @@ -189,4 +189,12 @@ $(error No Swupdate configuration file specified, check your BR2_PACKAGE_SWUPDAT endif endif +ifeq ($(BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE),y) +define SWUPDATE_INSTALL_INIT_SYSTEMD + $(INSTALL) -D -m 644 package/swupdate/swupdate.service \ + $(TARGET_DIR)/usr/lib/systemd/system/swupdate.service + mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants +endef +endif + $(eval $(kconfig-package)) diff --git a/package/swupdate/swupdate.service b/package/swupdate/swupdate.service new file mode 100644 index 0000000000..232bd9956e --- /dev/null +++ b/package/swupdate/swupdate.service @@ -0,0 +1,18 @@ +[Unit] +Description=SWUpdate daemon +Documentation=https://github.com/sbabic/swupdate +Documentation=https://sbabic.github.io/swupdate + +[Service] +# Default environment variables in case /etc/default/swupdate isn't providing them +Environment=SWU_POST_UPDATE_CMD="touch /tmp/.swu_complete" +Environment=SWU_WEBSERVER_ARGS="-p 8080 -r /var/www/swupdate/" + +# Always take what is in the environment files when exists +EnvironmentFile=/etc/default/swupdate + +ExecStart=/usr/bin/swupdate ${SWU_KEY_ARGS} -p ${SWU_POST_UPDATE_CMD} -v -L -w "${SWU_WEBSERVER_ARGS}" +KillMode=mixed + +[Install] +WantedBy=multi-user.target