From patchwork Fri Jan 3 01:38:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Sergeev X-Patchwork-Id: 306386 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id B85D52C009C for ; Fri, 3 Jan 2014 12:40:30 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 028EE89D2D; Fri, 3 Jan 2014 01:40:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aQRLB34WsCVp; Fri, 3 Jan 2014 01:40:29 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id E803B896C1; Fri, 3 Jan 2014 01:40:28 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id DC2C91CE8A3 for ; Fri, 3 Jan 2014 01:40:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CCE438A471 for ; Fri, 3 Jan 2014 01:40:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sDFOlyBeocFf for ; Fri, 3 Jan 2014 01:40:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pb0-f43.google.com (mail-pb0-f43.google.com [209.85.160.43]) by whitealder.osuosl.org (Postfix) with ESMTPS id 1907C89751 for ; Fri, 3 Jan 2014 01:40:27 +0000 (UTC) Received: by mail-pb0-f43.google.com with SMTP id rq2so15085103pbb.30 for ; Thu, 02 Jan 2014 17:40:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0GO47kS6bNu5DO4ChlA3IXqxa+B4yrPlnvi5Isc/prA=; b=XuwgBy0DjX2HE+VkMkMA0ZdVT9CITN2ZOxPqwJqnI7JRAVsVUL1fFg29b1bPoc9tQo TIEraY8jPq3Agnh/aB2bVXQJN6zJ6ROrY1FhsmCfVDogv18ptvzXp5V9xXKznPqpD/W/ 0JJi/orrBelraFT2PCjXomLazLOjGatEckOJ+pPJ3l9BQ/K5qazpIeptuxaplYmTF322 y/I92rRqAOS+OX8huy25oFnPc/0MDORbcuj3CTB8wwwvBEdo3pVDySQaucRB4ENU6NjT KKQifWOhf/6Sx3iXq3lRCd0U7lgphyFd1dlq+LPnmOe70oPOUwVLNnlj6Zxg2nkrpfr6 fezw== X-Gm-Message-State: ALoCoQkdQ29NqnDjdq90HzaZ/DlqvjA7IR2hjGgpKT9JnX0l/amywVluGVsJ2Fmuiilzh+UtqJO6 X-Received: by 10.66.162.136 with SMTP id ya8mr90849525pab.110.1388713226745; Thu, 02 Jan 2014 17:40:26 -0800 (PST) Received: from vsergeev-arch.kumu.lan. (23-24-194-1-static.hfc.comcastbusiness.net. [23.24.194.1]) by mx.google.com with ESMTPSA id ic7sm104772817pbc.29.2014.01.02.17.40.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Jan 2014 17:40:26 -0800 (PST) From: Ivan Sergeev To: buildroot@busybox.net Date: Thu, 2 Jan 2014 17:38:32 -0800 Message-Id: <1388713112-4686-1-git-send-email-vsergeev@kumunetworks.com> X-Mailer: git-send-email 1.8.4.2 Subject: [Buildroot] [PATCH 1/1] skeleton: add systemd network.service unit X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net 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 --- .../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