ser2net: add default init script
PATCH 1/1 ser2net: add default init script
add option to specify the configuration file
--- package/ser2net/Config.in | 9 +++++++++ package/ser2net/S50ser2net | 48 ++++++++++++++++++++++++++++++++++++++++++++ package/ser2net/ser2net.mk | 27 +++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 package/ser2net/S50ser2net
package/ser2net/Config.in +9 -0
@@ -8,5 +8,14 @@ config BR2_PACKAGE_SER2NET http://ser2net.sourceforge.net +if BR2_PACKAGE_SER2NET + +config BR2_PACKAGE_SER2NET_CONF + string "Configuration file" + help + Configuration file. + +endif + comment "ser2net requires a toolchain with IPV6 support" depends on !BR2_INET_IPV6
package/ser2net/S50ser2net new file +48 -0
48 lines not on this page · raw message
package/ser2net/ser2net.mk +27 -0
@@ -9,4 +9,31 @@ SER2NET_SITE = http://downloads.sourceforge.net/project/ser2net/ser2net SER2NET_LICENSE = GPLv2+ SER2NET_LICENSE_FILES = COPYING +define SER2NET_INIT_SCRIPT_INSTALL + $(INSTALL) -m 0755 package/ser2net/S50ser2net $(TARGET_DIR)/etc/init.d +endef + +SER2NET_POST_INSTALL_TARGET_HOOKS += SER2NET_INIT_SCRIPT_INSTALL + +define SER2NET_INIT_SCRIPT_UNINSTALL + rm -f $(TARGET_DIR)/etc/init.d/S50ser2net +endef + +SER2NET_POST_UNINSTALL_TARGET_HOOKS += SER2NET_INIT_SCRIPT_UNINSTALL + +define SER2NET_CONF_INSTALL + if [ "$(BR2_PACKAGE_SER2NET_CONF)" != "" ] ; then \ + $(INSTALL) -m 0644 $(BR2_PACKAGE_SER2NET_CONF) \ + $(TARGET_DIR)/etc/ser2net.conf ; \ + fi +endef + +SER2NET_POST_INSTALL_TARGET_HOOKS += SER2NET_CONF_INSTALL + +define SER2NET_CONFIG_UNINSTALL + rm -f $(TARGET_DIR)/etc/ser2net.conf +endef + +SER2NET_POST_UNINSTALL_TARGET_HOOKS += SER2NET_CONFIG_UNINSTALL + $(eval $(autotools-package))
Signature · 1 line
1.7.10.4
PATCH 1/1 ser2net: add default init script
Jean-Christophe, All,
See my comments inlined below.
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
add option to specify the configuration file
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- package/ser2net/Config.in | 9 +++++++++ package/ser2net/S50ser2net | 48 ++++++++++++++++++++++++++++++++++++++++++++ package/ser2net/ser2net.mk | 27 +++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 package/ser2net/S50ser2netpackage/ser2net/Config.in +0
-0
package/ser2net/Config.in config BR2_PACKAGE_SER2NET · line 16
Quoted 9 lines
package/ser2net/Config.in +6
-0@@ -8,5 +8,14 @@ config BR2_PACKAGE_SER2NET http://ser2net.sourceforge.net +if BR2_PACKAGE_SER2NET + +config BR2_PACKAGE_SER2NET_CONF + string "Configuration file" + help + Configuration file.
I think we should provide a default, basic configuration file that we install unconditionnally to the rootfs. The user will then be free to provide a post-build script to tweak that file.
package/ser2net/ser2net.mk SER2NET_SITE = http://downloads.sourceforge.net/project/ser2net/ser2net · line 16
Quoted 13 lines
package/ser2net/ser2net.mk +5
-0@@ -9,4 +9,31 @@ SER2NET_SITE = http://downloads.sourceforge.net/project/ser2net/ser2net SER2NET_LICENSE = GPLv2+ SER2NET_LICENSE_FILES = COPYING +define SER2NET_INIT_SCRIPT_INSTALL + $(INSTALL) -m 0755 package/ser2net/S50ser2net $(TARGET_DIR)/etc/init.d +endef + +SER2NET_POST_INSTALL_TARGET_HOOKS += SER2NET_INIT_SCRIPT_INSTALL
Please use SER2NET_INSTALL_INIT_SYSV to install that script, eg.:
SER2NET_INSTALL_INIT_SYSV += SER2NET_INIT_SCRIPT_INSTALL
this way, the init script will only be installed if a sysv init sequence is used (and not systemd).
Also, would it be possible to provide a systemd unit? Ditto, use: SER2NET_INSTALL_INIT_SYSTEMD
package/ser2net/ser2net.mk SER2NET_SITE = http://downloads.sourceforge.net/project/ser2net/ser2net · line 22
Quoted 6 lines
package/ser2net/ser2net.mk +6
-0+ +define SER2NET_INIT_SCRIPT_UNINSTALL + rm -f $(TARGET_DIR)/etc/init.d/S50ser2net +endef + +SER2NET_POST_UNINSTALL_TARGET_HOOKS += SER2NET_INIT_SCRIPT_UNINSTALL
I think we decided that uninstall targets are not needed, because uninstall is not working completely in Buildroot. Drop it.
package/ser2net/ser2net.mk SER2NET_SITE = http://downloads.sourceforge.net/project/ser2net/ser2net · line 31
Quoted 9 lines
package/ser2net/ser2net.mk +9
-0+ +define SER2NET_CONF_INSTALL + if [ "$(BR2_PACKAGE_SER2NET_CONF)" != "" ] ; then \ + $(INSTALL) -m 0644 $(BR2_PACKAGE_SER2NET_CONF) \ + $(TARGET_DIR)/etc/ser2net.conf ; \ + fi +endef + +SER2NET_POST_INSTALL_TARGET_HOOKS += SER2NET_CONF_INSTALL
Always install a default configuration file, as said above.
package/ser2net/ser2net.mk SER2NET_SITE = http://downloads.sourceforge.net/project/ser2net/ser2net · line 37
Quoted 5 lines
package/ser2net/ser2net.mk +5
-0+define SER2NET_CONFIG_UNINSTALL + rm -f $(TARGET_DIR)/etc/ser2net.conf +endef + +SER2NET_POST_UNINSTALL_TARGET_HOOKS += SER2NET_CONFIG_UNINSTALL
Ditto for uninstall: drop it.
Thank you!
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. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 ser2net: add default init script
Quoted 23 lines · Yann E. MORIN
Jean-Christophe, All,
See my comments inlined below.
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
add option to specify the configuration file
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- package/ser2net/Config.in | 9 +++++++++ package/ser2net/S50ser2net | 48 ++++++++++++++++++++++++++++++++++++++++++++ package/ser2net/ser2net.mk | 27 +++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 package/ser2net/S50ser2netpackage/ser2net/Config.in +0
-0@@ -8,5 +8,14 @@ config BR2_PACKAGE_SER2NET http://ser2net.sourceforge.net
Quoted 10 lines
package/ser2net/Config.in config BR2_PACKAGE_SER2NET · line 16
Quoted 6 lines
package/ser2net/Config.in +6
-0+if BR2_PACKAGE_SER2NET + +config BR2_PACKAGE_SER2NET_CONF + string "Configuration file" + help + Configuration file.I think we should provide a default, basic configuration file that we install unconditionnally to the rootfs. The user will then be free to provide a post-build script to tweak that file.
I hate post-build it's not trackable and as it's completly board specific with x serial to export I do not want a generic file
Quoted 67 lines
Quoted 7 lines
package/ser2net/ser2net.mk +0
-0package/ser2net/ser2net.mk SER2NET_SITE = http://downloads.sourceforge.net/project/ser2net/ser2net · line 16
Quoted 8 lines
package/ser2net/ser2net.mk +5
-0@@ -9,4 +9,31 @@ SER2NET_SITE = http://downloads.sourceforge.net/project/ser2net/ser2net SER2NET_LICENSE = GPLv2+ SER2NET_LICENSE_FILES = COPYING +define SER2NET_INIT_SCRIPT_INSTALL + $(INSTALL) -m 0755 package/ser2net/S50ser2net $(TARGET_DIR)/etc/init.d +endef + +SER2NET_POST_INSTALL_TARGET_HOOKS += SER2NET_INIT_SCRIPT_INSTALLPlease use
SER2NET_INSTALL_INIT_SYSVto install that script, eg.:SER2NET_INSTALL_INIT_SYSV += SER2NET_INIT_SCRIPT_INSTALLthis way, the init script will only be installed if a sysv init sequence is used (and not systemd).
Also, would it be possible to provide a systemd unit? Ditto, use:
SER2NET_INSTALL_INIT_SYSTEMDpackage/ser2net/ser2net.mk SER2NET_SITE = http://downloads.sourceforge.net/project/ser2net/ser2net · line 22
Quoted 6 lines
package/ser2net/ser2net.mk +6
-0+ +define SER2NET_INIT_SCRIPT_UNINSTALL + rm -f $(TARGET_DIR)/etc/init.d/S50ser2net +endef + +SER2NET_POST_UNINSTALL_TARGET_HOOKS += SER2NET_INIT_SCRIPT_UNINSTALLI think we decided that uninstall targets are not needed, because uninstall is not working completely in Buildroot. Drop it.
package/ser2net/ser2net.mk SER2NET_SITE = http://downloads.sourceforge.net/project/ser2net/ser2net · line 31
Quoted 9 lines
package/ser2net/ser2net.mk +9
-0+ +define SER2NET_CONF_INSTALL + if [ "$(BR2_PACKAGE_SER2NET_CONF)" != "" ] ; then \ + $(INSTALL) -m 0644 $(BR2_PACKAGE_SER2NET_CONF) \ + $(TARGET_DIR)/etc/ser2net.conf ; \ + fi +endef + +SER2NET_POST_INSTALL_TARGET_HOOKS += SER2NET_CONF_INSTALLAlways install a default configuration file, as said above.
package/ser2net/ser2net.mk SER2NET_SITE = http://downloads.sourceforge.net/project/ser2net/ser2net · line 37
Quoted 5 lines
package/ser2net/ser2net.mk +5
-0+define SER2NET_CONFIG_UNINSTALL + rm -f $(TARGET_DIR)/etc/ser2net.conf +endef + +SER2NET_POST_UNINSTALL_TARGET_HOOKS += SER2NET_CONFIG_UNINSTALLDitto for uninstall: drop it.
Thank you!
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. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 ser2net: add default init script
Jean-Christophe, All,
Quoted 35 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 23 lines · Yann E. MORIN
Jean-Christophe, All,
See my comments inlined below.
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
add option to specify the configuration file
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- package/ser2net/Config.in | 9 +++++++++ package/ser2net/S50ser2net | 48 ++++++++++++++++++++++++++++++++++++++++++++ package/ser2net/ser2net.mk | 27 +++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 package/ser2net/S50ser2netpackage/ser2net/Config.in +0
-0@@ -8,5 +8,14 @@ config BR2_PACKAGE_SER2NET http://ser2net.sourceforge.netQuoted 10 lines
package/ser2net/Config.in config BR2_PACKAGE_SER2NET · line 16
Quoted 6 lines
package/ser2net/Config.in +6
-0+if BR2_PACKAGE_SER2NET + +config BR2_PACKAGE_SER2NET_CONF + string "Configuration file" + help + Configuration file.I think we should provide a default, basic configuration file that we install unconditionnally to the rootfs. The user will then be free to provide a post-build script to tweak that file.
Quoted 2 lines
I hate post-build it's not trackable and as it's completly board specific with x serial to export I do not want a generic file
It's not about what *you* want, it's about what is *best* for Buildroot and *all* its users, *and* is maintenable and easily reproduced (which pointing to a config file outside of the buildroot tree is definitely not) *and* can fit your use case (which what I suggest should).
We're speaking about a _default_ and _simple_ configuration file. Of course it can not cover all use cases, but just exporting a single serial port would be enough. Customisation beyond that is really part of the post-build scripts.
And if you think that post-build script are not trackable, then letting the user specify a config file (presumably out-side of the Buildroot tree) is no more trackable either. So this excuse does not hold water.
And I *do* track my post-build and post-image scripts. Here's the setting I use:
.../buildroot/ <- the buildroot tree
.../board-X/ <- the board-X tree, which *is* a git tree
.../board-X/configs/ <- dir with all .config files for board-X
.../board-X/scripts/ <- dir with add scripts for board-X
.../board-X/misc/ <- misc files to push into rootfs
.../board-X/build/ <- untracked dir for out-of-tree buildThen I have those files tracked in my git tree:
.../board-X/configs/br.defconfig
.../board-X/configs/linux.defconfig
.../board-X/configs/bb.defconfig
.../board-X/scripts/ssh-key-in-root.ssh.authorized_keys
.../board-X/scripts/other-mount-points-in-etc.fstab
.../board-X/scripts/create-sdcard-image
.../board-X/scripts/checksum-images
.../board-X/misc/S98dvb-devices[and so on...]
Now, all I said above is my point of view. Just let see what the maintainer will accept. :-)
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. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 ser2net: add default init script
Quoted 38 lines · Yann E. MORIN
Jean-Christophe, All,
Quoted 35 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 33 lines · Yann E. MORIN
Jean-Christophe, All,
See my comments inlined below.
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
add option to specify the configuration file
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>--- package/ser2net/Config.in | 9 +++++++++ package/ser2net/S50ser2net | 48 ++++++++++++++++++++++++++++++++++++++++++++ package/ser2net/ser2net.mk | 27 +++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 package/ser2net/S50ser2netpackage/ser2net/Config.in +0
-0package/ser2net/Config.in config BR2_PACKAGE_SER2NET · line 16
Quoted 9 lines
package/ser2net/Config.in +6
-0@@ -8,5 +8,14 @@ config BR2_PACKAGE_SER2NET http://ser2net.sourceforge.net +if BR2_PACKAGE_SER2NET + +config BR2_PACKAGE_SER2NET_CONF + string "Configuration file" + help + Configuration file.I think we should provide a default, basic configuration file that we install unconditionnally to the rootfs. The user will then be free to provide a post-build script to tweak that file.
Quoted 7 lines
Quoted 2 lines
I hate post-build it's not trackable and as it's completly board specific with x serial to export I do not want a generic file
It's not about what *you* want, it's about what is *best* for Buildroot and *all* its users, *and* is maintenable and easily reproduced (which pointing to a config file outside of the buildroot tree is definitely not) *and* can fit your use case (which what I suggest should).
I want to put the ser2net.conf in the tree not our of tree
Quoted 5 lines
We're speaking about a _default_ and _simple_ configuration file. Of course it can not cover all use cases, but just exporting a single serial port would be enough. Customisation beyond that is really part of the post-build scripts.
the problem here which port you export?
the ttyS0? no it's mostly the default console
how could you even think of any generic file as the name of the port(s) and configuration is board specific
This will be completly board specific
Best Regards,
J.
PATCH 1/1 ser2net: add default init script
Jean-Christophe, All,
Quoted 5 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines · Yann E. MORIN
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 2 lines · Yann E. MORIN
Quoted 1 line · Jean-Christophe PLAGNIOL-VILLARD
add option to specify the configuration file
[--SNIP--]
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
I think we should provide a default, basic configuration file that we install unconditionnally to the rootfs. The user will then be free to provide a post-build script to tweak that file.
I hate post-build it's not trackable and as it's completly board specific with x serial to export I do not want a generic file
Quoted 6 lines
Quoted 4 lines
It's not about what *you* want, it's about what is *best* for Buildroot and *all* its users, *and* is maintenable and easily reproduced (which pointing to a config file outside of the buildroot tree is definitely not) *and* can fit your use case (which what I suggest should).
I want to put the ser2net.conf in the tree not our of tree
OK. So, why have it configurable if it is in the tree in the first place?
Quoted 6 lines
Quoted 4 lines
We're speaking about a _default_ and _simple_ configuration file. Of course it can not cover all use cases, but just exporting a single serial port would be enough. Customisation beyond that is really part of the post-build scripts.
the problem here which port you export?
the ttyS0? no it's mostly the default console
Of course, ttyS0 is special because it is the console. ttyS1 is a good candidate.
Quoted 2 lines
how could you even think of any generic file as the name of the port(s) and configuration is board specific
IIRC, I never said 'generic'; I said 'default and basic', which I agree did not completely convey what I meant. I think this file should be seen as a (kind of) example that would work on some boards (eg. a PC) but would anyway need further customisation.
Quoted 1 line
This will be completly board specific
Yes, I agree that will be board specific.
However, providing a default configuration file that exports ttyS1 can serve as a basis for the user to customise.
We can't expect everything in Buildroot to work without customisation. For example, a webserver will always have pages to serve, so the user will have to provide those. And provide a certificate if he wants to serve https. And so on... The same goes for this kind of configuration:
provide a simple, basic config file that the user can further customise, or even entirely replace.
And this kind of customisation is done with post-build scripts.
However, an alternative solution would be to ask the user what port(s) to export, and generate the config file from ser2net.mk. If this is not enough, then a post-build script can be used to provide a more advanced config file.
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. | '------------------------------^-------^------------------^--------------------'