Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/netifrc/files/, net-misc/netifrc/
Date: Mon, 07 Sep 2020 09:15:08
Message-Id: 1599470099.9e4296e80802f9fae11aed270f15903bbd2acc89.polynomial-c@gentoo
1 commit: 9e4296e80802f9fae11aed270f15903bbd2acc89
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 7 09:06:29 2020 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 7 09:14:59 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e4296e8
7
8 net-misc/netifrc: Revbump fixing issue with >=net-misc/dhcpcd-9.0.0
9
10 Committed as revbump due to maintainer timeout...
11
12 Closes: https://bugs.gentoo.org/718114
13 Package-Manager: Portage-3.0.5, Repoman-3.0.1
14 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
15
16 .../files/netifrc-0.7.1-dhcpcd_args_tempfile.patch | 65 +++++++++++++++++++
17 .../netifrc-0.7.1-dhcpcd_pidfile_location.patch | 50 +++++++++++++++
18 net-misc/netifrc/netifrc-0.7.1-r1.ebuild | 75 ++++++++++++++++++++++
19 3 files changed, 190 insertions(+)
20
21 diff --git a/net-misc/netifrc/files/netifrc-0.7.1-dhcpcd_args_tempfile.patch b/net-misc/netifrc/files/netifrc-0.7.1-dhcpcd_args_tempfile.patch
22 new file mode 100644
23 index 00000000000..6ad40c860f9
24 --- /dev/null
25 +++ b/net-misc/netifrc/files/netifrc-0.7.1-dhcpcd_args_tempfile.patch
26 @@ -0,0 +1,65 @@
27 +From 586579d5c9fad63eb8780c556f34b80d0302e6b9 Mon Sep 17 00:00:00 2001
28 +From: Lars Wendler <polynomial-c@g.o>
29 +Date: Fri, 22 May 2020 10:09:22 +0200
30 +Subject: [PATCH] net/dhcpcd.sh: Put user args into a temp file
31 +
32 +So we still use the correct PID even if the user has changed his
33 +configuration between start and stop.
34 +
35 +Signed-off-by: Lars Wendler <polynomial-c@g.o>
36 +---
37 + net/dhcpcd.sh | 20 ++++++++++++++------
38 + 1 file changed, 14 insertions(+), 6 deletions(-)
39 +
40 +diff --git a/net/dhcpcd.sh b/net/dhcpcd.sh
41 +index c0639e0..dcc6817 100644
42 +--- a/net/dhcpcd.sh
43 ++++ b/net/dhcpcd.sh
44 +@@ -16,11 +16,14 @@ _config_vars="$_config_vars dhcp dhcpcd"
45 +
46 + dhcpcd_start()
47 + {
48 +- # check for pidfile after we gathered the user's opts because they can
49 ++ # check for pidfile after we gathered the user's args because they can
50 + # alter the pidfile's name (#718114)
51 +- local args= opt= pidfile= opts= new=true
52 ++ # Save the args into a file so dhcpcd_stop can later re-use the very
53 ++ # same args later.
54 ++ local args= opt= pidfile= opts= new=true argsfile=/run/netifrc_dhcpcd_${IFACE}_args
55 + eval args=\$dhcpcd_${IFVAR}
56 + [ -z "${args}" ] && args=${dhcpcd}
57 ++ echo "${args}" > ${argsfile}
58 + pidfile="$(dhcpcd -P ${args} ${IFACE})"
59 +
60 + # Get our options
61 +@@ -78,12 +81,16 @@ dhcpcd_start()
62 +
63 + dhcpcd_stop()
64 + {
65 +- local args= pidfile= opts= sig=SIGTERM
66 ++ local args= pidfile= opts= sig=SIGTERM argsfile=/run/netifrc_dhcpcd_${IFACE}_args
67 +
68 +- # check for pidfile after we gathered the user's opts because they can
69 ++ # check for pidfile after we gathered the user's args because they can
70 + # alter the pidfile's name (#718114)
71 +- eval args=\$dhcpcd_${IFVAR}
72 +- [ -z "${args}" ] && args=${dhcpcd}
73 ++ if [ -f "${argsfile}" ] ; then
74 ++ args="$(cat ${argsfile})"
75 ++ else
76 ++ eval args=\$dhcpcd_${IFVAR}
77 ++ [ -z "${args}" ] && args=${dhcpcd}
78 ++ fi
79 + pidfile="$(dhcpcd -P ${args} ${IFACE})"
80 + [ ! -f "${pidfile}" ] && return 0
81 +
82 +@@ -94,5 +101,6 @@ dhcpcd_stop()
83 + *" release "*) dhcpcd -k "${IFACE}" ;;
84 + *) dhcpcd -x "${IFACE}" ;;
85 + esac
86 ++ [ -f "${argsfile}" ] && rm -f "${argsfile}"
87 + eend $?
88 + }
89 +--
90 +2.27.0.rc0
91 +
92
93 diff --git a/net-misc/netifrc/files/netifrc-0.7.1-dhcpcd_pidfile_location.patch b/net-misc/netifrc/files/netifrc-0.7.1-dhcpcd_pidfile_location.patch
94 new file mode 100644
95 index 00000000000..154e7a7696a
96 --- /dev/null
97 +++ b/net-misc/netifrc/files/netifrc-0.7.1-dhcpcd_pidfile_location.patch
98 @@ -0,0 +1,50 @@
99 +From c29dffb14e321d927196a9b39b545004e632d3c4 Mon Sep 17 00:00:00 2001
100 +From: Lars Wendler <polynomial-c@g.o>
101 +Date: Thu, 21 May 2020 18:35:32 +0200
102 +Subject: [PATCH] net/dhcpcd.sh: fetch pidfile location from dhcpcd
103 +
104 +There's a -P switch for this but we also need to take into account the
105 +-4 and -6 switches as they both alter the pidfile's name.
106 +
107 +Bug: https://bugs.gentoo.org/718114
108 +Signed-off-by: Lars Wendler <polynomial-c@g.o>
109 +---
110 + net/dhcpcd.sh | 13 +++++++++++--
111 + 1 file changed, 11 insertions(+), 2 deletions(-)
112 +
113 +diff --git a/net/dhcpcd.sh b/net/dhcpcd.sh
114 +index 0a306b8..c0639e0 100644
115 +--- a/net/dhcpcd.sh
116 ++++ b/net/dhcpcd.sh
117 +@@ -16,9 +16,12 @@ _config_vars="$_config_vars dhcp dhcpcd"
118 +
119 + dhcpcd_start()
120 + {
121 +- local args= opt= opts= pidfile="/run/dhcpcd-${IFACE}.pid" new=true
122 ++ # check for pidfile after we gathered the user's opts because they can
123 ++ # alter the pidfile's name (#718114)
124 ++ local args= opt= pidfile= opts= new=true
125 + eval args=\$dhcpcd_${IFVAR}
126 + [ -z "${args}" ] && args=${dhcpcd}
127 ++ pidfile="$(dhcpcd -P ${args} ${IFACE})"
128 +
129 + # Get our options
130 + eval opts=\$dhcp_${IFVAR}
131 +@@ -75,7 +78,13 @@ dhcpcd_start()
132 +
133 + dhcpcd_stop()
134 + {
135 +- local pidfile="/run/dhcpcd-${IFACE}.pid" opts= sig=SIGTERM
136 ++ local args= pidfile= opts= sig=SIGTERM
137 ++
138 ++ # check for pidfile after we gathered the user's opts because they can
139 ++ # alter the pidfile's name (#718114)
140 ++ eval args=\$dhcpcd_${IFVAR}
141 ++ [ -z "${args}" ] && args=${dhcpcd}
142 ++ pidfile="$(dhcpcd -P ${args} ${IFACE})"
143 + [ ! -f "${pidfile}" ] && return 0
144 +
145 + ebegin "Stopping dhcpcd on ${IFACE}"
146 +--
147 +2.27.0.rc0
148 +
149
150 diff --git a/net-misc/netifrc/netifrc-0.7.1-r1.ebuild b/net-misc/netifrc/netifrc-0.7.1-r1.ebuild
151 new file mode 100644
152 index 00000000000..a5c2b998bd7
153 --- /dev/null
154 +++ b/net-misc/netifrc/netifrc-0.7.1-r1.ebuild
155 @@ -0,0 +1,75 @@
156 +# Copyright 1999-2020 Gentoo Authors
157 +# Distributed under the terms of the GNU General Public License v2
158 +
159 +EAPI=7
160 +
161 +inherit systemd udev
162 +
163 +DESCRIPTION="Gentoo Network Interface Management Scripts"
164 +HOMEPAGE="https://www.gentoo.org/proj/en/base/openrc/"
165 +
166 +if [[ ${PV} == "9999" ]]; then
167 + EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/netifrc.git"
168 + #EGIT_REPO_URI="https://github.com/gentoo/${PN}" # Alternate
169 + inherit git-r3
170 +else
171 + SRC_URI="https://gitweb.gentoo.org/proj/${PN}.git/snapshot/${P}.tar.gz"
172 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
173 +fi
174 +
175 +LICENSE="BSD-2"
176 +SLOT="0"
177 +IUSE=""
178 +
179 +DEPEND="!<sys-fs/udev-172"
180 +RDEPEND="sys-apps/gentoo-functions
181 + >=sys-apps/openrc-0.15
182 + !<sys-fs/udev-init-scripts-27"
183 +BDEPEND="kernel_linux? ( virtual/pkgconfig )"
184 +
185 +PATCHES=(
186 + "${FILESDIR}/${PN}-0.7.1-dhcpcd_pidfile_location.patch"
187 + "${FILESDIR}/${PN}-0.7.1-dhcpcd_args_tempfile.patch"
188 +)
189 +
190 +src_prepare() {
191 + if [[ ${PV} == "9999" ]] ; then
192 + local ver="git-${EGIT_VERSION:0:6}"
193 + sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
194 + einfo "Producing ChangeLog from Git history"
195 + GIT_DIR="${S}/.git" git log >"${S}"/ChangeLog
196 + fi
197 +
198 + default
199 +}
200 +
201 +src_compile() {
202 + MAKE_ARGS="${MAKE_ARGS}
203 + UDEVDIR=${EPREFIX}$(get_udevdir)
204 + LIBEXECDIR=${EPREFIX}/lib/${PN} PF=${PF}"
205 +
206 + use prefix && MAKE_ARGS+=" MKPREFIX=yes PREFIX=${EPREFIX}"
207 +
208 + emake ${MAKE_ARGS} all
209 +}
210 +
211 +src_install() {
212 + emake ${MAKE_ARGS} DESTDIR="${D}" install
213 + dodoc README CREDITS FEATURE-REMOVAL-SCHEDULE STYLE TODO
214 +
215 + # Install the service file
216 + LIBEXECDIR="${EPREFIX}/lib/${PN}"
217 + UNIT_DIR="$(systemd_get_systemunitdir)"
218 + sed "s:@LIBEXECDIR@:${LIBEXECDIR}:" "${S}/systemd/net_at.service.in" > "${T}/net_at.service" || die
219 + systemd_newunit "${T}/net_at.service" 'net@.service'
220 + dosym "${UNIT_DIR#${EPREFIX}}/net@.service" "${UNIT_DIR#${EPREFIX}}/net@××.service"
221 +}
222 +
223 +pkg_postinst() {
224 + if [[ ! -e "${EROOT}"/etc/conf.d/net && -z ${REPLACING_VERSIONS} ]]; then
225 + elog "The network configuration scripts will use dhcp by"
226 + elog "default to set up your interfaces."
227 + elog "If you need to set up something more complete, see"
228 + elog "${EROOT}/usr/share/doc/${P}/README"
229 + fi
230 +}