package/inadyn: start script rework + repost
cover package/inadyn: start script rework + repost
Hi Thomas, all!
This patch set contains the rework of the inadyn start script. It is now modeled closely on BusyBox S01syslogd, as requested.
I'm also including a repost of the .conf example update and the switch to use the upstrem systemd unit file.
Best regards
/Joachim
Joachim Wiberg (3):
package/inadyn: replace local systemd unit file with upstream package/inadyn: refactor start script package/inadyn: update inadyn.conf example
package/inadyn/S70inadyn | 100 ++++++++++++++++++++++------------ package/inadyn/inadyn.conf | 25 +++++++-- package/inadyn/inadyn.mk | 2 +- package/inadyn/inadyn.service | 10 ---- 4 files changed, 86 insertions(+), 51 deletions(-) mode change 100644 => 100755 package/inadyn/S70inadyn delete mode 100644 package/inadyn/inadyn.service
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/3 package/inadyn: replace local systemd unit file with upstream
If systemd is available at configure time, the inadyn configure script detects it and generates the unit file.
Also, the local unit file had the wrong absolute path to the binary.
--- package/inadyn/inadyn.mk | 2 +- package/inadyn/inadyn.service | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 package/inadyn/inadyn.service
package/inadyn/inadyn.mk +1 -1
@@ -31,7 +31,7 @@ define INADYN_INSTALL_INIT_SYSV endef define INADYN_INSTALL_INIT_SYSTEMD - $(INSTALL) -D -m 644 package/inadyn/inadyn.service \ + $(INSTALL) -D -m 644 $(@D)/inadyn.service \ $(TARGET_DIR)/usr/lib/systemd/system/inadyn.service endef
package/inadyn/inadyn.service deleted +0 -10
@@ -1,10 +0,0 @@ -[Unit] -Description=DDNS client -After=syslog.target network.target - -[Service] -ExecStart=/usr/bin/inadyn -Restart=always - -[Install] -WantedBy=multi-user.target
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH next 1/3] package/inadyn: replace local systemd unit file with upstream
Hi,
please ignore this specific patch repost. I see now it actually made it into next already.
Sorry for the noise!
Best regards
/Joachim
Quoted 32 lines · Joachim Wiberg
If systemd is available at configure time, the inadyn configure script detects it and generates the unit file.
Also, the local unit file had the wrong absolute path to the binary.
Signed-off-by Joachim Wiberg <[email protected]>--- package/inadyn/inadyn.mk | 2 +- package/inadyn/inadyn.service | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 package/inadyn/inadyn.servicepackage/inadyn/inadyn.mk +1
-1@@ -31,7 +31,7 @@ define INADYN_INSTALL_INIT_SYSV endef define INADYN_INSTALL_INIT_SYSTEMD - $(INSTALL) -D -m 644 package/inadyn/inadyn.service \ + $(INSTALL) -D -m 644 $(@D)/inadyn.service \ $(TARGET_DIR)/usr/lib/systemd/system/inadyn.service endefpackage/inadyn/inadyn.service deleted +0
-0
package/inadyn/inadyn.service line 10
Quoted 10 lines
package/inadyn/inadyn.service deleted +0
-10@@ -1,10 +0,0 @@ -[Unit] -Description=DDNS client -After=syslog.target network.target - -[Service] -ExecStart=/usr/bin/inadyn -Restart=always - -[Install] -WantedBy=multi-user.target
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/3 package/inadyn: refactor start script
In reply to Joachim WibergThis patch is a complete rewrite of the Inadyn start script, based on the BusyBox S01syslogd template. Additional features, compared to the template, are limited to the ability to:
- Check if enabled, using an ENABLED="yes" from /etc/default/inadyn, this for compatibility with the previous version of the script
- Override INADYN_ARGS from /etc/default/inadyn
- A reload command that sends SIGHUP, since that works and is both quicker and a less resource intensive operation
--- package/inadyn/S70inadyn | 100 +++++++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 35 deletions(-) mode change 100644 => 100755 package/inadyn/S70inadyn
package/inadyn/S70inadyn +65 -35
@@ -1,44 +1,74 @@ #!/bin/sh +# Customizations are sourced from /etc/default/inadyn. For example, +# override INADYN_ARGS to adjust log level, add a startup delay, etc. # -# Start & stop the inadyn client -# +# NOTE: to start, add a line ENABLED="yes" to /etc/default/inadyn + +DAEMON="inadyn" +PIDFILE="/var/run/$DAEMON.pid" + +INADYN_ARGS="" -CONFIG=/etc/inadyn.conf +# shellcheck source=/dev/null +[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" -# check if CONFIG exists, print message & exit if it doesn't -[ ! -f $CONFIG ] && ( echo "The config file "$CONFIG" is missing...exiting now." && exit 2 ) +start() +{ + printf 'Starting %s: ' "$DAEMON" + if [ "$ENABLED" != "yes" ]; then + echo "SKIPPED" + exit 0 + fi + # shellcheck disable=SC2086 # we need the word splitting + start-stop-daemon -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \ + -- $INADYN_ARGS + status=$? + if [ "$status" -eq 0 ]; then + echo "OK" + else + echo "FAIL" + fi + return "$status" +} -# Allow a few customizations from a config file. Especially inadyn -# must be explicitly enabled by adding ENABLED="yes" in this file. -test -r /etc/default/inadyn && . /etc/default/inadyn +stop() +{ + printf 'Stopping %s: ' "$DAEMON" + start-stop-daemon -K -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" + status=$? + if [ "$status" -eq 0 ]; then + rm -f "$PIDFILE" + echo "OK" + else + echo "FAIL" + fi + return "$status" +} + +restart() +{ + stop + sleep 1 + start +} + +reload() +{ + printf 'Reloading %s: ' "$DAEMON" + start-stop-daemon -K -s HUP -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" + status=$? + if [ "$status" -eq 0 ]; then + echo "OK" + else + echo "FAIL" + fi + return "$status" +} case "$1" in - start) - printf "Starting inadyn: " - if test "${ENABLED}" != "yes" ; then - echo "SKIPPED" - exit 0 - fi - start-stop-daemon -b -q -S -p /var/run/inadyn.pid -x /usr/sbin/inadyn - [ $? = 0 ] && echo "OK" || echo "FAIL" - ;; - stop) - printf "Stopping inadyn: " - if test "${ENABLED}" != "yes" ; then - echo "SKIPPED" - exit 0 - fi - start-stop-daemon -q -K -p /var/run/inadyn.pid -x /usr/sbin/inadyn - [ $? = 0 ] && echo "OK" || echo "FAIL" - rm -f /var/run/inadyn.pid - ;; - restart) - "$0" stop - "$0" start - ;; - *) - echo "Usage: $0 {start|stop|restart}" + start|stop|restart|reload) + "$1";; + *) + echo "Usage: $0 {start|stop|restart|reload}" exit 1 esac - -exit $?
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH next 2/3] package/inadyn: refactor start script
Quoted 36 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Joachim" == Joachim Wiberg <[email protected]> writes:
This patch is a complete rewrite of the Inadyn start script, based on the BusyBox S01syslogd template. Additional features, compared to the template, are limited to the ability to:
- Check if enabled, using an ENABLED="yes" from
/etc/default/inadyn, this for compatibility with the previous version of the script
- OverrideINADYN_ARGSfrom/etc/default/inadyn
- A reload command that sends SIGHUP, since that works and is both quicker and a less resource intensive operationSigned-off-by Joachim Wiberg <[email protected]>--- package/inadyn/S70inadyn | 100 +++++++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 35 deletions(-) mode change 100644 => 100755 package/inadyn/S70inadynpackage/inadyn/S70inadyn +7
-2@@ -1,44 +1,74 @@ #!/bin/sh +# Customizations are sourced from /etc/default/inadyn. For example, +# override INADYN_ARGS to adjust log level, add a startup delay, etc. # -# Start & stop the inadyn client -# +# NOTE: to start, add a line ENABLED="yes" to /etc/default/inadyn + +DAEMON="inadyn" +PIDFILE="/var/run/$DAEMON.pid" +
package/inadyn/S70inadyn line 16
Quoted 10 lines
package/inadyn/S70inadyn +5
-3+INADYN_ARGS="" -CONFIG=/etc/inadyn.conf +# shellcheck source=/dev/null +[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON" -# check if CONFIG exists, print message & exit if it doesn't -[ ! -f $CONFIG ] && ( echo "The config file "$CONFIG" is missing...exiting now." && exit 2 ) +start() +{
Our other init scripts have the { on the same line as the function, so changed that and committed, thanks.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 3/3 package/inadyn: update inadyn.conf example
In reply to Joachim Wiberg - Comment out iface setting, usually not what you want
- Update DynDNS example, show use of multiple hostnames
- Add FreeDNS sample config, free and stable service
- Add link to syntax and examples
--- package/inadyn/inadyn.conf | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
package/inadyn/inadyn.conf +20 -5
@@ -1,11 +1,26 @@ -# Basic configuration file for inadyn +# Example /etc/inadyn.conf # -# /etc/inadyn.conf -iface = eth0 +# Remember to change this file to match your provider and credentials +# Username and password can be included from another file. For more +# info, see https://man.troglobit.com/man5/inadyn.conf.5.html + +# Use IP address of interface instead of external checkip server. +# Useful when you want to register internal IP addresses +#iface = eth0 + +# IP address change check interval period = 300 -provider [email protected] { +# Remove of change to match your Dyn account +provider dyndns.org { username = test password = test - hostname = test + hostname = { "my.example.com", "other.example.org" } +} + +# Remove or change to match your FreeDNS account +provider freedns { + username = lower-case-username + password = case-sensitive-pwd + hostname = some.example.com }
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Arnout Vandecappelle
AppliedRe: [Buildroot] [PATCH next 3/3] package/inadyn: update inadyn.conf example
Quoted 6 lines · Joachim Wiberg
- Comment out iface setting, usually not what you want
- Update DynDNS example, show use of multiple hostnames
- Add FreeDNS sample config, free and stable service
- Add link to syntax and examplesSigned-off-by Joachim Wiberg <[email protected]>
Applied to master, thanks.
Regards,
Arnout
Quoted 31 lines
--- package/inadyn/inadyn.conf | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)package/inadyn/inadyn.conf +12
-4@@ -1,11 +1,26 @@ -# Basic configuration file for inadyn +# Example /etc/inadyn.conf # -# /etc/inadyn.conf -iface = eth0 +# Remember to change this file to match your provider and credentials +# Username and password can be included from another file. For more +# info, see https://man.troglobit.com/man5/inadyn.conf.5.html + +# Use IP address of interface instead of external checkip server. +# Useful when you want to register internal IP addresses +#iface = eth0 + +# IP address change check interval period = 300 -provider [email protected] { +# Remove of change to match your Dyn account +provider dyndns.org { username = test password = test
package/inadyn/inadyn.conf line 26
Quoted 10 lines
package/inadyn/inadyn.conf +8
-1- hostname = test + hostname = { "my.example.com", "other.example.org" } +} + +# Remove or change to match your FreeDNS account +provider freedns { + username = lower-case-username + password = case-sensitive-pwd + hostname = some.example.com }
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot