Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] busybox: install S41inetd and inetd.conf if inetd applet is enabled
@ 2011-12-07 10:19 Kelvin Cheung
  2011-12-09  8:06 ` Kelvin Cheung
  0 siblings, 1 reply; 5+ messages in thread
From: Kelvin Cheung @ 2011-12-07 10:19 UTC (permalink / raw)
  To: buildroot

Install S41inetd and inetd.conf if inetd is enabled in busybox.
Add ftpd to /etc/inetd.conf if if inetd and ftpd are enabled.
Add telnetd to /etc/inetd.conf if if inetd and telnetd are enabled.
Add tftpd to /etc/inetd.conf if if inetd and tftpd are enabled.

Signed-off-by: Kelvin Cheung <keguang.zhang@gmail.com>
---
 package/busybox/S41inetd   |   27 +++++++++++++++++++++++++++
 package/busybox/busybox.mk |   32 ++++++++++++++++++++++++++++++++
 package/busybox/inetd.conf |    2 ++
 3 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100644 package/busybox/S41inetd
 create mode 100644 package/busybox/inetd.conf

diff --git a/package/busybox/S41inetd b/package/busybox/S41inetd
new file mode 100644
index 0000000..cc288dd
--- /dev/null
+++ b/package/busybox/S41inetd
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Starts the inetd daemon.
+#
+
+NAME=inetd
+DAEMON=/usr/sbin/$NAME
+
+case "$1" in
+  start)
+	echo -n "Starting $NAME: "
+	start-stop-daemon -S -q -x $DAEMON && echo "OK" || echo "Failed"
+	;;
+  stop)
+	echo -n "Stopping $NAME: "
+	start-stop-daemon -K -q -n $NAME && echo "OK" || echo "Failed"
+	;;
+  restart|reload)
+	$0 stop
+	$0 start
+	;;
+  *)
+	echo $"Usage: $0 {start|stop|restart}"
+	exit 1
+esac
+
+exit $?
diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
index d18b6d0..1c0d473 100644
--- a/package/busybox/busybox.mk
+++ b/package/busybox/busybox.mk
@@ -137,6 +137,36 @@ define BUSYBOX_INSTALL_LOGGING_SCRIPT
 	else rm -f $(TARGET_DIR)/etc/init.d/S01logging; fi
 endef
 
+define BUSYBOX_INSTALL_INETD_SCRIPT
+	if grep -q CONFIG_INETD=y $(@D)/.config; then \
+		[ -f $(TARGET_DIR)/etc/init.d/S41inetd ] || \
+			$(INSTALL) -m 0755 -D package/busybox/S41inetd \
+				$(TARGET_DIR)/etc/init.d/S41inetd; \
+	else rm -f $(TARGET_DIR)/etc/init.d/S41inetd; fi
+endef
+define BUSYBOX_INSTALL_INETD_CONF
+	if grep -q CONFIG_INETD=y $(@D)/.config; then \
+		[ -f $(TARGET_DIR)/etc/inetd.conf ] || \
+			install -D -m 0644 package/busybox/inetd.conf \
+				$(TARGET_DIR)/etc/inetd.conf; \
+		if grep -q CONFIG_FTPD=y $(@D)/.config; then \
+			if ! grep -q '^ftp' $(TARGET_DIR)/etc/inetd.conf; then \
+				echo -e "ftp\tstream\ttcp\tnowait\troot\t/usr/sbin/ftpd\tftpd" >> $(TARGET_DIR)/etc/inetd.conf; \
+			fi; \
+		else $(SED) '/^ftp/d' $(TARGET_DIR)/etc/inetd.conf; fi; \
+		if grep -q CONFIG_TELNETD=y $(@D)/.config; then \
+			if ! grep -q '^telnet' $(TARGET_DIR)/etc/inetd.conf; then \
+				echo -e "telnet\tstream\ttcp\tnowait\troot\t/usr/sbin/telnetd\ttelnetd -i" >> $(TARGET_DIR)/etc/inetd.conf; \
+			fi; \
+		else $(SED) '/^telnet/d' $(TARGET_DIR)/etc/inetd.conf; fi; \
+		if grep -q CONFIG_TFTPD=y $(@D)/.config; then \
+			if ! grep -q '^tftp' $(TARGET_DIR)/etc/inetd.conf; then \
+				echo -e "tftp\tdgram\tudp\tnowait\tnobody\t/usr/bin/tftpd\ttftpd" >> $(TARGET_DIR)/etc/inetd.conf; \
+			fi; \
+		else $(SED) '/^tftp/d' $(TARGET_DIR)/etc/inetd.conf; fi \
+	else rm -f $(TARGET_DIR)/etc/inetd.conf; fi
+endef
+
 # We do this here to avoid busting a modified .config in configure
 BUSYBOX_POST_EXTRACT_HOOKS += BUSYBOX_COPY_CONFIG
 
@@ -167,6 +197,8 @@ define BUSYBOX_INSTALL_TARGET_CMDS
 	$(BUSYBOX_INSTALL_MDEV_SCRIPT)
 	$(BUSYBOX_INSTALL_MDEV_CONF)
 	$(BUSYBOX_INSTALL_LOGGING_SCRIPT)
+	$(BUSYBOX_INSTALL_INETD_SCRIPT)
+	$(BUSYBOX_INSTALL_INETD_CONF)
 endef
 
 define BUSYBOX_UNINSTALL_TARGET_CMDS
diff --git a/package/busybox/inetd.conf b/package/busybox/inetd.conf
new file mode 100644
index 0000000..36cebd5
--- /dev/null
+++ b/package/busybox/inetd.conf
@@ -0,0 +1,2 @@
+# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
+#
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] busybox: install S41inetd and inetd.conf if inetd applet is enabled
  2011-12-07 10:19 Kelvin Cheung
@ 2011-12-09  8:06 ` Kelvin Cheung
  0 siblings, 0 replies; 5+ messages in thread
From: Kelvin Cheung @ 2011-12-09  8:06 UTC (permalink / raw)
  To: buildroot

bump

2011/12/7 Kelvin Cheung <keguang.zhang@gmail.com>

> Install S41inetd and inetd.conf if inetd is enabled in busybox.
> Add ftpd to /etc/inetd.conf if if inetd and ftpd are enabled.
> Add telnetd to /etc/inetd.conf if if inetd and telnetd are enabled.
> Add tftpd to /etc/inetd.conf if if inetd and tftpd are enabled.
>
> Signed-off-by: Kelvin Cheung <keguang.zhang@gmail.com>
> ---
>  package/busybox/S41inetd   |   27 +++++++++++++++++++++++++++
>  package/busybox/busybox.mk |   32 ++++++++++++++++++++++++++++++++
>  package/busybox/inetd.conf |    2 ++
>  3 files changed, 61 insertions(+), 0 deletions(-)
>  create mode 100644 package/busybox/S41inetd
>  create mode 100644 package/busybox/inetd.conf
>
> diff --git a/package/busybox/S41inetd b/package/busybox/S41inetd
> new file mode 100644
> index 0000000..cc288dd
> --- /dev/null
> +++ b/package/busybox/S41inetd
> @@ -0,0 +1,27 @@
> +#!/bin/sh
> +#
> +# Starts the inetd daemon.
> +#
> +
> +NAME=inetd
> +DAEMON=/usr/sbin/$NAME
> +
> +case "$1" in
> +  start)
> +       echo -n "Starting $NAME: "
> +       start-stop-daemon -S -q -x $DAEMON && echo "OK" || echo "Failed"
> +       ;;
> +  stop)
> +       echo -n "Stopping $NAME: "
> +       start-stop-daemon -K -q -n $NAME && echo "OK" || echo "Failed"
> +       ;;
> +  restart|reload)
> +       $0 stop
> +       $0 start
> +       ;;
> +  *)
> +       echo $"Usage: $0 {start|stop|restart}"
> +       exit 1
> +esac
> +
> +exit $?
> diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
> index d18b6d0..1c0d473 100644
> --- a/package/busybox/busybox.mk
> +++ b/package/busybox/busybox.mk
> @@ -137,6 +137,36 @@ define BUSYBOX_INSTALL_LOGGING_SCRIPT
>        else rm -f $(TARGET_DIR)/etc/init.d/S01logging; fi
>  endef
>
> +define BUSYBOX_INSTALL_INETD_SCRIPT
> +       if grep -q CONFIG_INETD=y $(@D)/.config; then \
> +               [ -f $(TARGET_DIR)/etc/init.d/S41inetd ] || \
> +                       $(INSTALL) -m 0755 -D package/busybox/S41inetd \
> +                               $(TARGET_DIR)/etc/init.d/S41inetd; \
> +       else rm -f $(TARGET_DIR)/etc/init.d/S41inetd; fi
> +endef
> +define BUSYBOX_INSTALL_INETD_CONF
> +       if grep -q CONFIG_INETD=y $(@D)/.config; then \
> +               [ -f $(TARGET_DIR)/etc/inetd.conf ] || \
> +                       install -D -m 0644 package/busybox/inetd.conf \
> +                               $(TARGET_DIR)/etc/inetd.conf; \
> +               if grep -q CONFIG_FTPD=y $(@D)/.config; then \
> +                       if ! grep -q '^ftp' $(TARGET_DIR)/etc/inetd.conf;
> then \
> +                               echo -e
> "ftp\tstream\ttcp\tnowait\troot\t/usr/sbin/ftpd\tftpd" >>
> $(TARGET_DIR)/etc/inetd.conf; \
> +                       fi; \
> +               else $(SED) '/^ftp/d' $(TARGET_DIR)/etc/inetd.conf; fi; \
> +               if grep -q CONFIG_TELNETD=y $(@D)/.config; then \
> +                       if ! grep -q '^telnet'
> $(TARGET_DIR)/etc/inetd.conf; then \
> +                               echo -e
> "telnet\tstream\ttcp\tnowait\troot\t/usr/sbin/telnetd\ttelnetd -i" >>
> $(TARGET_DIR)/etc/inetd.conf; \
> +                       fi; \
> +               else $(SED) '/^telnet/d' $(TARGET_DIR)/etc/inetd.conf; fi;
> \
> +               if grep -q CONFIG_TFTPD=y $(@D)/.config; then \
> +                       if ! grep -q '^tftp' $(TARGET_DIR)/etc/inetd.conf;
> then \
> +                               echo -e
> "tftp\tdgram\tudp\tnowait\tnobody\t/usr/bin/tftpd\ttftpd" >>
> $(TARGET_DIR)/etc/inetd.conf; \
> +                       fi; \
> +               else $(SED) '/^tftp/d' $(TARGET_DIR)/etc/inetd.conf; fi \
> +       else rm -f $(TARGET_DIR)/etc/inetd.conf; fi
> +endef
> +
>  # We do this here to avoid busting a modified .config in configure
>  BUSYBOX_POST_EXTRACT_HOOKS += BUSYBOX_COPY_CONFIG
>
> @@ -167,6 +197,8 @@ define BUSYBOX_INSTALL_TARGET_CMDS
>        $(BUSYBOX_INSTALL_MDEV_SCRIPT)
>        $(BUSYBOX_INSTALL_MDEV_CONF)
>        $(BUSYBOX_INSTALL_LOGGING_SCRIPT)
> +       $(BUSYBOX_INSTALL_INETD_SCRIPT)
> +       $(BUSYBOX_INSTALL_INETD_CONF)
>  endef
>
>  define BUSYBOX_UNINSTALL_TARGET_CMDS
> diff --git a/package/busybox/inetd.conf b/package/busybox/inetd.conf
> new file mode 100644
> index 0000000..36cebd5
> --- /dev/null
> +++ b/package/busybox/inetd.conf
> @@ -0,0 +1,2 @@
> +# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
> +#
> --
> 1.7.1
>
>


