From patchwork Wed May 29 23:02:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hancock X-Patchwork-Id: 1107438 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sedsystems.ca Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45DmTJ1nHlz9s4V for ; Thu, 30 May 2019 09:02:58 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 678918826A; Wed, 29 May 2019 23:02:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QM2du3qvx73P; Wed, 29 May 2019 23:02:51 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id B586688268; Wed, 29 May 2019 23:02:51 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 971B51BF286 for ; Wed, 29 May 2019 23:02:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8945820337 for ; Wed, 29 May 2019 23:02:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Nci4XQf5KG+V for ; Wed, 29 May 2019 23:02:49 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sed198n136.sedsystems.ca (sed198n136.SEDSystems.ca [198.169.180.136]) by silver.osuosl.org (Postfix) with ESMTPS id 609E820336 for ; Wed, 29 May 2019 23:02:49 +0000 (UTC) Received: from barney.sedsystems.ca (barney [198.169.180.121]) by sed198n136.sedsystems.ca with ESMTP id x4TN2mVe022448 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 29 May 2019 17:02:48 -0600 (CST) Received: from SED.RFC1918.192.168.sedsystems.ca (eng1n65.eng.sedsystems.ca [172.21.1.65]) by barney.sedsystems.ca (8.14.7/8.14.4) with ESMTP id x4TN2lNs048728 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 29 May 2019 17:02:48 -0600 From: Robert Hancock To: buildroot@buildroot.org Date: Wed, 29 May 2019 17:02:41 -0600 Message-Id: <1559170961-14091-1-git-send-email-hancock@sedsystems.ca> X-Mailer: git-send-email 1.8.3.1 X-Scanned-By: MIMEDefang 2.64 on 198.169.180.136 Subject: [Buildroot] [PATCH] package/gpsd: Fix systemd service installation and paths 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: Robert Hancock MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Fix several issues with systemd service file installation for gpsd: -systemd support in the gpsd build was defaulting to enabled or not based on whether the host system had systemd directories present. Set this explicitly based on whether BR2_INIT_SYSTEMD is set. -The installed systemd service files referenced paths in /usr/local when the actual binaries are installed in /usr. Replace /usr/local with /usr in the installed service files. -When BR2_PACKAGE_HAS_UDEV was enabled, all of the binaries were re-installed again, along with the udev rules, as part of the post-install hooks. Just choose between using install and udev-install based on whether udev is enabled to avoid redundant re-installations. Signed-off-by: Robert Hancock --- package/gpsd/gpsd.mk | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/package/gpsd/gpsd.mk b/package/gpsd/gpsd.mk index d2c7612..a5c7477 100644 --- a/package/gpsd/gpsd.mk +++ b/package/gpsd/gpsd.mk @@ -24,7 +24,8 @@ GPSD_SCONS_OPTS = \ sysroot=$(STAGING_DIR)\ strip=no\ python=no \ - qt=no + qt=no \ + systemd=$(if $(BR2_INIT_SYSTEMD),yes,no) ifeq ($(BR2_PACKAGE_NCURSES),y) GPSD_DEPENDENCIES += ncurses @@ -216,7 +217,7 @@ define GPSD_INSTALL_TARGET_CMDS DESTDIR=$(TARGET_DIR) \ $(HOST_DIR)/bin/python2 $(SCONS) \ $(GPSD_SCONS_OPTS) \ - install) + $(if $(BR2_PACKAGE_HAS_UDEV),udev-install,install)) endef define GPSD_INSTALL_INIT_SYSV @@ -224,6 +225,14 @@ define GPSD_INSTALL_INIT_SYSV $(SED) 's,^DEVICES=.*,DEVICES=$(BR2_PACKAGE_GPSD_DEVICES),' $(TARGET_DIR)/etc/init.d/S50gpsd endef +define GPSD_INSTALL_INIT_SYSTEMD +# systemd unit files are installed automatically, but need to update the +# /usr/local path references in the provided files to /usr. + $(SED) 's%/usr/local%/usr%' \ + $(TARGET_DIR)/usr/lib/systemd/system/gpsd.service \ + $(TARGET_DIR)/usr/lib/systemd/system/gpsdctl@.service +endef + define GPSD_INSTALL_STAGING_CMDS (cd $(@D); \ $(GPSD_SCONS_ENV) \ @@ -233,16 +242,10 @@ define GPSD_INSTALL_STAGING_CMDS install) endef -# After installing the udev rule, make it writable so that this +# After the udev rule is installed, make it writable so that this # package can be re-built/re-installed. ifeq ($(BR2_PACKAGE_HAS_UDEV),y) define GPSD_INSTALL_UDEV_RULES - (cd $(@D); \ - $(GPSD_SCONS_ENV) \ - DESTDIR=$(TARGET_DIR) \ - $(HOST_DIR)/bin/python2 $(SCONS) \ - $(GPSD_SCONS_OPTS) \ - udev-install) chmod u+w $(TARGET_DIR)/lib/udev/rules.d/25-gpsd.rules endef