Skip to contentSkip to conversation

gpsd: make init script optional

PATCH New spdawson at gmail.com 6 participants 9 messages Jun 16, 2013 – Jun 18, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpsd: make init script optional

From: Simon Dawson <[email protected]>

---
 package/gpsd/Config.in | 7 +++++++
 package/gpsd/gpsd.mk   | 7 +++++++
 2 files changed, 14 insertions(+)
package/gpsd/Config.in +7 -0
index 337f8e7..29e061f 100644
@@ -21,6 +21,13 @@ config BR2_PACKAGE_GPSD_DEVICES
 	default "/dev/ttyS1"
 	depends on BR2_PACKAGE_GPSD
 
+config BR2_PACKAGE_GPSD_INSTALL_INITSCRIPT
+	bool "install init script"
+	default y
+	depends on BR2_PACKAGE_GPSD
+	help
+	  Install a gpsd init script
+
 menu "Features"
 	depends on BR2_PACKAGE_GPSD
 
package/gpsd/gpsd.mk +7 -0
index be2e681..45d1aed 100644
@@ -207,12 +207,19 @@ define GPSD_INSTALL_TARGET_CMDS
 		$(SCONS) \
 		$(GPSD_SCONS_OPTS) \
 		install)
+endef
+
+define GPSD_INSTALL_INITSCRIPT
 	if [ ! -f $(TARGET_DIR)/etc/init.d/S50gpsd ]; then \
 		$(INSTALL) -m 0755 -D package/gpsd/S50gpsd $(TARGET_DIR)/etc/init.d/S50gpsd; \
 		$(SED) 's,^DEVICES=.*,DEVICES=$(BR2_PACKAGE_GPSD_DEVICES),' $(TARGET_DIR)/etc/init.d/S50gpsd; \
 	fi
 endef
 
+ifeq ($(BR2_PACKAGE_GPSD_INSTALL_INITSCRIPT),y)
+GPSD_POST_INSTALL_TARGET_HOOKS = GPSD_INSTALL_INITSCRIPT
+endif
+
 define GPSD_INSTALL_STAGING_CMDS
 	(cd $(@D); \
 		$(GPSD_SCONS_ENV) \
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/1 gpsd: make init script optional

Hi Simon,

Quoted 36 lines · spdawson at gmail.com

From: Simon Dawson <[email protected]>

---
 package/gpsd/Config.in | 7 +++++++
 package/gpsd/gpsd.mk   | 7 +++++++
 2 files changed, 14 insertions(+)
package/gpsd/Config.in +7 -0
index 337f8e7..29e061f 100644
@@ -21,6 +21,13 @@ config BR2_PACKAGE_GPSD_DEVICES
 	default "/dev/ttyS1"
 	depends on BR2_PACKAGE_GPSD
 
+config BR2_PACKAGE_GPSD_INSTALL_INITSCRIPT
+	bool "install init script"
+	default y
+	depends on BR2_PACKAGE_GPSD
+	help
+	  Install a gpsd init script
+
 menu "Features"
 	depends on BR2_PACKAGE_GPSD
 
package/gpsd/gpsd.mk +2 -0
index be2e681..45d1aed 100644
@@ -207,12 +207,19 @@ define GPSD_INSTALL_TARGET_CMDS
 		$(SCONS) \
 		$(GPSD_SCONS_OPTS) \
 		install)
+endef
+

package/gpsd/gpsd.mk define GPSD_INSTALL_TARGET_CMDS · line 221

Quoted 10 lines
package/gpsd/gpsd.mk +4 -0
+define GPSD_INSTALL_INITSCRIPT
 	if [ ! -f $(TARGET_DIR)/etc/init.d/S50gpsd ]; then \
 		$(INSTALL) -m 0755 -D package/gpsd/S50gpsd $(TARGET_DIR)/etc/init.d/S50gpsd; \
 		$(SED) 's,^DEVICES=.*,DEVICES=$(BR2_PACKAGE_GPSD_DEVICES),' $(TARGET_DIR)/etc/init.d/S50gpsd; \
 	fi
 endef
 
+ifeq ($(BR2_PACKAGE_GPSD_INSTALL_INITSCRIPT),y)
+GPSD_POST_INSTALL_TARGET_HOOKS = GPSD_INSTALL_INITSCRIPT
+endif

You should use GPSD_INSTALL_INIT_SYSV instead.

Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 gpsd: make init script optional

In reply to spdawson at gmail.com

Simon, All,

On 2013-06-16 12:34 +0100, spdawson at gmail.com spake thusly:

package/gpsd/Config.in config BR2_PACKAGE_GPSD_DEVICES · line 30

Quoted 7 lines
package/gpsd/Config.in +7 -0
+config BR2_PACKAGE_GPSD_INSTALL_INITSCRIPT
+	bool "install init script"
+	default y
+	depends on BR2_PACKAGE_GPSD
+	help
+	  Install a gpsd init script
+

Why would one not want the init script? Is this because of systemd? If so, then you should use GPSD_INSTALL_INIT_SYSV and GPSD_INSTALL_INIT_SYSTEMD as pointed out by Maxime.

This ensures the init script will only be installed if a SysV init scheme is used (and conversely for the systemd unit).

Otherwise, please expand on why not wanting the init script should be configurable at all.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/1 gpsd: make init script optional

Hi Yann, Maxime.

Quoted 9 lines · Yann E. MORIN

Why would one not want the init script? Is this because of systemd? If so, then you should use GPSD_INSTALL_INIT_SYSV and GPSD_INSTALL_INIT_SYSTEMD as pointed out by Maxime.

This ensures the init script will only be installed if a SysV init scheme is used (and conversely for the systemd unit).

Otherwise, please expand on why not wanting the init script should be configurable at all.

There are other possibilities, beyond SysV and systemd: I've previously run gpsd and other managed services using daemontools and runit. My present use case has udev kicking off gpsd in response to hotplug events for a USB GPS device.

I seem to always end up having to remove the gpsd SysV init script in my post-build script; hence the desire for a configuration option.

Simon.

#4 lore raw

PATCH 1/1 gpsd: make init script optional

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Simon" == Simon Dawson <[email protected]> writes:

Hi,

Quoted 2 lines
Quoted 2 lines

Otherwise, please expand on why not wanting the init script should be configurable at all.

Simon> There are other possibilities, beyond SysV and systemd: I've Simon> previously run gpsd and other managed services using daemontools Simon> and runit.

True, but we don't currently have any support for these in buildroot.

Simon> My present use case has udev kicking off gpsd in response to Simon> hotplug events for a USB GPS device.

Simon> I seem to always end up having to remove the gpsd SysV init Simon> script in my post-build script; hence the desire for a Simon> configuration option.

Sorry, but it imho doesn't scale to add configuration options for this kind of stuff for each package.

Realisticly seem, you almost always need to do some minor fixups in post-build for any real projects.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/1 gpsd: make init script optional

Hi Peter.

Quoted 5 lines · Peter Korsgaard

Sorry, but it imho doesn't scale to add configuration options for this kind of stuff for each package.

Realisticly seem, you almost always need to do some minor fixups in post-build for any real projects.

Fair enough; thanks for the input.

Simon.

#6 lore raw

PATCH 1/1 gpsd: make init script optional

In reply to Simon Dawson
Quoted 13 lines · Simon Dawson

Hi Yann, Maxime.

Quoted 9 lines · Yann E. MORIN

Why would one not want the init script? Is this because of systemd? If so, then you should use GPSD_INSTALL_INIT_SYSV and GPSD_INSTALL_INIT_SYSTEMD as pointed out by Maxime.

This ensures the init script will only be installed if a SysV init scheme is used (and conversely for the systemd unit).

Otherwise, please expand on why not wanting the init script should be configurable at all.

Quoted 7 lines

There are other possibilities, beyond SysV and systemd: I've previously run gpsd and other managed services using daemontools and runit. My present use case has udev kicking off gpsd in response to hotplug events for a USB GPS device.

I seem to always end up having to remove the gpsd SysV init script in my post-build script; hence the desire for a configuration option.

Maybe you can add a BR2_INIT_NONE choice here then to not copy all the install scripts.

Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#7 lore raw

PATCH 1/1 gpsd: make init script optional

Quoted 19 lines · Maxime Ripard
Quoted 18 lines · Simon Dawson

Hi Yann, Maxime.

Quoted 9 lines · Yann E. MORIN

Why would one not want the init script? Is this because of systemd? If so, then you should use GPSD_INSTALL_INIT_SYSV and GPSD_INSTALL_INIT_SYSTEMD as pointed out by Maxime.

This ensures the init script will only be installed if a SysV init scheme is used (and conversely for the systemd unit).

Otherwise, please expand on why not wanting the init script should be configurable at all.

There are other possibilities, beyond SysV and systemd: I've previously run gpsd and other managed services using daemontools and runit. My present use case has udev kicking off gpsd in response to hotplug events for a USB GPS device.

Quoted 5 lines
Quoted 2 lines

I seem to always end up having to remove the gpsd SysV init script in my post-build script; hence the desire for a configuration option.

Maybe you can add a BR2_INIT_NONE choice here then to not copy all the install scripts.

There are just a few daemons that you'd want to run from hotplug, most
of them would still run from init.d.

But I really would like a better way to manage the services you want to
run in init.d, and especially their order. I can't come up with a good solution, though, so I'm not actively complaining :-)

I agree with Peter that having an option for each package is not a good
solution.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#8 lore raw

PATCH 1/1 gpsd: make init script optional

Dear Arnout Vandecappelle,

Quoted 6 lines · Arnout Vandecappelle

There are just a few daemons that you'd want to run from hotplug, most
of them would still run from init.d.

But I really would like a better way to manage the services you want to
run in init.d, and especially their order. I can't come up with a good solution, though, so I'm not actively complaining :-)

I believe it's typically the kind of customization that is left to the user, through a post-build script. Buildroot provides a relatively sane default installation, and the user has to further tweak it if needed. I don't think we should make Buildroot more complex to allow directly in the Buildroot configuration this kind of very specific customization.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com