-- 
Best Regards!
Kelvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20111209/62b29b7c/attachment-0001.html>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] busybox: install S41inetd and inetd.conf if inetd applet is enabled
@ 2012-01-11  8:54 Kelvin Cheung
  2012-01-12  9:47 ` Kelvin Cheung
  2012-01-20 23:12 ` Arnout Vandecappelle
  0 siblings, 2 replies; 5+ messages in thread
From: Kelvin Cheung @ 2012-01-11  8:54 UTC (permalink / raw)
  To: buildroot

Install S41inetd and inetd.conf if inetd is enabled in busybox.
Add ftpd to /etc/inetd.conf if if inetd and ftpd are enabled.
Add telnetd to /etc/inetd.conf if if inetd and telnetd are enabled.
Add tftpd to /etc/inetd.conf if if inetd and tftpd are enabled.

Signed-off-by: Kelvin Cheung <keguang.zhang@gmail.com>
---
 package/busybox/S41inetd   |   27 +++++++++++++++++++++++++++
 package/busybox/busybox.mk |   32 ++++++++++++++++++++++++++++++++
 package/busybox/inetd.conf |    2 ++
 3 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100644 package/busybox/S41inetd
 create mode 100644 package/busybox/inetd.conf

diff --git a/package/busybox/S41inetd b/package/busybox/S41inetd
new file mode 100644
index 0000000..cc288dd
--- /dev/null
+++ b/package/busybox/S41inetd
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Starts the inetd daemon.
+#
+
+NAME=inetd
+DAEMON=/usr/sbin/$NAME
+
+case "$1" in
+  start)
+	echo -n "Starting $NAME: "
+	start-stop-daemon -S -q -x $DAEMON && echo "OK" || echo "Failed"
+	;;
+  stop)
+	echo -n "Stopping $NAME: "
+	start-stop-daemon -K -q -n $NAME && echo "OK" || echo "Failed"
+	;;
+  restart|reload)
+	$0 stop
+	$0 start
+	;;
+  *)
+	echo $"Usage: $0 {start|stop|restart}"
+	exit 1
+esac
+
+exit $?
diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
index d18b6d0..1c0d473 100644
--- a/package/busybox/busybox.mk
+++ b/package/busybox/busybox.mk
@@ -137,6 +137,36 @@ define BUSYBOX_INSTALL_LOGGING_SCRIPT
 	else rm -f $(TARGET_DIR)/etc/init.d/S01logging; fi
 endef
 
