* [gentoo-commits] repo/gentoo:master commit in: net-misc/wireguard/, net-misc/wireguard/files/
@ 2016-10-14 16:25 Jason Donenfeld
0 siblings, 0 replies; only message in thread
From: Jason Donenfeld @ 2016-10-14 16:25 UTC (permalink / raw
To: gentoo-commits
commit: bacd0610a70acbd102193c6c4374a02a7b3121c4
Author: Jason A. Donenfeld <zx2c4 <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 14 16:25:20 2016 +0000
Commit: Jason Donenfeld <zx2c4 <AT> gentoo <DOT> org>
CommitDate: Fri Oct 14 16:25:50 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bacd0610
net-misc/wireguard: add netifrc script
Package-Manager: portage-2.3.2
net-misc/wireguard/files/wireguard-openrc.sh | 43 ++++++++++++++++++++++++
net-misc/wireguard/wireguard-0.0.20161014.ebuild | 2 ++
net-misc/wireguard/wireguard-9999.ebuild | 2 ++
3 files changed, 47 insertions(+)
diff --git a/net-misc/wireguard/files/wireguard-openrc.sh b/net-misc/wireguard/files/wireguard-openrc.sh
new file mode 100644
index 00000000..9c3df6a
--- /dev/null
+++ b/net-misc/wireguard/files/wireguard-openrc.sh
@@ -0,0 +1,43 @@
+# Copyright (c) 2016 Gentoo Foundation
+# All rights reserved. Released under the 2-clause BSD license.
+
+wireguard_depend()
+{
+ program /usr/bin/wg
+ after interface
+ before dhcp
+}
+
+wireguard_pre_start()
+{
+ ip link delete dev "$IFACE" type wireguard 2>/dev/null
+ ebegin "Creating WireGuard interface $IFACE"
+ if ! ip link add dev "$IFACE" type wireguard; then
+ eend $?
+ return $?
+ fi
+ eend 0
+
+ ebegin "Configuring WireGuard interface $IFACE"
+ set -- $(_get_array "wireguard_$IFVAR")
+ if [[ -f $1 && $# -eq 1 ]]; then
+ /usr/bin/wg setconf "$IFACE" "$1"
+ else
+ eval /usr/bin/wg set "$IFACE" "$@"
+ fi
+ if [ $? -eq 0 ]; then
+ _up
+ eend 0
+ return
+ fi
+ e=$?
+ ip link delete dev "$IFACE" type wireguard 2>/dev/null
+ eend $e
+}
+
+wireguard_post_stop()
+{
+ ebegin "Removing WireGuard interface $IFACE"
+ ip link delete dev "$IFACE" type wireguard
+ eend $?
+}
diff --git a/net-misc/wireguard/wireguard-0.0.20161014.ebuild b/net-misc/wireguard/wireguard-0.0.20161014.ebuild
index 83e13fc..86294fa 100644
--- a/net-misc/wireguard/wireguard-0.0.20161014.ebuild
+++ b/net-misc/wireguard/wireguard-0.0.20161014.ebuild
@@ -53,6 +53,8 @@ src_install() {
dodoc -r contrib/examples
linux-mod_src_install
emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" -C src/tools install
+ insinto /$(get_libdir)/netifrc/net
+ newins "${FILESDIR}"/wireguard-openrc.sh wireguard.sh
}
pkg_postinst() {
diff --git a/net-misc/wireguard/wireguard-9999.ebuild b/net-misc/wireguard/wireguard-9999.ebuild
index 83e13fc..86294fa 100644
--- a/net-misc/wireguard/wireguard-9999.ebuild
+++ b/net-misc/wireguard/wireguard-9999.ebuild
@@ -53,6 +53,8 @@ src_install() {
dodoc -r contrib/examples
linux-mod_src_install
emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" -C src/tools install
+ insinto /$(get_libdir)/netifrc/net
+ newins "${FILESDIR}"/wireguard-openrc.sh wireguard.sh
}
pkg_postinst() {
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-10-14 16:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-14 16:25 [gentoo-commits] repo/gentoo:master commit in: net-misc/wireguard/, net-misc/wireguard/files/ Jason Donenfeld
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox