openresolv: upgraded package to upstream

Upgraded net-dns/openresolv to version 3.7.0 on arm

BUG=b:34770284
TEST=Compiles

Change-Id: I7c640251608fc7eec05f33656a5118caf27a8fc5
Reviewed-on: https://chromium-review.googlesource.com/435476
Commit-Ready: Ian Coolidge <icoolidge@google.com>
Tested-by: Ian Coolidge <icoolidge@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/metadata/md5-cache/net-dns/openresolv-3.7.0 b/metadata/md5-cache/net-dns/openresolv-3.7.0
new file mode 100644
index 0000000..d5fc986
--- /dev/null
+++ b/metadata/md5-cache/net-dns/openresolv-3.7.0
@@ -0,0 +1,13 @@
+DEFINED_PHASES=config configure install
+DEPEND=!net-dns/resolvconf-gentoo !<net-dns/dnsmasq-2.40-r1
+DESCRIPTION=A framework for managing DNS information
+EAPI=5
+HOMEPAGE=http://roy.marples.name/projects/openresolv
+IUSE=selinux
+KEYWORDS=*
+LICENSE=BSD-2
+RDEPEND=selinux? ( sec-policy/selinux-resolvconf )
+SLOT=0
+SRC_URI=http://roy.marples.name/downloads/openresolv/openresolv-3.7.0.tar.bz2
+_eclasses_=eutils	06133990e861be0fe60c2b428fd025d9	multilib	3972ca401cf7dbb430df9995f5d8d580	toolchain-funcs	6198c04daba0e1307bd844df7d37f423
+_md5_=fd977b916a4e92ca224c3633e71edff0
diff --git a/net-dns/openresolv/Manifest b/net-dns/openresolv/Manifest
new file mode 100644
index 0000000..b60df09
--- /dev/null
+++ b/net-dns/openresolv/Manifest
@@ -0,0 +1 @@
+DIST openresolv-3.7.0.tar.bz2 17699 SHA256 8b7c0b2f6165b51893bceeb2ea1d3e85c08cbd1afc65319003a912166f8c35de SHA512 230df582176f7ade598e2a92834a10f4fd5d1b7d020804694924fe281b5a78fdb73d94eeff32e2a285b0c1557f4517e6b31cf8a3162fc3fa3928283f50527946 WHIRLPOOL 320122ae3dac8f4772badae533da65b8a6fb8ccabf72dbc0d6096fffd8ad5ad4109bc7170e3b73494da94a27db46c96bfea9d5c87aae16a008f4f87772e45616
diff --git a/net-dns/openresolv/files/3.8.1-restore-newline.patch b/net-dns/openresolv/files/3.8.1-restore-newline.patch
new file mode 100644
index 0000000..2522710
--- /dev/null
+++ b/net-dns/openresolv/files/3.8.1-restore-newline.patch
@@ -0,0 +1,16 @@
+--- a/libc.in
++++ b/libc.in
+@@ -214,11 +214,11 @@
+ # If the old file does not have our signature, back it up.
+ # If the new file just has our signature, restore the backup.
+ if $backup; then
+ 	if [ "$newconf" = "$signature$NL" ]; then
+ 		if [ -e "$resolv_conf.bak" ]; then
+-			newconf="$(cat "$resolv_conf.bak")"
++			newconf="$(cat "$resolv_conf.bak")$NL"
+ 		fi
+ 	elif [ -e "$resolv_conf" ]; then
+ 		read line <"$resolv_conf"
+ 		if [ "$line" != "$signature" ]; then
+ 			cp "$resolv_conf" "$resolv_conf.bak"
+
diff --git a/net-dns/openresolv/files/restartcmd b/net-dns/openresolv/files/restartcmd
new file mode 100644
index 0000000..bc2196e
--- /dev/null
+++ b/net-dns/openresolv/files/restartcmd
@@ -0,0 +1,20 @@
+#!/bin/sh
+# This script currently supports:
+# - openrc
+# - systemd
+
+if [ -z "${1}" ]; then
+    echo "Missing arguments." >&2
+    exit 1
+fi
+
+if [ -e /run/openrc/softlevel ]; then
+    if /sbin/rc-service -e ${1}; then
+        exec rc-service ${1} -- -Ds restart
+    fi
+elif [ -d /run/systemd/system ]; then
+    exec systemctl try-restart ${1}
+else
+    echo "Unsupported init system." >&2
+    exit 1
+fi
diff --git a/net-dns/openresolv/metadata.xml b/net-dns/openresolv/metadata.xml
new file mode 100644
index 0000000..6c71359
--- /dev/null
+++ b/net-dns/openresolv/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<maintainer type="person">
+		<email>alonbl@gentoo.org</email>
+	</maintainer>
+	<longdescription lang="en">
+		A framework for managing DNS information
+	</longdescription>
+</pkgmetadata>
diff --git a/net-dns/openresolv/openresolv-3.7.0.ebuild b/net-dns/openresolv/openresolv-3.7.0.ebuild
new file mode 100644
index 0000000..9624437
--- /dev/null
+++ b/net-dns/openresolv/openresolv-3.7.0.ebuild
@@ -0,0 +1,50 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="A framework for managing DNS information"
+HOMEPAGE="http://roy.marples.name/projects/openresolv"
+SRC_URI="http://roy.marples.name/downloads/${PN}/${P}.tar.bz2"
+
+LICENSE="BSD-2"
+SLOT="0"
+KEYWORDS="*"
+IUSE="selinux"
+
+DEPEND="!net-dns/resolvconf-gentoo
+	!<net-dns/dnsmasq-2.40-r1"
+RDEPEND="selinux? ( sec-policy/selinux-resolvconf )"
+
+src_configure() {
+	econf \
+		--prefix= \
+		--rundir=/var/run \
+		--libexecdir=/lib/resolvconf \
+		--restartcmd="/lib/resolvconf/helpers/restartcmd \1"
+}
+
+src_install() {
+	default
+	exeinto /lib/resolvconf/helpers
+	doexe "${FILESDIR}"/restartcmd
+}
+
+pkg_config() {
+	if [ "${ROOT}" != "/" ]; then
+		eerror "We cannot configure unless \$ROOT=/"
+		return 1
+	fi
+
+	if [ -n "$(resolvconf -l)" ]; then
+		einfo "${PN} already has DNS information"
+	else
+		ebegin "Copying /etc/resolv.conf to resolvconf -a dummy"
+		resolvconf -a dummy </etc/resolv.conf
+		eend $? || return $?
+		einfo "The dummy interface will disappear when you next reboot"
+	fi
+}