+define BUSYBOX_INSTALL_INETD_SCRIPT
+	if grep -q CONFIG_INETD=y $(@D)/.config; then \
+		[ -f $(TARGET_DIR)/etc/init.d/S41inetd ] || \
+			$(INSTALL) -m 0755 -D package/busybox/S41inetd \
+				$(TARGET_DIR)/etc/init.d/S41inetd; \
+	else rm -f $(TARGET_DIR)/etc/init.d/S41inetd; fi
+endef
+define BUSYBOX_INSTALL_INETD_CONF
+	if grep -q CONFIG_INETD=y $(@D)/.config; then \
+		[ -f $(TARGET_DIR)/etc/inetd.conf ] || \
+			install -D -m 0644 package/busybox/inetd.conf \
+				$(TARGET_DIR)/etc/inetd.conf; \
+		if grep -q CONFIG_FTPD=y $(@D)/.config; then \
+			if ! grep -q '^ftp' $(TARGET_DIR)/etc/inetd.conf; then \
+				echo -e "ftp\tstream\ttcp\tnowait\troot\t/usr/sbin/ftpd\tftpd" >> $(TARGET_DIR)/etc/inetd.conf; \
+			fi; \
+		else $(SED) '/^ftp/d' $(TARGET_DIR)/etc/inetd.conf; fi; \
+		if grep -q CONFIG_TELNETD=y $(@D)/.config; then \
+			if ! grep -q '^telnet' $(TARGET_DIR)/etc/inetd.conf; then \
+				echo -e "telnet\tstream\ttcp\tnowait\troot\t/usr/sbin/telnetd\ttelnetd -i" >> $(TARGET_DIR)/etc/inetd.conf; \
+			fi; \
+		else $(SED) '/^telnet/d' $(TARGET_DIR)/etc/inetd.conf; fi; \
+		if grep -q CONFIG_TFTPD=y $(@D)/.config; then \
+			if ! grep -q '^tftp' $(TARGET_DIR)/etc/inetd.conf; then \
+				echo -e "tftp\tdgram\tudp\tnowait\tnobody\t/usr/bin/tftpd\ttftpd" >> $(TARGET_DIR)/etc/inetd.conf; \
+			fi; \
+		else $(SED) '/^tftp/d' $(TARGET_DIR)/etc/inetd.conf; fi \
+	else rm -f $(TARGET_DIR)/etc/inetd.conf; fi
+endef
+
 # We do this here to avoid busting a modified .config in configure
 BUSYBOX_POST_EXTRACT_HOOKS += BUSYBOX_COPY_CONFIG
 
@@ -167,6 +197,8 @@ define BUSYBOX_INSTALL_TARGET_CMDS
 	$(BUSYBOX_INSTALL_MDEV_SCRIPT)
 	$(BUSYBOX_INSTALL_MDEV_CONF)
 	$(BUSYBOX_INSTALL_LOGGING_SCRIPT)
+	$(BUSYBOX_INSTALL_INETD_SCRIPT)
+	$(BUSYBOX_INSTALL_INETD_CONF)
 endef
 
 define BUSYBOX_UNINSTALL_TARGET_CMDS
diff --git a/package/busybox/inetd.conf b/package/busybox/inetd.conf
new file mode 100644
index 0000000..36cebd5
--- /dev/null
+++ b/package/busybox/inetd.conf
@@ -0,0 +1,2 @@
+# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
+#
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] busybox: install S41inetd and inetd.conf if inetd applet is enabled
  2012-01-11  8:54 [Buildroot] [PATCH] busybox: install S41inetd and inetd.conf if inetd applet is enabled Kelvin Cheung
@ 2012-01-12  9:47 ` Kelvin Cheung
  2012-01-20 23:12 ` Arnout Vandecappelle
  1 sibling, 0 replies; 5+ messages in thread
From: Kelvin Cheung @ 2012-01-12  9:47 UTC (permalink / raw)
  To: buildroot

Hi Peter,

What about this patch?

2012/1/11 Kelvin Cheung <keguang.zhang@gmail.com>

> Install S41inetd and inetd.conf if inetd is enabled in busybox.
> Add ftpd to /etc/inetd.conf if if inetd and ftpd are enabled.
> Add telnetd to /etc/inetd.conf if if inetd and telnetd are enabled.
> Add tftpd to /etc/inetd.conf if if inetd and tftpd are enabled.
>
> Signed-off-by: Kelvin Cheung <keguang.zhang@gmail.com>
> ---
>  package/busybox/S41inetd   |   27 +++++++++++++++++++++++++++
>  package/busybox/busybox.mk |   32 ++++++++++++++++++++++++++++++++
>  package/busybox/inetd.conf |    2 ++
>  3 files changed, 61 insertions(+), 0 deletions(-)
>  create mode 100644 package/busybox/S41inetd
>  create mode 100644 package/busybox/inetd.conf
>
> diff --git a/package/busybox/S41inetd b/package/busybox/S41inetd
> new file mode 100644
> index 0000000..cc288dd
> --- /dev/null
> +++ b/package/busybox/S41inetd
> @@ -0,0 +1,27 @@
> +#!/bin/sh
> +#
> +# Starts the inetd daemon.
> +#
> +
> +NAME=inetd
> +DAEMON=/usr/sbin/$NAME
> +
> +case "$1" in
> +  start)
> +       echo -n "Starting $NAME: "
> +       start-stop-daemon -S -q -x $DAEMON && echo "OK" || echo "Failed"
> +       ;;
> +  stop)
> +       echo -n "Stopping $NAME: "
> +       start-stop-daemon -K -q -n $NAME && echo "OK" || echo "Failed"
> +       ;;
> +  restart|reload)
> +       $0 stop
> +       $0 start
> +       ;;
> +  *)
> +       echo $"Usage: $0 {start|stop|restart}"
> +       exit 1
> +esac
> +
> +exit $?
> diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
> index d18b6d0..1c0d473 100644
> --- a/package/busybox/busybox.mk
> +++ b/package/busybox/busybox.mk
> @@ -137,6 +137,36 @@ define BUSYBOX_INSTALL_LOGGING_SCRIPT
>        else rm -f $(TARGET_DIR)/etc/init.d/S01logging; fi
>  endef
>
> +define BUSYBOX_INSTALL_INETD_SCRIPT
> +       if grep -q CONFIG_INETD=y $(@D)/.config; then \
> +               [ -f $(TARGET_DIR)/etc/init.d/S41inetd ] || \
> +                       $(INSTALL) -m 0755 -D package/busybox/S41inetd \
> +                               $(TARGET_DIR)/etc/init.d/S41inetd; \
> +       else rm -f $(TARGET_DIR)/etc/init.d/S41inetd; fi
> +endef
> +define BUSYBOX_INSTALL_INETD_CONF
> +       if grep -q CONFIG_INETD=y $(@D)/.config; then \
> +               [ -f $(TARGET_DIR)/etc/inetd.conf ] || \
> +                       install -D -m 0644 package/busybox/inetd.conf \
> +                               $(TARGET_DIR)/etc/inetd.conf; \
> +               if grep -q CONFIG_FTPD=y $(@D)/.config; then \
> +                       if ! grep -q '^ftp' $(TARGET_DIR)/etc/inetd.conf;
> then \
> +                               echo -e
> "ftp\tstream\ttcp\tnowait\troot\t/usr/sbin/ftpd\tftpd" >>
> $(TARGET_DIR)/etc/inetd.conf; \
> +                       fi; \
> +               else $(SED) '/^ftp/d' $(TARGET_DIR)/etc/inetd.conf; fi; \
> +               if grep -q CONFIG_TELNETD=y $(@D)/.config; then \
> +                       if ! grep -q '^telnet'
> $(TARGET_DIR)/etc/inetd.conf; then \
> +                               echo -e
> "telnet\tstream\ttcp\tnowait\troot\t/usr/sbin/telnetd\ttelnetd -i" >>
> $(TARGET_DIR)/etc/inetd.conf; \
> +                       fi; \
> +               else $(SED) '/^telnet/d' $(TARGET_DIR)/etc/inetd.conf; fi;
> \
> +               if grep -q CONFIG_TFTPD=y $(@D)/.config; then \
> +                       if ! grep -q '^tftp' $(TARGET_DIR)/etc/inetd.conf;
> then \
> +                               echo -e
> "tftp\tdgram\tudp\tnowait\tnobody\t/usr/bin/tftpd\ttftpd" >>
> $(TARGET_DIR)/etc/inetd.conf; \
> +                       fi; \
> +               else $(SED) '/^tftp/d' $(TARGET_DIR)/etc/inetd.conf; fi \
> +       else rm -f $(TARGET_DIR)/etc/inetd.conf; fi
> +endef
> +
>  # We do this here to avoid busting a modified .config in configure
>  BUSYBOX_POST_EXTRACT_HOOKS += BUSYBOX_COPY_CONFIG
>
> @@ -167,6 +197,8 @@ define BUSYBOX_INSTALL_TARGET_CMDS
>        $(BUSYBOX_INSTALL_MDEV_SCRIPT)
>        $(BUSYBOX_INSTALL_MDEV_CONF)
>        $(BUSYBOX_INSTALL_LOGGING_SCRIPT)
> +       $(BUSYBOX_INSTALL_INETD_SCRIPT)
> +       $(BUSYBOX_INSTALL_INETD_CONF)
>  endef
>
>  define BUSYBOX_UNINSTALL_TARGET_CMDS
> diff --git a/package/busybox/inetd.conf b/package/busybox/inetd.conf
> new file mode 100644
> index 0000000..36cebd5
> --- /dev/null
> +++ b/package/busybox/inetd.conf
> @@ -0,0 +1,2 @@
> +# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
> +#
> --
> 1.7.1
>
>


-- 
Best Regards!
Kelvin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20120112/6acc7645/attachment-0001.html>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH] busybox: install S41inetd and inetd.conf if inetd applet is enabled
  2012-01-11  8:54 [Buildroot] [PATCH] busybox: install S41inetd and inetd.conf if inetd applet is enabled Kelvin Cheung
  2012-01-12  9:47 ` Kelvin Cheung
@ 2012-01-20 23:12 ` Arnout Vandecappelle
  1 sibling, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle @ 2012-01-20 23:12 UTC (permalink / raw)
  To: buildroot

On Wednesday 11 January 2012 09:54:23 Kelvin Cheung wrote:
> Install S41inetd and inetd.conf if inetd is enabled in busybox.
> Add ftpd to /etc/inetd.conf if if inetd and ftpd are enabled.
> Add telnetd to /etc/inetd.conf if if inetd and telnetd are enabled.
> Add tftpd to /etc/inetd.conf if if inetd and tftpd are enabled.
> 
> Signed-off-by: Kelvin Cheung <keguang.zhang@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 Not tested by me, and also not many real comments.

> ---
>  package/busybox/S41inetd   |   27 +++++++++++++++++++++++++++
>  package/busybox/busybox.mk |   32 ++++++++++++++++++++++++++++++++
>  package/busybox/inetd.conf |    2 ++
>  3 files changed, 61 insertions(+), 0 deletions(-)
>  create mode 100644 package/busybox/S41inetd
>  create mode 100644 package/busybox/inetd.conf
> 
> diff --git a/package/busybox/S41inetd b/package/busybox/S41inetd
> new file mode 100644
> index 0000000..cc288dd
> --- /dev/null
> +++ b/package/busybox/S41inetd
> @@ -0,0 +1,27 @@
> +#!/bin/sh
> +#
> +# Starts the inetd daemon.
> +#
> +
> +NAME=inetd
> +DAEMON=/usr/sbin/$NAME
> +
> +case "$1" in
> +  start)
> +	echo -n "Starting $NAME: "
> +	start-stop-daemon -S -q -x $DAEMON && echo "OK" || echo "Failed"
 I'd create a PID file too, cfr. S01logging.  But it's not required.

> +	;;
> +  stop)
> +	echo -n "Stopping $NAME: "
> +	start-stop-daemon -K -q -n $NAME && echo "OK" || echo "Failed"
 Same here.

> +	;;
> +  restart|reload)
> +	$0 stop
> +	$0 start
> +	;;
> +  *)
> +	echo $"Usage: $0 {start|stop|restart}"
> +	exit 1
> +esac
> +
> +exit $?
> diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk
> index d18b6d0..1c0d473 100644
> --- a/package/busybox/busybox.mk
> +++ b/package/busybox/busybox.mk
> @@ -137,6 +137,36 @@ define BUSYBOX_INSTALL_LOGGING_SCRIPT
>  	else rm -f $(TARGET_DIR)/etc/init.d/S01logging; fi
>  endef
>  
> +define BUSYBOX_INSTALL_INETD_SCRIPT
> +	if grep -q CONFIG_INETD=y $(@D)/.config; then \
> +		[ -f $(TARGET_DIR)/etc/init.d/S41inetd ] || \
> +			$(INSTALL) -m 0755 -D package/busybox/S41inetd \
> +				$(TARGET_DIR)/etc/init.d/S41inetd; \
> +	else rm -f $(TARGET_DIR)/etc/init.d/S41inetd; fi
 Unfortunately, if the user has a different start script, chances are
that it will also have a different number.  Not sure how to fix that,
though, unless we re-implement something like Debian's update-rc.d.

 Also, two things here would be nice to generalize:
- Checking a sub-.config option, which is useful in a large number of cases.
- Installing an init script.
But those are not for this patch.

> +endef
> +define BUSYBOX_INSTALL_INETD_CONF
> +	if grep -q CONFIG_INETD=y $(@D)/.config; then \
> +		[ -f $(TARGET_DIR)/etc/inetd.conf ] || \
> +			install -D -m 0644 package/busybox/inetd.conf \
> +				$(TARGET_DIR)/etc/inetd.conf; \
> +		if grep -q CONFIG_FTPD=y $(@D)/.config; then \
> +			if ! grep -q '^ftp' $(TARGET_DIR)/etc/inetd.conf; then \
> +				echo -e "ftp\tstream\ttcp\tnowait\troot\t/usr/sbin/ftpd\tftpd" >> $(TARGET_DIR)/etc/inetd.conf; \
> +			fi; \
> +		else $(SED) '/^ftp/d' $(TARGET_DIR)/etc/inetd.conf; fi; \
> +		if grep -q CONFIG_TELNETD=y $(@D)/.config; then \
> +			if ! grep -q '^telnet' $(TARGET_DIR)/etc/inetd.conf; then \
> +				echo -e "telnet\tstream\ttcp\tnowait\troot\t/usr/sbin/telnetd\ttelnetd -i" >> $(TARGET_DIR)/etc/inetd.conf; \
> +			fi; \
> +		else $(SED) '/^telnet/d' $(TARGET_DIR)/etc/inetd.conf; fi; \
> +		if grep -q CONFIG_TFTPD=y $(@D)/.config; then \
> +			if ! grep -q '^tftp' $(TARGET_DIR)/etc/inetd.conf; then \
> +				echo -e "tftp\tdgram\tudp\tnowait\tnobody\t/usr/bin/tftpd\ttftpd" >> $(TARGET_DIR)/etc/inetd.conf; \
> +			fi; \
> +		else $(SED) '/^tftp/d' $(TARGET_DIR)/etc/inetd.conf; fi \
> +	else rm -f $(TARGET_DIR)/etc/inetd.conf; fi
> +endef
> +
>  # We do this here to avoid busting a modified .config in configure
>  BUSYBOX_POST_EXTRACT_HOOKS += BUSYBOX_COPY_CONFIG
>  
> @@ -167,6 +197,8 @@ define BUSYBOX_INSTALL_TARGET_CMDS
>  	$(BUSYBOX_INSTALL_MDEV_SCRIPT)
>  	$(BUSYBOX_INSTALL_MDEV_CONF)
>  	$(BUSYBOX_INSTALL_LOGGING_SCRIPT)
> +	$(BUSYBOX_INSTALL_INETD_SCRIPT)
> +	$(BUSYBOX_INSTALL_INETD_CONF)
>  endef
>  
>  define BUSYBOX_UNINSTALL_TARGET_CMDS
 Uninstall of S41inetd and inetd.conf is missing.

> diff --git a/package/busybox/inetd.conf b/package/busybox/inetd.conf
> new file mode 100644
> index 0000000..36cebd5
> --- /dev/null
> +++ b/package/busybox/inetd.conf
> @@ -0,0 +1,2 @@
> +# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
> +#
> 

 Nice patch!

 Regards,
 Arnout

-- 
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
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:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-20 23:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11  8:54 [Buildroot] [PATCH] busybox: install S41inetd and inetd.conf if inetd applet is enabled Kelvin Cheung
2012-01-12  9:47 ` Kelvin Cheung
2012-01-20 23:12 ` Arnout Vandecappelle
  -- strict thread matches above, loose matches on Subject: below --
2011-12-07 10:19 Kelvin Cheung
2011-12-09  8:06 ` Kelvin Cheung

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox