busybox: improve support for telnetd
PATCH v3 1/1 busybox: improve support for telnetd
From: Alexey Brodkin <[email protected]>
If target has connection to the network it might be pretty useful to have telnet connection to it instead of serial console or even in addition to serial console.
This changes makes the busybox package automatically install an init script, and tune the securetty file to make telnetd work when CONFIG_FEATURE_TELNETD_STANDALONE is enabled in the Busybox configuration.
[Thomas:
- don't create a new Buildroot Config.in option, just test if CONFIG_FEATURE_TELNETD_STANDALONE is enabled or not in the Busybox configuration
- move the securetty tuning in busybox.mk instead of system.mk
- use start-stop-daemon in the init script, in order to properly implement the stop and restart actions
- misc other minor improvements in the init script.]
--- package/busybox/S50telnet | 36 ++++++++++++++++++++++++++++++++++++ package/busybox/busybox.mk | 21 +++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100755 package/busybox/S50telnet
package/busybox/S50telnet new file +36 -0
@@ -0,0 +1,36 @@ +#!/bin/sh +# +# Start telnet.... +# + +start() { + echo -n "Starting telnetd: " + start-stop-daemon -S -q -m -b -p /var/run/telnetd.pid \ + -x /usr/sbin/telnetd -- -F + [ $? = 0 ] && echo "OK" || echo "FAIL" +} + +stop() { + echo -n "Stopping telnetd: " + start-stop-daemon -K -q -p /var/run/telnetd.pid \ + -x /usr/sbin/telnetd + [ $? = 0 ] && echo "OK" || echo "FAIL" +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $?
package/busybox/busybox.mk +21 -0
@@ -168,6 +168,25 @@ endef BUSYBOX_DEPENDENCIES += linux-pam endif +# Telnet support +define BUSYBOX_INSTALL_TELNET_SCRIPT + if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y $(@D)/.config; then \ + $(INSTALL) -m 0755 -D package/busybox/S50telnet \ + $(TARGET_DIR)/etc/init.d/S50telnet ; \ + fi +endef + +define BUSYBOX_ADJUST_TELNET_SECURETTY + if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y $(@D)/.config; then \ + for i in `seq 0 3` ; do \ + grep -q "pts/$$i" $(TARGET_DIR)/etc/securetty || \ + echo "pts/$$i" >> $(TARGET_DIR)/etc/securetty ; \ + done ; \ + fi +endef + +BUSYBOX_POST_INSTALL_TARGET_HOOKS += BUSYBOX_ADJUST_TELNET_SECURETTY + # Enable "noclobber" in install.sh, to prevent BusyBox from overwriting any # full-blown versions of apps installed by other packages with sym/hard links. define BUSYBOX_NOCLOBBER_INSTALL
@@ -185,6 +204,7 @@ define BUSYBOX_KCONFIG_FIXUP_CMDS $(BUSYBOX_INTERNAL_SHADOW_PASSWORDS) $(BUSYBOX_SET_INIT) $(BUSYBOX_SET_WATCHDOG) + $(BUSYBOX_SET_STANDALONE_TELNETD) endef define BUSYBOX_CONFIGURE_CMDS
@@ -205,6 +225,7 @@ define BUSYBOX_INSTALL_INIT_SYSV $(BUSYBOX_INSTALL_MDEV_SCRIPT) $(BUSYBOX_INSTALL_LOGGING_SCRIPT) $(BUSYBOX_INSTALL_WATCHDOG_SCRIPT) + $(BUSYBOX_INSTALL_TELNET_SCRIPT) endef $(eval $(kconfig-package))
Signature · 1 line
2.4.5
PATCH v3 1/1 busybox: improve support for telnetd
Thomas, Alexey, All,
On 2015-07-12 02:20 +0200, Thomas Petazzoni spake thusly:
Quoted 5 lines
From: Alexey Brodkin <[email protected]>
If target has connection to the network it might be pretty useful to have telnet connection to it instead of serial console or even in addition to serial console.
[--SNIP--]
package/busybox/busybox.mk
Quoted 4 lines
package/busybox/busybox.mk +0
-0
[--SNIP--]
package/busybox/busybox.mk endef · line 183
Quoted 5 lines
package/busybox/busybox.mk +5
-0+define BUSYBOX_ADJUST_TELNET_SECURETTY + if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y $(@D)/.config; then \ + for i in `seq 0 3` ; do \ + grep -q "pts/$$i" $(TARGET_DIR)/etc/securetty || \ + echo "pts/$$i" >> $(TARGET_DIR)/etc/securetty ; \
Why don't we simply add those four in our securetty, directly in our skeleton?
Quoted 10 lines
package/busybox/busybox.mk +6
-0+ done ; \ + fi +endef + +BUSYBOX_POST_INSTALL_TARGET_HOOKS += BUSYBOX_ADJUST_TELNET_SECURETTY + # Enable "noclobber" in install.sh, to prevent BusyBox from overwriting any # full-blown versions of apps installed by other packages with sym/hard links. define BUSYBOX_NOCLOBBER_INSTALL
package/busybox/busybox.mk define BUSYBOX_KCONFIG_FIXUP_CMDS · line 207
Quoted 4 lines
package/busybox/busybox.mk +1
-0@@ -185,6 +204,7 @@ define BUSYBOX_KCONFIG_FIXUP_CMDS $(BUSYBOX_INTERNAL_SHADOW_PASSWORDS) $(BUSYBOX_SET_INIT) $(BUSYBOX_SET_WATCHDOG) + $(BUSYBOX_SET_STANDALONE_TELNETD)
BUSYBOX_SET_STANDALONE_TELNETD is no longer defined. ;-)
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 v3 1/1 busybox: improve support for telnetd
Quoted 14 lines · Yann E. MORIN
Thomas, Alexey, All,
On 2015-07-12 02:20 +0200, Thomas Petazzoni spake thusly:
Quoted 5 lines
From: Alexey Brodkin <[email protected]>
If target has connection to the network it might be pretty useful to have telnet connection to it instead of serial console or even in addition to serial console.
[--SNIP--]
package/busybox/busybox.mk
Quoted 4 lines
package/busybox/busybox.mk +0
-0[--SNIP--]
Quoted 8 lines
package/busybox/busybox.mk endef · line 183
Quoted 5 lines
package/busybox/busybox.mk +5
-0+define BUSYBOX_ADJUST_TELNET_SECURETTY + if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y $(@D)/.config; then \ + for i in `seq 0 3` ; do \ + grep -q "pts/$$i" $(TARGET_DIR)/etc/securetty || \ + echo "pts/$$i" >> $(TARGET_DIR)/etc/securetty ; \Why don't we simply add those four in our securetty, directly in our skeleton?
That renders securetty even more useless than it already is.
Why don't we just remove CONFIG_FEATURE_SECURETTY from our default busybox
config and get rid of all the securetty hacks?
Regards,
Arnout
[snip]
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: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF