Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v3] busybox: install S41inetd and inetd.conf if inetd is enabled in busybox.
Date: Thu, 14 Jun 2012 00:26:35 +0200	[thread overview]
Message-ID: <4FD9139B.2030604@mind.be> (raw)
In-Reply-To: <1339570179-29586-1-git-send-email-keguang.zhang@gmail.com>

On 06/13/12 08:49, Kelvin Cheung wrote:
> +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_TELNETD=y $(@D)/.config; then \
> +			if ! grep -q '^telnet' $(TARGET_DIR)/etc/inetd.conf; then \
> +				echo -e "telnet\tstream\ttcp\tnowait\troot\ttelnetd\ttelnetd -i">>  $(TARGET_DIR)/etc/inetd.conf; \
> +			fi; \
> +		else $(SED) '/^telnet/d' $(TARGET_DIR)/etc/inetd.conf; fi; \
> +		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\tftpd\tftpd -w /files/to/serve">>  $(TARGET_DIR)/etc/inetd.conf; \
> +			fi; \

  If busybox is rebuilt (and the inetd.conf wasn't modified), the #ftp line will
be added a second time.

> +		else $(SED) '/^ftp/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\troot\ttftpd\ttftpd -l -c /files/to/serve">>  $(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

  If netkitbase is selected and busybox happens to be (re)built afterwards,
inetd.conf would get removed...

> +endef

  I think all those conditions are just trying to be too smart.  Just copy
a default config file from package/busybox if inetd is selected, and leave
it alone if it is not selected.  Anyway, if the telnetd executable doesn't exist,
busybox will just close the connection immediately after accepting it.

  You could update inetd.conf in-place to add/remove the comment
marker.  E.g.

if grep -q CONFIG_TELNETD=y $(@D)/.config; then \
	$(SED) 's/^# NOT SELECTED #telnet/telnet/' $(TARGET_DIR)/etc/inetd.conf; \
else
	$(SED) 's/^telnet/# NOT SELECTED #telnet/' $(TARGET_DIR)/etc/inetd.conf; \
fi

  However, even that is problematic because it doesn't support a configuration
with a non-busybox telnetd.

  Bottom line: I prefer to simplify it to

+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; \
+	fi
+endef


  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

  reply	other threads:[~2012-06-13 22:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-13  6:49 [Buildroot] [PATCH v3] busybox: install S41inetd and inetd.conf if inetd is enabled in busybox Kelvin Cheung
2012-06-13 22:26 ` Arnout Vandecappelle [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-29  7:19 Kelvin Cheung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FD9139B.2030604@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox