Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] systemd: add network unit file
Date: Wed, 11 Jun 2014 22:34:47 +0200	[thread overview]
Message-ID: <20140611223447.1d5e7a65@free-electrons.com> (raw)
In-Reply-To: <1390874097-25597-1-git-send-email-vsergeev@kumunetworks.com>

Eric,

As our systemd person, could you have a look at this patch, and give
your comments and/or Acked-by/Reviewed-by as appropriate?

Thanks!

Thomas

On Mon, 27 Jan 2014 17:54:57 -0800, Ivan Sergeev wrote:
> Add and enable a systemd unit file to bring up or down network with ifup /
> ifdown, analogous to the skeleton/etc/init.d/S40network init script.
> 
> Signed-off-by: Ivan Sergeev <vsergeev@kumunetworks.com>
> ---
>  package/systemd/network.service | 21 +++++++++++++++++++++
>  package/systemd/systemd.mk      |  9 +++++++++
>  2 files changed, 30 insertions(+)
>  create mode 100644 package/systemd/network.service
> 
> diff --git a/package/systemd/network.service b/package/systemd/network.service
> new file mode 100644
> index 0000000..0d77bb8
> --- /dev/null
> +++ b/package/systemd/network.service
> @@ -0,0 +1,21 @@
> +[Unit]
> +Description=Network Connectivity
> +Wants=network.target
> +Before=network.target
> +
> +[Service]
> +Type=oneshot
> +RemainAfterExit=yes
> +
> +# lo is brought up earlier, which will cause the upcoming "ifup -a" to fail
> +# with exit code 1, due to an "ip: RTNETLINK answers: File exists" error during
> +# its "ip addr add ..." command, subsequently causing this unit to fail even
> +# though it is a benign error. Flushing the lo address with the command below
> +# before ifup prevents this failure.
> +ExecStart=/sbin/ip addr flush dev lo
> +
> +ExecStart=/sbin/ifup -a
> +ExecStop=/sbin/ifdown -a
> +
> +[Install]
> +WantedBy=multi-user.target
> diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk
> index a5dc8e5..a99c0da 100644
> --- a/package/systemd/systemd.mk
> +++ b/package/systemd/systemd.mk
> @@ -72,7 +72,16 @@ define SYSTEMD_INSTALL_TTY_HOOK
>  	ln -fs ../../../../usr/lib/systemd/system/serial-getty at .service $(TARGET_DIR)/etc/systemd/system/getty.target.wants/serial-getty@$(BR2_TARGET_GENERIC_GETTY_PORT).service
>  endef
>  
> +define SYSTEMD_INSTALL_NETWORK_HOOK
> +	$(INSTALL) -D -m 644 package/systemd/network.service \
> +		$(TARGET_DIR)/etc/systemd/system/network.service
> +	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
> +	ln -fs ../network.service \
> +		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/network.service
> +endef
> +
>  SYSTEMD_POST_INSTALL_TARGET_HOOKS += \
>  	SYSTEMD_INSTALL_TTY_HOOK \
> +	SYSTEMD_INSTALL_NETWORK_HOOK
>  
>  $(eval $(autotools-package))



-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  reply	other threads:[~2014-06-11 20:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-03  1:38 [Buildroot] [PATCH 1/1] skeleton: add systemd network.service unit Ivan Sergeev
2014-01-03 19:13 ` Thomas Petazzoni
2014-01-03 19:41   ` Ivan Sergeev
2014-01-28  1:54     ` [Buildroot] [PATCH 1/1] systemd: add network unit file Ivan Sergeev
2014-06-11 20:34       ` Thomas Petazzoni [this message]
2014-06-13 15:42         ` Eric Le Bihan
2014-06-13 15:44           ` Thomas Petazzoni
2014-01-28  7:13     ` [Buildroot] [PATCH 1/1] skeleton: add systemd network.service unit Arnout Vandecappelle
2014-01-28  8:25       ` Maxime Hadjinlian
2014-01-28  8:38         ` Arnout Vandecappelle
2014-01-28 13:20         ` Maxime Ripard
2014-01-28 17:20           ` Arnout Vandecappelle
2014-01-29  8:26             ` Maxime Ripard
2014-01-29  9:07               ` Maxime Hadjinlian
2014-01-29  9:09               ` Peter Korsgaard

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=20140611223447.1d5e7a65@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --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