Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] skeleton: add systemd network.service unit
@ 2014-01-03  1:38 Ivan Sergeev
  2014-01-03 19:13 ` Thomas Petazzoni
  0 siblings, 1 reply; 15+ messages in thread
From: Ivan Sergeev @ 2014-01-03  1:38 UTC (permalink / raw)
  To: buildroot

Add and enable a systemd unit file to bring up / down network with ifup /
ifdown, analogous to the skeleton/etc/init.d/S40network init script.

Signed-off-by: Ivan Sergeev <vsergeev@kumunetworks.com>
---
 .../system/multi-user.target.wants/network.service  |  1 +
 system/skeleton/etc/systemd/system/network.service  | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 120000 system/skeleton/etc/systemd/system/multi-user.target.wants/network.service
 create mode 100644 system/skeleton/etc/systemd/system/network.service

diff --git a/system/skeleton/etc/systemd/system/multi-user.target.wants/network.service b/system/skeleton/etc/systemd/system/multi-user.target.wants/network.service
new file mode 120000
index 0000000..d3558f9
--- /dev/null
+++ b/system/skeleton/etc/systemd/system/multi-user.target.wants/network.service
@@ -0,0 +1 @@
+../network.service
\ No newline at end of file
diff --git a/system/skeleton/etc/systemd/system/network.service b/system/skeleton/etc/systemd/system/network.service
new file mode 100644
index 0000000..0d77bb8
--- /dev/null
+++ b/system/skeleton/etc/systemd/system/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
-- 
1.8.4.2

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

end of thread, other threads:[~2014-06-13 15:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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