Skip to contentSkip to conversation

package/busybox: add systemd service for telnetd

PATCH Applied Sam Voss via buildroot 3 participants 5 messages Aug 26, 2021 – Aug 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/busybox: add systemd service for telnetd

---
 package/busybox/busybox.mk      |  7 +++++++
 package/busybox/telnetd.service | 11 +++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 package/busybox/telnetd.service
package/busybox/busybox.mk +7 -0
index cfc06b0d78..fb427faf1c 100644
@@ -378,6 +378,13 @@ define BUSYBOX_INSTALL_TARGET_CMDS
 	$(BUSYBOX_INSTALL_MDEV_CONF)
 endef
 
+define BUSYBOX_INSTALL_INIT_SYSTEMD
+	if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y $(@D)/.config; then \
+		$(INSTALL) -D -m 0644 package/busybox/telnetd.service \
+			$(TARGET_DIR)/usr/lib/systemd/system/telnetd.service ; \
+	fi
+endef
+
 # Install the sysvinit scripts, for the moment, but not those that already
 # have a corresponding one in openrc.
 define BUSYBOX_INSTALL_INIT_OPENRC
package/busybox/telnetd.service new file +11 -0
new file mode 100644
index 0000000000..3c1fa457b1
@@ -0,0 +1,11 @@
+[Unit]
+Description=Telnetd Service
+After=network.target
+
+[Service]
+# busybox telnet doesn't support pidfile, so run in foreground
+Type=simple
+ExecStart=/usr/sbin/telnetd -F
+
+[Install]
+WantedBy=multi-user.target
Signature · 6 lines
2.17.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
Reviewed-by on v1 1/1
#1 lore raw
Quoted 31 lines · Sam Voss via buildroot
---
 package/busybox/busybox.mk      |  7 +++++++
 package/busybox/telnetd.service | 11 +++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 package/busybox/telnetd.service
package/busybox/busybox.mk +7 -0
index cfc06b0d78..fb427faf1c 100644
@@ -378,6 +378,13 @@ define BUSYBOX_INSTALL_TARGET_CMDS
 	$(BUSYBOX_INSTALL_MDEV_CONF)
 endef
 
+define BUSYBOX_INSTALL_INIT_SYSTEMD
+	if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y $(@D)/.config; then \
+		$(INSTALL) -D -m 0644 package/busybox/telnetd.service \
+			$(TARGET_DIR)/usr/lib/systemd/system/telnetd.service ; \
+	fi
+endef
+
 # Install the sysvinit scripts, for the moment, but not those that already
 # have a corresponding one in openrc.
 define BUSYBOX_INSTALL_INIT_OPENRC
package/busybox/telnetd.service new file +0 -0
new file mode 100644
index 0000000000..3c1fa457b1

package/busybox/telnetd.service line 6

Quoted 6 lines
package/busybox/telnetd.service new file +6 -0
@@ -0,0 +1,11 @@
+[Unit]
+Description=Telnetd Service
+After=network.target
+
+[Service]
+# busybox telnet doesn't support pidfile, so run in foreground

AFAIU Type=simple is anyway the preferred type for services without specific
systemd support, so I don't think this comment is very useful...

Regardless:

Regards,
Arnout

package/busybox/telnetd.service line 11

Quoted 6 lines
package/busybox/telnetd.service new file +5 -0
+Type=simple
+ExecStart=/usr/sbin/telnetd -F
+
+[Install]
+WantedBy=multi-user.target

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#2 lore raw

Arnout,

Quoted 46 lines

-----Original Message-----
From: Arnout Vandecappelle <[email protected]>
Sent: Thursday, August 26, 2021 5:01 PM
To: Voss, Samuel M Collins <[email protected]>; [email protected]
Subject: [External] Re: [Buildroot] [PATCH 1/1] package/busybox: add systemd service for telnetd

Review

Quoted 8 lines · Sam Voss via buildroot
---
 package/busybox/busybox.mk      |  7 +++++++
 package/busybox/telnetd.service | 11 +++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 package/busybox/telnetd.service
(quoted diff) +0 -0

b/package/busybox/busybox.mk

package/busybox/busybox.mk define BUSYBOX_INSTALL_TARGET_CMDS · line 382

Quoted 9 lines

index cfc06b0d78..fb427faf1c 100644

package/busybox/busybox.mk +2 -0
@@ -378,6 +378,13 @@ define BUSYBOX_INSTALL_TARGET_CMDS
 	$(BUSYBOX_INSTALL_MDEV_CONF)
 endef
 
+define BUSYBOX_INSTALL_INIT_SYSTEMD
+	if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y

$(@D)/.config; then \

package/busybox/busybox.mk define BUSYBOX_INSTALL_TARGET_CMDS · line 387

Quoted 2 lines
package/busybox/busybox.mk +2 -0
+		$(INSTALL) -D -m 0644 package/busybox/telnetd.service \
+
	$(TARGET_DIR)/usr/lib/systemd/system/telnetd.service ; \
Quoted 13 lines
package/busybox/busybox.mk +3 -0
+	fi
+endef
+
 # Install the sysvinit scripts, for the moment, but not those that

already # have a corresponding one in openrc.
define BUSYBOX_INSTALL_INIT_OPENRC

(quoted diff) +0 -0

b/package/busybox/telnetd.service new file mode 100644 index 0000000000..3c1fa457b1

package/busybox/telnetd.service new file +1 -0
@@ -0,0 +1,11 @@
+[Unit]
Quoted 8 lines

package/busybox/telnetd.service line 6

Quoted 5 lines
package/busybox/telnetd.service new file +5 -0
+Description=Telnetd Service
+After=network.target
+
+[Service]
+# busybox telnet doesn't support pidfile, so run in foreground

AFAIU Type=simple is anyway the preferred type for services without
specific systemd support, so I don't think this comment is very useful...

Fair enough, I didn't know that was the specific guidance, so I'm okay with dropping that comment when applying.

Thanks for letting me know,

Sam

Quoted 8 lines

Regardless:

Regards,
Arnout

Quoted 6 lines

package/busybox/telnetd.service line 11

Quoted 6 lines
package/busybox/telnetd.service new file +5 -0
+Type=simple
+ExecStart=/usr/sbin/telnetd -F
+
+[Install]
+WantedBy=multi-user.target

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw
Quoted 57 lines · Samuel M Collins

Arnout,

Quoted 46 lines

-----Original Message-----
From: Arnout Vandecappelle <[email protected]>
Sent: Thursday, August 26, 2021 5:01 PM
To: Voss, Samuel M Collins <[email protected]>; [email protected]
Subject: [External] Re: [Buildroot] [PATCH 1/1] package/busybox: add systemd service for telnetd

Review

Quoted 8 lines · Sam Voss via buildroot
---
 package/busybox/busybox.mk      |  7 +++++++
 package/busybox/telnetd.service | 11 +++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 package/busybox/telnetd.service
(quoted diff) +0 -0

b/package/busybox/busybox.mk

package/busybox/busybox.mk define BUSYBOX_INSTALL_TARGET_CMDS · line 382

Quoted 9 lines

index cfc06b0d78..fb427faf1c 100644

package/busybox/busybox.mk +2 -0
@@ -378,6 +378,13 @@ define BUSYBOX_INSTALL_TARGET_CMDS
 	$(BUSYBOX_INSTALL_MDEV_CONF)
 endef
 
+define BUSYBOX_INSTALL_INIT_SYSTEMD
+	if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y

$(@D)/.config; then \

package/busybox/busybox.mk define BUSYBOX_INSTALL_TARGET_CMDS · line 387

Quoted 2 lines
package/busybox/busybox.mk +2 -0
+		$(INSTALL) -D -m 0644 package/busybox/telnetd.service \
+
	$(TARGET_DIR)/usr/lib/systemd/system/telnetd.service ; \
Quoted 13 lines
package/busybox/busybox.mk +3 -0
+	fi
+endef
+
 # Install the sysvinit scripts, for the moment, but not those that

already # have a corresponding one in openrc.
define BUSYBOX_INSTALL_INIT_OPENRC

(quoted diff) +0 -0

b/package/busybox/telnetd.service new file mode 100644 index 0000000000..3c1fa457b1

package/busybox/telnetd.service new file +1 -0
@@ -0,0 +1,11 @@
+[Unit]
Quoted 8 lines

package/busybox/telnetd.service line 6

Quoted 5 lines
package/busybox/telnetd.service new file +5 -0
+Description=Telnetd Service
+After=network.target
+
+[Service]
+# busybox telnet doesn't support pidfile, so run in foreground

AFAIU Type=simple is anyway the preferred type for services without
specific systemd support, so I don't think this comment is very useful...

Quoted 1 line

Fair enough, I didn't know that was the specific guidance, so I'm okay with dropping that comment when applying.

From the systemd.service(5) man page:

It is generally recommended to use Type=simple for long-running services whenever possible, as it is the simplest and fastest option.

Regards,
Arnout

Quoted 13 lines

Thanks for letting me know,

Sam

Quoted 8 lines

Regardless:

Regards,
Arnout

Quoted 6 lines
Quoted 6 lines

package/busybox/telnetd.service line 11

Quoted 6 lines
package/busybox/telnetd.service new file +5 -0
+Type=simple
+ExecStart=/usr/sbin/telnetd -F
+
+[Install]
+WantedBy=multi-user.target

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#4 lore raw
In reply to Sam Voss via buildroot

Sam, All,

On 2021-08-26 16:02 -0500, Sam Voss via buildroot spake thusly:

Quoted 12 lines
---
 package/busybox/busybox.mk      |  7 +++++++
 package/busybox/telnetd.service | 11 +++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 package/busybox/telnetd.service
package/busybox/busybox.mk +0 -0
index cfc06b0d78..fb427faf1c 100644

package/busybox/busybox.mk define BUSYBOX_INSTALL_TARGET_CMDS · line 386

Quoted 9 lines
package/busybox/busybox.mk +6 -0
@@ -378,6 +378,13 @@ define BUSYBOX_INSTALL_TARGET_CMDS
 	$(BUSYBOX_INSTALL_MDEV_CONF)
 endef
 
+define BUSYBOX_INSTALL_INIT_SYSTEMD
+	if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y $(@D)/.config; then \
+		$(INSTALL) -D -m 0644 package/busybox/telnetd.service \
+			$(TARGET_DIR)/usr/lib/systemd/system/telnetd.service ; \
+	fi
+endef

I've changed that to be handled in a fashion similar to the two other init systems:

- added a macro right after BUSYBOX_INSTALL_TELNET_SCRIPT, and similarly named BUSYBOX_INSTALL_TELNET_SERVICE

- use thatr macro in the newly introduced BUSYBOX_INSTALL_INIT_SYSTEMD

- move BUSYBOX_INSTALL_INIT_SYSTEMD alphabetically in-between openrc and sysv.

Applied to next, thanks.

Regards,
Yann E. MORIN.

Quoted 27 lines
package/busybox/busybox.mk +0 -0
 # Install the sysvinit scripts, for the moment, but not those that already
 # have a corresponding one in openrc.
 define BUSYBOX_INSTALL_INIT_OPENRC
package/busybox/telnetd.service new file +11 -0
new file mode 100644
index 0000000000..3c1fa457b1
@@ -0,0 +1,11 @@
+[Unit]
+Description=Telnetd Service
+After=network.target
+
+[Service]
+# busybox telnet doesn't support pidfile, so run in foreground
+Type=simple
+ExecStart=/usr/sbin/telnetd -F
+
+[Install]
+WantedBy=multi-user.target
Signature · 6 lines
2.17.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot