1 |
# Copyright 1999-2015 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/networkmanager-1.0.2-r1.ebuild,v 1.2 2015/06/04 09:34:21 pacho Exp $ |
4 |
|
5 |
EAPI="5" |
6 |
GCONF_DEBUG="no" |
7 |
GNOME_ORG_MODULE="NetworkManager" |
8 |
GNOME2_LA_PUNT="yes" |
9 |
VALA_MIN_API_VERSION="0.18" |
10 |
VALA_USE_DEPEND="vapigen" |
11 |
PYTHON_COMPAT=( python{2_7,3_3,3_4} ) |
12 |
|
13 |
inherit autotools bash-completion-r1 eutils gnome2 linux-info multilib python-any-r1 systemd \ |
14 |
user readme.gentoo toolchain-funcs vala versionator virtualx udev |
15 |
|
16 |
DESCRIPTION="Universal network configuration daemon for laptops, desktops, servers and virtualization hosts" |
17 |
HOMEPAGE="https://wiki.gnome.org/Projects/NetworkManager" |
18 |
|
19 |
LICENSE="GPL-2+" |
20 |
SLOT="0" # add subslot if libnm-util.so.2 or libnm-glib.so.4 bumps soname version |
21 |
|
22 |
IUSE="bluetooth connection-sharing consolekit +dhclient dhcpcd gnutls +introspection \ |
23 |
kernel_linux +nss +modemmanager ncurses +ppp resolvconf selinux systemd teamd test \ |
24 |
vala +wext +wifi zeroconf" # wimax |
25 |
|
26 |
KEYWORDS="~alpha amd64 arm ~arm64 ~ppc ppc64 ~sparc x86" |
27 |
|
28 |
REQUIRED_USE=" |
29 |
modemmanager? ( ppp ) |
30 |
^^ ( nss gnutls ) |
31 |
^^ ( dhclient dhcpcd ) |
32 |
" |
33 |
|
34 |
# gobject-introspection-0.10.3 is needed due to gnome bug 642300 |
35 |
# wpa_supplicant-0.7.3-r3 is needed due to bug 359271 |
36 |
# TODO: Qt support? |
37 |
COMMON_DEPEND=" |
38 |
>=sys-apps/dbus-1.2 |
39 |
>=dev-libs/dbus-glib-0.100 |
40 |
>=dev-libs/glib-2.32:2 |
41 |
>=dev-libs/libnl-3.2.8:3= |
42 |
>=sys-auth/polkit-0.106 |
43 |
net-libs/libndp |
44 |
>=net-libs/libsoup-2.26:2.4= |
45 |
net-misc/iputils |
46 |
sys-libs/readline:0 |
47 |
>=virtual/libgudev-165:= |
48 |
bluetooth? ( >=net-wireless/bluez-5 ) |
49 |
connection-sharing? ( |
50 |
net-dns/dnsmasq[dhcp] |
51 |
net-firewall/iptables ) |
52 |
gnutls? ( |
53 |
dev-libs/libgcrypt:0= |
54 |
net-libs/gnutls:= ) |
55 |
modemmanager? ( >=net-misc/modemmanager-0.7.991 ) |
56 |
ncurses? ( >=dev-libs/newt-0.52.15 ) |
57 |
nss? ( >=dev-libs/nss-3.11:= ) |
58 |
dhclient? ( >=net-misc/dhcp-4[client] ) |
59 |
dhcpcd? ( >=net-misc/dhcpcd-4.0.0_rc3 ) |
60 |
introspection? ( >=dev-libs/gobject-introspection-0.10.3:= ) |
61 |
ppp? ( >=net-dialup/ppp-2.4.5:=[ipv6] net-dialup/rp-pppoe ) |
62 |
resolvconf? ( net-dns/openresolv ) |
63 |
systemd? ( >=sys-apps/systemd-209:0= ) |
64 |
!systemd? ( || ( sys-power/upower sys-power/upower-pm-utils ) ) |
65 |
teamd? ( >=net-misc/libteam-1.9 ) |
66 |
zeroconf? ( net-dns/avahi:=[autoipd] ) |
67 |
" |
68 |
RDEPEND="${COMMON_DEPEND} |
69 |
consolekit? ( sys-auth/consolekit ) |
70 |
wifi? ( >=net-wireless/wpa_supplicant-0.7.3-r3[dbus] ) |
71 |
" |
72 |
DEPEND="${COMMON_DEPEND} |
73 |
dev-util/gdbus-codegen |
74 |
dev-util/gtk-doc-am |
75 |
>=dev-util/intltool-0.40 |
76 |
>=sys-devel/gettext-0.17 |
77 |
>=sys-kernel/linux-headers-2.6.29 |
78 |
virtual/pkgconfig |
79 |
vala? ( $(vala_depend) ) |
80 |
test? ( |
81 |
$(python_gen_any_dep ' |
82 |
dev-python/dbus-python[${PYTHON_USEDEP}] |
83 |
dev-python/pygobject:2[${PYTHON_USEDEP}]') |
84 |
) |
85 |
" |
86 |
|
87 |
sysfs_deprecated_check() { |
88 |
ebegin "Checking for SYSFS_DEPRECATED support" |
89 |
|
90 |
if { linux_chkconfig_present SYSFS_DEPRECATED_V2; }; then |
91 |
eerror "Please disable SYSFS_DEPRECATED_V2 support in your kernel config and recompile your kernel" |
92 |
eerror "or NetworkManager will not work correctly." |
93 |
eerror "See http://bugs.gentoo.org/333639 for more info." |
94 |
die "CONFIG_SYSFS_DEPRECATED_V2 support detected!" |
95 |
fi |
96 |
eend $? |
97 |
} |
98 |
|
99 |
pkg_pretend() { |
100 |
if use kernel_linux; then |
101 |
get_version |
102 |
if linux_config_exists; then |
103 |
sysfs_deprecated_check |
104 |
else |
105 |
ewarn "Was unable to determine your kernel .config" |
106 |
ewarn "Please note that if CONFIG_SYSFS_DEPRECATED_V2 is set in your kernel .config, NetworkManager will not work correctly." |
107 |
ewarn "See http://bugs.gentoo.org/333639 for more info." |
108 |
fi |
109 |
|
110 |
fi |
111 |
} |
112 |
|
113 |
pkg_setup() { |
114 |
enewgroup plugdev |
115 |
} |
116 |
|
117 |
src_prepare() { |
118 |
DOC_CONTENTS="To modify system network connections without needing to enter the |
119 |
root password, add your user account to the 'plugdev' group." |
120 |
|
121 |
# Force use of /run, avoid eautoreconf, upstream bug #737139 |
122 |
sed -e 's:$localstatedir/run/:/run/:' -i configure || die |
123 |
|
124 |
# Partially revert commit that breaks dhcpcd detection, bug #549970 |
125 |
epatch "${FILESDIR}"/${PN}-1.0.2-configure-dhcpcd.patch |
126 |
|
127 |
use vala && vala_src_prepare |
128 |
|
129 |
epatch_user # don't remove, users often want custom patches for NM |
130 |
|
131 |
eautoreconf |
132 |
|
133 |
gnome2_src_prepare |
134 |
} |
135 |
|
136 |
src_configure() { |
137 |
local myconf |
138 |
|
139 |
# Same hack as net-dialup/pptpd to get proper plugin dir for ppp, bug #519986 |
140 |
if use ppp; then |
141 |
local PPPD_VER=`best_version net-dialup/ppp` |
142 |
PPPD_VER=${PPPD_VER#*/*-} #reduce it to ${PV}-${PR} |
143 |
PPPD_VER=${PPPD_VER%%[_-]*} # main version without beta/pre/patch/revision |
144 |
myconf="${myconf} --with-pppd-plugin-dir=/usr/$(get_libdir)/pppd/${PPPD_VER}" |
145 |
fi |
146 |
|
147 |
# unit files directory needs to be passed only when systemd is enabled, |
148 |
# otherwise systemd support is not disabled completely, bug #524534 |
149 |
use systemd && myconf="${myconf} "$(systemd_with_unitdir)"" |
150 |
|
151 |
# TODO: enable wimax when we have a libnl:3 compatible revision of it |
152 |
# wimax will be removed, bug #522822 |
153 |
# ifnet plugin always disabled until someone volunteers to actively |
154 |
# maintain and fix it |
155 |
gnome2_src_configure \ |
156 |
--disable-more-warnings \ |
157 |
--disable-static \ |
158 |
--localstatedir=/var \ |
159 |
--disable-lto \ |
160 |
--disable-config-plugin-ibft \ |
161 |
--disable-ifnet \ |
162 |
--without-netconfig \ |
163 |
--with-dbus-sys-dir=/etc/dbus-1/system.d \ |
164 |
--with-udev-dir="$(get_udevdir)" \ |
165 |
--with-config-plugins-default=keyfile \ |
166 |
--with-iptables=/sbin/iptables \ |
167 |
--with-libsoup=yes \ |
168 |
--enable-concheck \ |
169 |
--with-crypto=$(usex nss nss gnutls) \ |
170 |
--with-session-tracking=$(usex systemd systemd $(usex consolekit consolekit no)) \ |
171 |
--with-suspend-resume=$(usex systemd systemd upower) \ |
172 |
$(use_enable bluetooth bluez5-dun) \ |
173 |
$(use_enable introspection) \ |
174 |
$(use_enable ppp) \ |
175 |
--disable-wimax \ |
176 |
$(use_with dhclient) \ |
177 |
$(use_with dhcpcd) \ |
178 |
$(use_with modemmanager modem-manager-1) \ |
179 |
$(use_with ncurses nmtui) \ |
180 |
$(use_with resolvconf) \ |
181 |
$(use_with selinux) \ |
182 |
$(use_enable teamd teamdctl) \ |
183 |
$(use_enable test tests) \ |
184 |
$(use_enable vala) \ |
185 |
--without-valgrind \ |
186 |
$(use_with wext) \ |
187 |
${myconf} |
188 |
} |
189 |
|
190 |
src_test() { |
191 |
python_setup |
192 |
Xemake check |
193 |
} |
194 |
|
195 |
src_install() { |
196 |
# Install completions at proper place, bug #465100 |
197 |
gnome2_src_install completiondir="$(get_bashcompdir)" |
198 |
|
199 |
! use systemd && readme.gentoo_create_doc |
200 |
|
201 |
newinitd "${FILESDIR}/init.d.NetworkManager" NetworkManager |
202 |
newconfd "${FILESDIR}/conf.d.NetworkManager" NetworkManager |
203 |
|
204 |
# /var/run/NetworkManager is used by some distros, but not by Gentoo |
205 |
rmdir -v "${ED}/var/run/NetworkManager" || die "rmdir failed" |
206 |
rmdir -v "${ED}/var/run" || die "rmdir failed" |
207 |
|
208 |
# Need to keep the /etc/NetworkManager/dispatched.d for dispatcher scripts |
209 |
keepdir /etc/NetworkManager/dispatcher.d |
210 |
|
211 |
# Provide openrc net dependency only when nm is connected |
212 |
exeinto /etc/NetworkManager/dispatcher.d |
213 |
newexe "${FILESDIR}/10-openrc-status-r4" 10-openrc-status |
214 |
sed -e "s:@EPREFIX@:${EPREFIX}:g" \ |
215 |
-i "${ED}/etc/NetworkManager/dispatcher.d/10-openrc-status" || die |
216 |
|
217 |
keepdir /etc/NetworkManager/system-connections |
218 |
chmod 0600 "${ED}"/etc/NetworkManager/system-connections/.keep* # bug #383765 |
219 |
|
220 |
# Allow users in plugdev group to modify system connections |
221 |
insinto /usr/share/polkit-1/rules.d/ |
222 |
doins "${FILESDIR}/01-org.freedesktop.NetworkManager.settings.modify.system.rules" |
223 |
} |
224 |
|
225 |
pkg_postinst() { |
226 |
gnome2_pkg_postinst |
227 |
! use systemd && readme.gentoo_print_elog |
228 |
|
229 |
if [[ -e "${EROOT}etc/NetworkManager/nm-system-settings.conf" ]]; then |
230 |
ewarn "The ${PN} system configuration file has moved to a new location." |
231 |
ewarn "You must migrate your settings from ${EROOT}/etc/NetworkManager/nm-system-settings.conf" |
232 |
ewarn "to ${EROOT}etc/NetworkManager/NetworkManager.conf" |
233 |
ewarn |
234 |
ewarn "After doing so, you can remove ${EROOT}etc/NetworkManager/nm-system-settings.conf" |
235 |
fi |
236 |
|
237 |
# The polkit rules file moved to /usr/share |
238 |
old_rules="${EROOT}etc/polkit-1/rules.d/01-org.freedesktop.NetworkManager.settings.modify.system.rules" |
239 |
if [[ -f "${old_rules}" ]]; then |
240 |
case "$(md5sum ${old_rules})" in |
241 |
574d0cfa7e911b1f7792077003060240* ) |
242 |
# Automatically delete the old rules.d file if the user did not change it |
243 |
elog |
244 |
elog "Removing old ${old_rules} ..." |
245 |
rm -f "${old_rules}" || eerror "Failed, please remove ${old_rules} manually" |
246 |
;; |
247 |
* ) |
248 |
elog "The ${old_rules}" |
249 |
elog "file moved to /usr/share/polkit-1/rules.d/ in >=networkmanager-0.9.4.0-r4" |
250 |
elog "If you edited ${old_rules}" |
251 |
elog "without changing its behavior, you may want to remove it." |
252 |
;; |
253 |
esac |
254 |
fi |
255 |
|
256 |
# ifnet plugin was disabled for systemd users with 0.9.8.6 version |
257 |
# and for all people with 0.9.10.0-r1 (see ChangeLog for full explanations) |
258 |
if use systemd; then |
259 |
if ! version_is_at_least 0.9.8.6 ${REPLACING_VERSIONS}; then |
260 |
ewarn "Ifnet plugin won't be used with systemd support enabled" |
261 |
ewarn "as it is meant to be used with openRC and can cause collisions" |
262 |
ewarn "(like bug #485658)." |
263 |
ewarn "Because of this, you will likely need to reconfigure some of" |
264 |
ewarn "your networks. To do this you can rely on Gnome control center," |
265 |
ewarn "nm-connection-editor or nmtui tools for example once updated" |
266 |
ewarn "NetworkManager version is installed." |
267 |
fi |
268 |
else |
269 |
if ! version_is_at_least 0.9.10.0-r1 ${REPLACING_VERSIONS}; then |
270 |
ewarn "Ifnet plugin is now disabled because of it being unattended" |
271 |
ewarn "and unmaintained for a long time, leading to some unfixed bugs" |
272 |
ewarn "and new problems appearing. We will now use upstream 'keyfile'" |
273 |
ewarn "plugin." |
274 |
ewarn "Because of this, you will likely need to reconfigure some of" |
275 |
ewarn "your networks. To do this you can rely on Gnome control center," |
276 |
ewarn "nm-connection-editor or nmtui tools for example once updated" |
277 |
ewarn "NetworkManager version is installed." |
278 |
fi |
279 |
fi |
280 |
|
281 |
# NM fallbacks to plugin specified at compile time (upstream bug #738611) |
282 |
# but still show a warning to remember people to have cleaner config file |
283 |
if [[ -e "${EROOT}etc/NetworkManager/NetworkManager.conf" ]]; then |
284 |
if grep plugins "${EROOT}etc/NetworkManager/NetworkManager.conf" | grep -q ifnet; then |
285 |
ewarn |
286 |
ewarn "You seem to use 'ifnet' plugin in ${EROOT}etc/NetworkManager/NetworkManager.conf" |
287 |
ewarn "Since it won't be used, you will need to stop setting ifnet plugin there." |
288 |
ewarn |
289 |
fi |
290 |
fi |
291 |
|
292 |
# NM shows lots of errors making nmcli neither unusable, bug #528748 upstream bug #690457 |
293 |
if grep -r "psk-flags=1" "${EROOT}"/etc/NetworkManager/; then |
294 |
ewarn "You have psk-flags=1 setting in above files, you will need to" |
295 |
ewarn "either reconfigure affected networks or, at least, set the flag" |
296 |
ewarn "value to '0'." |
297 |
fi |
298 |
} |