* [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script
@ 2024-07-04 10:16 Fiona Klute via buildroot
2024-07-04 10:16 ` [Buildroot] [PATCH v4 1/3] package/openssh: manage sshd using start-stop-daemon Fiona Klute via buildroot
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Fiona Klute via buildroot @ 2024-07-04 10:16 UTC (permalink / raw)
To: buildroot; +Cc: Yann E . MORIN, Fiona Klute (WIWA)
From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de>
This series is the result of running "/etc/init.d/S50sshd restart"
over an SSH connection and finding that not only it destroyed my SSH
session (this is no longer issue with OpenSSH 9.8), the SSH server
also did not come back up. The main issue there was the use of
"killall sshd" instead of stopping only the listening server (patch
1). I assume restarting the SSH server on a Buildroot-created system
is not a common use case, I need a reload to reset its state during
automated tests.
I took the opportunity to make some more improvements: manage sshd
using start-stop-daemon, including error checks (patch 1), style
cleanup (patch 2), and implementing "reload" using SIGHUP (patch 3).
The added checks for a currently running service before
start/stop/reload bring a slight change in behavior, there will be a
non-zero exit code when trying to start when sshd is already running,
or stop/reload when it's not. I consider this useful to find errors in
scripts instead of masking them, but I don't mind removing that if
it's considered a problem.
Changes v3 -> v4:
* Avoid start-stop-daemon --retry option, the Busybox implementation
silently ignores it.
Changes v2 -> v3:
* Manage sshd using start-stop-daemon (patches 1, 3), making patch 4
obsolete (dropped from the series).
* Set DAEMON variable, the complete series now removes all checkpatch
warnings for the init script (patch 1).
Changes v1 -> v2:
* Acknowledge changed session binary with OpenSSH 9.8 in commit
message (patch 1)
* Check sshd exit code on service start (patch 4)
Fiona Klute (WIWA) (3):
package/openssh: manage sshd using start-stop-daemon
package/openssh: fix init script indentation
package/openssh: implement "reload" using SIGHUP
.checkpackageignore | 1 -
package/openssh/S50sshd | 65 +++++++++++++++++++++++++++++------------
2 files changed, 47 insertions(+), 19 deletions(-)
--
2.45.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 10+ messages in thread* [Buildroot] [PATCH v4 1/3] package/openssh: manage sshd using start-stop-daemon 2024-07-04 10:16 [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script Fiona Klute via buildroot @ 2024-07-04 10:16 ` Fiona Klute via buildroot 2024-07-04 10:16 ` [Buildroot] [PATCH v4 2/3] package/openssh: fix init script indentation Fiona Klute via buildroot ` (2 subsequent siblings) 3 siblings, 0 replies; 10+ messages in thread From: Fiona Klute via buildroot @ 2024-07-04 10:16 UTC (permalink / raw) To: buildroot; +Cc: Yann E . MORIN, Fiona Klute (WIWA) From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de> The previously used "killall sshd" stopped all instances of sshd. With OpenSSH before 9.8 that meant not only the listening server, but also instances serving currently open sessions, possibly including the one used to send the restart command, preventing it from completing the "start" part of "restart" and leaving the system unreachable over SSH. start-stop-daemon uses the PID file to target only the intended process, and has built-in capability to check if it is running. This ensures any open SSH sessions are unaffected, as well as unrelated processes (in case a daemon crashed and the PID got reused). Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> --- Changes v3 -> v4: * Avoid start-stop-daemon --retry option, the Busybox implementation silently ignores it. Changes v2 -> v3: * Manage sshd using start-stop-daemon. * Set DAEMON variable, removing a checkpatch warning. Changes v1 -> v2: * Acknowledge changed session binary with OpenSSH 9.8 in commit message (patch 1) * Check sshd exit code on service start (patch 4) .checkpackageignore | 2 +- package/openssh/S50sshd | 27 +++++++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.checkpackageignore b/.checkpackageignore index 1e1fc9018e..2edbae93d8 100644 --- a/.checkpackageignore +++ b/.checkpackageignore @@ -1149,7 +1149,7 @@ package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch lib_pa package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch lib_patch.Upstream package/openrc/0005-runlevels-do-not-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch lib_patch.Upstream package/openrc/0006-Also-create-run-lock-subsys-directory.patch lib_patch.Upstream -package/openssh/S50sshd lib_sysv.EmptyLastLine lib_sysv.Indent lib_sysv.Variables +package/openssh/S50sshd lib_sysv.Indent package/openswan/0001-lib-libopenswan-constants.c-workaround-missing-ns_t_.patch lib_patch.Upstream package/opentyrian/0001-Move-definitions-that-don-t-need-to-be-exposed-from-opl-h-to-opl-c.patch lib_patch.Upstream package/openvmtools/0001-no_cflags_werror.patch lib_patch.Upstream diff --git a/package/openssh/S50sshd b/package/openssh/S50sshd index 22da41d1ca..5ad156bf17 100644 --- a/package/openssh/S50sshd +++ b/package/openssh/S50sshd @@ -3,6 +3,9 @@ # sshd Starts sshd. # +DAEMON="sshd" +PIDFILE="/var/run/$DAEMON.pid" + # Make sure the ssh-keygen progam exists [ -f /usr/bin/ssh-keygen ] || exit 0 @@ -13,16 +16,29 @@ start() { /usr/bin/ssh-keygen -A printf "Starting sshd: " - /usr/sbin/sshd - touch /var/lock/sshd - echo "OK" + if start-stop-daemon --start -p "$PIDFILE" \ + --exec "/usr/sbin/$DAEMON"; then + echo "OK" + else + echo "ERROR" + return 1 + fi } + stop() { printf "Stopping sshd: " - killall sshd - rm -f /var/lock/sshd + if ! start-stop-daemon --stop -p "$PIDFILE" \ + --exec "/usr/sbin/$DAEMON"; then + echo "ERROR" + return 1 + fi + # sshd deletes its PID file on exit, wait for it to be gone + while [ -f "$PIDFILE" ]; do + sleep 0.1 + done echo "OK" } + restart() { stop start @@ -44,4 +60,3 @@ case "$1" in esac exit $? - -- 2.45.2 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH v4 2/3] package/openssh: fix init script indentation 2024-07-04 10:16 [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script Fiona Klute via buildroot 2024-07-04 10:16 ` [Buildroot] [PATCH v4 1/3] package/openssh: manage sshd using start-stop-daemon Fiona Klute via buildroot @ 2024-07-04 10:16 ` Fiona Klute via buildroot 2024-07-04 10:16 ` [Buildroot] [PATCH v4 3/3] package/openssh: implement "reload" using SIGHUP Fiona Klute via buildroot 2024-07-08 21:53 ` [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script Thomas Petazzoni via buildroot 3 siblings, 0 replies; 10+ messages in thread From: Fiona Klute via buildroot @ 2024-07-04 10:16 UTC (permalink / raw) To: buildroot; +Cc: Yann E . MORIN, Fiona Klute (WIWA) From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de> This brings the script in line with .editorconfig settings and other newer init scripts. Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> --- .checkpackageignore | 1 - package/openssh/S50sshd | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.checkpackageignore b/.checkpackageignore index 2edbae93d8..b9edefd50a 100644 --- a/.checkpackageignore +++ b/.checkpackageignore @@ -1149,7 +1149,6 @@ package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch lib_pa package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch lib_patch.Upstream package/openrc/0005-runlevels-do-not-add-agetty.tty-1-6-if-MKSYSVINIT-ye.patch lib_patch.Upstream package/openrc/0006-Also-create-run-lock-subsys-directory.patch lib_patch.Upstream -package/openssh/S50sshd lib_sysv.Indent package/openswan/0001-lib-libopenswan-constants.c-workaround-missing-ns_t_.patch lib_patch.Upstream package/opentyrian/0001-Move-definitions-that-don-t-need-to-be-exposed-from-opl-h-to-opl-c.patch lib_patch.Upstream package/openvmtools/0001-no_cflags_werror.patch lib_patch.Upstream diff --git a/package/openssh/S50sshd b/package/openssh/S50sshd index 5ad156bf17..a26a1cc6a9 100644 --- a/package/openssh/S50sshd +++ b/package/openssh/S50sshd @@ -45,18 +45,18 @@ restart() { } case "$1" in - start) - start - ;; - stop) - stop - ;; - restart|reload) - restart - ;; - *) - echo "Usage: $0 {start|stop|restart}" - exit 1 + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 esac exit $? -- 2.45.2 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH v4 3/3] package/openssh: implement "reload" using SIGHUP 2024-07-04 10:16 [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script Fiona Klute via buildroot 2024-07-04 10:16 ` [Buildroot] [PATCH v4 1/3] package/openssh: manage sshd using start-stop-daemon Fiona Klute via buildroot 2024-07-04 10:16 ` [Buildroot] [PATCH v4 2/3] package/openssh: fix init script indentation Fiona Klute via buildroot @ 2024-07-04 10:16 ` Fiona Klute via buildroot 2024-07-08 21:53 ` [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script Thomas Petazzoni via buildroot 3 siblings, 0 replies; 10+ messages in thread From: Fiona Klute via buildroot @ 2024-07-04 10:16 UTC (permalink / raw) To: buildroot; +Cc: Yann E . MORIN, Fiona Klute (WIWA) From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de> This is the documented "reload configuration" method for OpenSSH. Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> --- Changes v2 -> v3: * Manage sshd using start-stop-daemon (instead of kill -HUP). Changes v1 -> v2: * Acknowledge changed session binary with OpenSSH 9.8 in commit message (patch 1) * Check sshd exit code on service start (patch 4) package/openssh/S50sshd | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/package/openssh/S50sshd b/package/openssh/S50sshd index a26a1cc6a9..4a6abb15e5 100644 --- a/package/openssh/S50sshd +++ b/package/openssh/S50sshd @@ -44,6 +44,17 @@ restart() { start } +reload() { + printf "Reloading sshd config: " + if start-stop-daemon --stop --signal HUP -q -p "$PIDFILE" \ + --exec "/usr/sbin/$DAEMON"; then + echo "OK" + else + echo "ERROR" + return 1 + fi +} + case "$1" in start) start @@ -51,11 +62,14 @@ case "$1" in stop) stop ;; - restart|reload) + restart) restart ;; + reload) + reload + ;; *) - echo "Usage: $0 {start|stop|restart}" + echo "Usage: $0 {start|stop|restart|reload}" exit 1 esac -- 2.45.2 _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script 2024-07-04 10:16 [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script Fiona Klute via buildroot ` (2 preceding siblings ...) 2024-07-04 10:16 ` [Buildroot] [PATCH v4 3/3] package/openssh: implement "reload" using SIGHUP Fiona Klute via buildroot @ 2024-07-08 21:53 ` Thomas Petazzoni via buildroot 2024-07-09 9:55 ` Fiona Klute via buildroot 3 siblings, 1 reply; 10+ messages in thread From: Thomas Petazzoni via buildroot @ 2024-07-08 21:53 UTC (permalink / raw) To: Fiona Klute via buildroot; +Cc: Fiona Klute, Yann E . MORIN Hello Fiona, On Thu, 4 Jul 2024 12:16:28 +0200 Fiona Klute via buildroot <buildroot@buildroot.org> wrote: > Fiona Klute (WIWA) (3): > package/openssh: manage sshd using start-stop-daemon > package/openssh: fix init script indentation > package/openssh: implement "reload" using SIGHUP Thanks, I have applied your series, but I have reworked quite a bit PATCH 1/3 and 3/3 to follow the canonical example of init script we give in the Buildroot documentation, see: https://buildroot.org/downloads/manual/manual.html#adding-packages-start-script And review the final commits: https://gitlab.com/buildroot.org/buildroot/-/commit/8900311b7e5450082cace986533a093d37900efa https://gitlab.com/buildroot.org/buildroot/-/commit/df605de1349251687640519fcc2d2147cf146af9 https://gitlab.com/buildroot.org/buildroot/-/commit/2c14a55c6cf28ada9f1d3d17d3b11370829372ca Hopefully I didn't mess up :/ Best regards, Thomas -- Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script 2024-07-08 21:53 ` [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script Thomas Petazzoni via buildroot @ 2024-07-09 9:55 ` Fiona Klute via buildroot 2024-07-09 10:06 ` Thomas Petazzoni via buildroot 0 siblings, 1 reply; 10+ messages in thread From: Fiona Klute via buildroot @ 2024-07-09 9:55 UTC (permalink / raw) To: Thomas Petazzoni, Fiona Klute via buildroot; +Cc: Yann E . MORIN Am 08.07.24 um 23:53 schrieb Thomas Petazzoni: > Hello Fiona, > > On Thu, 4 Jul 2024 12:16:28 +0200 > Fiona Klute via buildroot <buildroot@buildroot.org> wrote: > >> Fiona Klute (WIWA) (3): >> package/openssh: manage sshd using start-stop-daemon >> package/openssh: fix init script indentation >> package/openssh: implement "reload" using SIGHUP > > Thanks, I have applied your series, but I have reworked quite a bit > PATCH 1/3 and 3/3 to follow the canonical example of init script we > give in the Buildroot documentation, see: > > https://buildroot.org/downloads/manual/manual.html#adding-packages-start-script > > And review the final commits: > > https://gitlab.com/buildroot.org/buildroot/-/commit/8900311b7e5450082cace986533a093d37900efa > https://gitlab.com/buildroot.org/buildroot/-/commit/df605de1349251687640519fcc2d2147cf146af9 > https://gitlab.com/buildroot.org/buildroot/-/commit/2c14a55c6cf28ada9f1d3d17d3b11370829372ca > > Hopefully I didn't mess up :/ The script is functional, but the use of long options was intentional for readability and I'd rather have it preserved. Having existing scripts in a hard-to-read style doesn't seem like a good reason not to be more explicit in new/updated ones [1]. That was the reason for the question (and patch) about which Busybox options I can rely on when writing init scripts. Regarding the added "-q", if a start (stop) command fails because an instance is already running (not running) with the current version you only get "Starting sshd: FAIL", while with my version you'd see the *reason* in start-stop-daemon output. That seems important to me. I only had "-q" in the reload function because the "stopping" output of start-stop-daemon (when it's actually just sending a SIGHUP) seemed like it might confuse someone. Best regards, Fiona [1] https://lore.kernel.org/buildroot/6d02d2d5-e71e-45b3-a447-e81521085e7a@mind.be/ _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script 2024-07-09 9:55 ` Fiona Klute via buildroot @ 2024-07-09 10:06 ` Thomas Petazzoni via buildroot 2024-07-09 11:31 ` Fiona Klute via buildroot 0 siblings, 1 reply; 10+ messages in thread From: Thomas Petazzoni via buildroot @ 2024-07-09 10:06 UTC (permalink / raw) To: Fiona Klute; +Cc: Yann E . MORIN, Fiona Klute via buildroot Hello Fiona, On Tue, 9 Jul 2024 11:55:56 +0200 Fiona Klute <fiona.klute@gmx.de> wrote: > The script is functional, but the use of long options was intentional > for readability and I'd rather have it preserved. Having existing > scripts in a hard-to-read style doesn't seem like a good reason not to > be more explicit in new/updated ones [1]. That was the reason for the > question (and patch) about which Busybox options I can rely on when > writing init scripts. > > Regarding the added "-q", if a start (stop) command fails because an > instance is already running (not running) with the current version you > only get "Starting sshd: FAIL", while with my version you'd see the > *reason* in start-stop-daemon output. That seems important to me. I only > had "-q" in the reload function because the "stopping" output of > start-stop-daemon (when it's actually just sending a SIGHUP) seemed like > it might confuse someone. I'm fine with both, but then I think the documentation and the canonical example it refers to should be fixed first. This is how we declare what is the "right" way of doing things. Otherwise, we'll keep on using these as a reference for all future scripts, and we don't have a reference point that tells us how things should be done when fixing existing scripts or adding new ones. Best regards, Thomas -- Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script 2024-07-09 10:06 ` Thomas Petazzoni via buildroot @ 2024-07-09 11:31 ` Fiona Klute via buildroot 2024-07-09 11:44 ` yann.morin 0 siblings, 1 reply; 10+ messages in thread From: Fiona Klute via buildroot @ 2024-07-09 11:31 UTC (permalink / raw) To: Thomas Petazzoni; +Cc: Yann E . MORIN, Fiona Klute via buildroot Am 09.07.24 um 12:06 schrieb Thomas Petazzoni: > Hello Fiona, > > On Tue, 9 Jul 2024 11:55:56 +0200 > Fiona Klute <fiona.klute@gmx.de> wrote: > >> The script is functional, but the use of long options was intentional >> for readability and I'd rather have it preserved. Having existing >> scripts in a hard-to-read style doesn't seem like a good reason not to >> be more explicit in new/updated ones [1]. That was the reason for the >> question (and patch) about which Busybox options I can rely on when >> writing init scripts. >> >> Regarding the added "-q", if a start (stop) command fails because an >> instance is already running (not running) with the current version you >> only get "Starting sshd: FAIL", while with my version you'd see the >> *reason* in start-stop-daemon output. That seems important to me. I only >> had "-q" in the reload function because the "stopping" output of >> start-stop-daemon (when it's actually just sending a SIGHUP) seemed like >> it might confuse someone. > > I'm fine with both, but then I think the documentation and the > canonical example it refers to should be fixed first. This is how we > declare what is the "right" way of doing things. Otherwise, we'll keep > on using these as a reference for all future scripts, and we don't have > a reference point that tells us how things should be done when fixing > existing scripts or adding new ones. Makes sense, I'll try to update the reference. Is there some way to get an asciidoc "include::package/busybox/S01syslogd" to work instead of copying the code into docs/manual/adding-packages-directory.adoc (as it is now, and not exactly identical)? It seems like the path is resolved relative to $(OUTPUT)/docs/manual instead of the source, I didn't dig into the Makefiles enough to see why yet. Best regards, Fiona _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script 2024-07-09 11:31 ` Fiona Klute via buildroot @ 2024-07-09 11:44 ` yann.morin 2024-07-10 17:39 ` Fiona Klute via buildroot 0 siblings, 1 reply; 10+ messages in thread From: yann.morin @ 2024-07-09 11:44 UTC (permalink / raw) To: Fiona Klute; +Cc: Yann E . MORIN, Thomas Petazzoni, Fiona Klute via buildroot Fiona, All, On 2024-07-09 13:31 +0200, Fiona Klute via buildroot spake thusly: > Am 09.07.24 um 12:06 schrieb Thomas Petazzoni: > > Hello Fiona, > > > > On Tue, 9 Jul 2024 11:55:56 +0200 > > Fiona Klute <fiona.klute@gmx.de> wrote: > > > > > The script is functional, but the use of long options was intentional > > > for readability and I'd rather have it preserved. Having existing > > > scripts in a hard-to-read style doesn't seem like a good reason not to > > > be more explicit in new/updated ones [1]. That was the reason for the > > > question (and patch) about which Busybox options I can rely on when > > > writing init scripts. > > > > > > Regarding the added "-q", if a start (stop) command fails because an > > > instance is already running (not running) with the current version you > > > only get "Starting sshd: FAIL", while with my version you'd see the > > > *reason* in start-stop-daemon output. That seems important to me. I only > > > had "-q" in the reload function because the "stopping" output of > > > start-stop-daemon (when it's actually just sending a SIGHUP) seemed like > > > it might confuse someone. > > > > I'm fine with both, but then I think the documentation and the > > canonical example it refers to should be fixed first. This is how we > > declare what is the "right" way of doing things. Otherwise, we'll keep > > on using these as a reference for all future scripts, and we don't have > > a reference point that tells us how things should be done when fixing > > existing scripts or adding new ones. > > Makes sense, I'll try to update the reference. > > Is there some way to get an asciidoc > "include::package/busybox/S01syslogd" to work instead of copying the > code into docs/manual/adding-packages-directory.adoc (as it is now, and > not exactly identical)? It seems like the path is resolved relative to > $(OUTPUT)/docs/manual instead of the source, I didn't dig into the > Makefiles enough to see why yet. This is so that "documents" can have generated parts. This can be achieved by defining [DOC]_POST_RSYNC_HOOKS, similar to what we can do for packages. For the Buildroot manual, you could add such a hook to copy what you need. Note that you can't include a file from a code-block in asciidoc, so you'll probably have to generate proper asciidoc, something like. define MANUAL_INIT_SCRIPT_REF { \ printf '---\n'; \ cat package/busybox/S01syslogd; \ printf '---\n'; \ } >$(@D)/S01syslogd.adoc endef MANUAL_POST_RSYNC_HOOKS += MANUAL_INIT_SCRIPT_REF And then you may include::S01syslogd.adoc Regards, Yann E. MORIN. -- ____________ .-----------------.--------------------: _ :------------------. | Yann E. MORIN | Real-Time Embedded | __/ ) | /"\ ASCII RIBBON | | | Software Designer | _/ - /' | \ / CAMPAIGN | | +33 638.411.245 '--------------------: (_ `--, | X AGAINST | | yann.morin (at) orange.com |_=" ,--' | / \ HTML MAIL | '--------------------------------------:______/_____:------------------' ____________________________________________________________________________________________________________ Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration, Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci. This message and its attachments may contain confidential or privileged information that may be protected by law; they should not be distributed, used or copied without authorisation. If you have received this email in error, please notify the sender and delete this message and its attachments. As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified. Thank you. _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script 2024-07-09 11:44 ` yann.morin @ 2024-07-10 17:39 ` Fiona Klute via buildroot 0 siblings, 0 replies; 10+ messages in thread From: Fiona Klute via buildroot @ 2024-07-10 17:39 UTC (permalink / raw) To: yann.morin; +Cc: Yann E . MORIN, Thomas Petazzoni, Fiona Klute via buildroot Am 09.07.24 um 13:44 schrieb yann.morin@orange.com: > Fiona, All, > > On 2024-07-09 13:31 +0200, Fiona Klute via buildroot spake thusly: >> Am 09.07.24 um 12:06 schrieb Thomas Petazzoni: >>> Hello Fiona, >>> >>> On Tue, 9 Jul 2024 11:55:56 +0200 >>> Fiona Klute <fiona.klute@gmx.de> wrote: >>> >>>> The script is functional, but the use of long options was intentional >>>> for readability and I'd rather have it preserved. Having existing >>>> scripts in a hard-to-read style doesn't seem like a good reason not to >>>> be more explicit in new/updated ones [1]. That was the reason for the >>>> question (and patch) about which Busybox options I can rely on when >>>> writing init scripts. >>>> >>>> Regarding the added "-q", if a start (stop) command fails because an >>>> instance is already running (not running) with the current version you >>>> only get "Starting sshd: FAIL", while with my version you'd see the >>>> *reason* in start-stop-daemon output. That seems important to me. I only >>>> had "-q" in the reload function because the "stopping" output of >>>> start-stop-daemon (when it's actually just sending a SIGHUP) seemed like >>>> it might confuse someone. >>> >>> I'm fine with both, but then I think the documentation and the >>> canonical example it refers to should be fixed first. This is how we >>> declare what is the "right" way of doing things. Otherwise, we'll keep >>> on using these as a reference for all future scripts, and we don't have >>> a reference point that tells us how things should be done when fixing >>> existing scripts or adding new ones. >> >> Makes sense, I'll try to update the reference. >> >> Is there some way to get an asciidoc >> "include::package/busybox/S01syslogd" to work instead of copying the >> code into docs/manual/adding-packages-directory.adoc (as it is now, and >> not exactly identical)? It seems like the path is resolved relative to >> $(OUTPUT)/docs/manual instead of the source, I didn't dig into the >> Makefiles enough to see why yet. > > This is so that "documents" can have generated parts. This can be > achieved by defining [DOC]_POST_RSYNC_HOOKS, similar to what we can do > for packages. For the Buildroot manual, you could add such a hook to > copy what you need. > > Note that you can't include a file from a code-block in asciidoc, so > you'll probably have to generate proper asciidoc, something like. > > define MANUAL_INIT_SCRIPT_REF > { \ > printf '---\n'; \ > cat package/busybox/S01syslogd; \ > printf '---\n'; \ > } >$(@D)/S01syslogd.adoc > endef > MANUAL_POST_RSYNC_HOOKS += MANUAL_INIT_SCRIPT_REF > > And then you may include::S01syslogd.adoc Thank you, the hook works, and actually even with include inside the source block [1], so I just need a "cp" in the post rsync hook. Using include does drop the line numbers that are hardcoded in the current inline code block, but I hope that won't be an issue. :-) Best regards, Fiona [1] https://docs.asciidoctor.org/asciidoc/latest/verbatim/source-blocks/#using-include-directives-in-source-blocks _______________________________________________ buildroot mailing list buildroot@buildroot.org https://lists.buildroot.org/mailman/listinfo/buildroot ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-07-10 17:39 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-07-04 10:16 [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script Fiona Klute via buildroot 2024-07-04 10:16 ` [Buildroot] [PATCH v4 1/3] package/openssh: manage sshd using start-stop-daemon Fiona Klute via buildroot 2024-07-04 10:16 ` [Buildroot] [PATCH v4 2/3] package/openssh: fix init script indentation Fiona Klute via buildroot 2024-07-04 10:16 ` [Buildroot] [PATCH v4 3/3] package/openssh: implement "reload" using SIGHUP Fiona Klute via buildroot 2024-07-08 21:53 ` [Buildroot] [PATCH v4 0/3] Refactor OpenSSH init.d script Thomas Petazzoni via buildroot 2024-07-09 9:55 ` Fiona Klute via buildroot 2024-07-09 10:06 ` Thomas Petazzoni via buildroot 2024-07-09 11:31 ` Fiona Klute via buildroot 2024-07-09 11:44 ` yann.morin 2024-07-10 17:39 ` Fiona Klute via buildroot
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox