1 |
# Copyright 1999-2013 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/networkmanager-0.9.4.0-r6.ebuild,v 1.11 2013/01/28 08:07:29 tetromino Exp $ |
4 |
|
5 |
EAPI="4" |
6 |
GNOME_ORG_MODULE="NetworkManager" |
7 |
|
8 |
inherit autotools eutils gnome.org linux-info systemd user toolchain-funcs udev |
9 |
|
10 |
DESCRIPTION="Universal network configuration daemon for laptops, desktops, servers and virtualization hosts" |
11 |
HOMEPAGE="http://www.gnome.org/projects/NetworkManager/" |
12 |
|
13 |
LICENSE="GPL-2+" |
14 |
SLOT="0" |
15 |
IUSE="avahi bluetooth connection-sharing dhclient +dhcpcd doc gnutls +introspection kernel_linux +nss modemmanager +ppp resolvconf +wext wimax" # systemd |
16 |
KEYWORDS="amd64 arm ppc ppc64 x86" |
17 |
|
18 |
REQUIRED_USE=" |
19 |
modemmanager? ( ppp ) |
20 |
^^ ( nss gnutls ) |
21 |
^^ ( dhclient dhcpcd )" |
22 |
|
23 |
# gobject-introspection-0.10.3 is needed due to gnome bug 642300 |
24 |
# wpa_supplicant-0.7.3-r3 is needed due to bug 359271 |
25 |
# libnl:1.1 is needed for linking to net-wireless/wimax libraries |
26 |
# XXX: on bump, check that net-wireless/wimax is still using libnl:1.1 ! |
27 |
# TODO: Qt support? |
28 |
COMMON_DEPEND=">=sys-apps/dbus-1.2 |
29 |
>=dev-libs/dbus-glib-0.75 |
30 |
virtual/udev[gudev] |
31 |
>=dev-libs/glib-2.26 |
32 |
>=sys-auth/polkit-0.97 |
33 |
>=net-libs/libsoup-2.26:2.4 |
34 |
>=net-wireless/wpa_supplicant-0.7.3-r3[dbus] |
35 |
bluetooth? ( >=net-wireless/bluez-4.82 ) |
36 |
avahi? ( net-dns/avahi[autoipd] ) |
37 |
gnutls? ( |
38 |
dev-libs/libgcrypt |
39 |
net-libs/gnutls ) |
40 |
nss? ( >=dev-libs/nss-3.11 ) |
41 |
dhclient? ( net-misc/dhcp[client] ) |
42 |
dhcpcd? ( >=net-misc/dhcpcd-4.0.0_rc3 ) |
43 |
introspection? ( >=dev-libs/gobject-introspection-0.10.3 ) |
44 |
ppp? ( >=net-dialup/ppp-2.4.5 ) |
45 |
resolvconf? ( net-dns/openresolv ) |
46 |
connection-sharing? ( |
47 |
net-dns/dnsmasq |
48 |
net-firewall/iptables ) |
49 |
wimax? ( |
50 |
dev-libs/libnl:1.1 |
51 |
>=net-wireless/wimax-1.5.1 ) |
52 |
!wimax? ( dev-libs/libnl:3 )" |
53 |
|
54 |
RDEPEND="${COMMON_DEPEND} |
55 |
modemmanager? ( >=net-misc/modemmanager-0.4 ) |
56 |
sys-auth/consolekit" |
57 |
# systemd? ( >=sys-apps/systemd-31 ) |
58 |
# !systemd? ( sys-auth/consolekit ) |
59 |
|
60 |
DEPEND="${COMMON_DEPEND} |
61 |
virtual/pkgconfig |
62 |
>=dev-util/intltool-0.40 |
63 |
>=sys-devel/gettext-0.17 |
64 |
>=sys-kernel/linux-headers-2.6.29 |
65 |
doc? ( >=dev-util/gtk-doc-1.8 )" |
66 |
|
67 |
sysfs_deprecated_check() { |
68 |
ebegin "Checking for SYSFS_DEPRECATED support" |
69 |
|
70 |
if { linux_chkconfig_present SYSFS_DEPRECATED_V2; }; then |
71 |
eerror "Please disable SYSFS_DEPRECATED_V2 support in your kernel config and recompile your kernel" |
72 |
eerror "or NetworkManager will not work correctly." |
73 |
eerror "See http://bugs.gentoo.org/333639 for more info." |
74 |
die "CONFIG_SYSFS_DEPRECATED_V2 support detected!" |
75 |
fi |
76 |
eend $? |
77 |
} |
78 |
|
79 |
pkg_pretend() { |
80 |
if use kernel_linux; then |
81 |
get_version |
82 |
if linux_config_exists; then |
83 |
sysfs_deprecated_check |
84 |
else |
85 |
ewarn "Was unable to determine your kernel .config" |
86 |
ewarn "Please note that if CONFIG_SYSFS_DEPRECATED_V2 is set in your kernel .config, NetworkManager will not work correctly." |
87 |
ewarn "See http://bugs.gentoo.org/333639 for more info." |
88 |
fi |
89 |
|
90 |
fi |
91 |
} |
92 |
|
93 |
pkg_setup() { |
94 |
enewgroup plugdev |
95 |
} |
96 |
|
97 |
src_prepare() { |
98 |
# Build against libnl:1.1 for net-wireless/wimax-1.5.2 compatibility |
99 |
epatch "${FILESDIR}/${PN}-0.9.4.0-force-libnl1.1-r1.patch" |
100 |
# Update init.d script to provide net and use inactive status if not connected |
101 |
epatch "${FILESDIR}/${PN}-0.9.2.0-init-provide-net-r1.patch" |
102 |
# Bug #402085, https://bugzilla.gnome.org/show_bug.cgi?id=387832 |
103 |
epatch "${FILESDIR}/${PN}-0.9.2.0-pre-sleep.patch" |
104 |
# Fix quote handling for global data (Bug #410821) |
105 |
epatch "${FILESDIR}/${PN}-0.9.4.0-fix-quote-handling.patch" |
106 |
# Fix uninitialized variables in libnm-glib |
107 |
epatch "${FILESDIR}/${P}-libnm-glib-ensure_inited.patch" |
108 |
epatch "${FILESDIR}/${P}-libnm-glib-init-gerror.patch" |
109 |
# Fix building against linux-headers-3.4, #417055 |
110 |
epatch "${FILESDIR}/${P}-ip_ppp.h.patch" |
111 |
# Fix ipv6 default route bug, #417529 |
112 |
epatch "${FILESDIR}/${P}-ipv6-route.patch" |
113 |
# Bug #335147, https://bugzilla.gnome.org/show_bug.cgi?id=679428 |
114 |
epatch "${FILESDIR}/${P}-dhclient-ipv6.patch" |
115 |
# Bug #426844, wext vs. nl80211 API issues |
116 |
epatch "${FILESDIR}/${P}-nl80211-encryption-caps.patch" |
117 |
epatch "${FILESDIR}/${P}-wifi-kernel-api.patch" |
118 |
|
119 |
epatch_user |
120 |
|
121 |
eautoreconf |
122 |
default |
123 |
} |
124 |
|
125 |
src_configure() { |
126 |
ECONF="--disable-more-warnings |
127 |
--disable-static |
128 |
--localstatedir=/var |
129 |
--with-distro=gentoo |
130 |
--with-dbus-sys-dir=/etc/dbus-1/system.d |
131 |
--with-udev-dir=$(udev_get_udevdir) |
132 |
--with-iptables=/sbin/iptables |
133 |
--enable-concheck |
134 |
$(use_enable doc gtk-doc) |
135 |
$(use_enable introspection) |
136 |
$(use_enable ppp) |
137 |
$(use_enable wimax) |
138 |
$(use_with dhclient) |
139 |
$(use_with dhcpcd) |
140 |
$(use_with doc docs) |
141 |
$(use_with resolvconf) |
142 |
$(use_with wext) |
143 |
$(use_with wimax libnl-1) |
144 |
$(systemd_with_unitdir)" |
145 |
|
146 |
if use nss ; then |
147 |
ECONF="${ECONF} $(use_with nss crypto=nss)" |
148 |
else |
149 |
ECONF="${ECONF} $(use_with gnutls crypto=gnutls)" |
150 |
fi |
151 |
|
152 |
# if use systemd; then |
153 |
# ECONF="${ECONF} --with-session-tracking=systemd" |
154 |
# else |
155 |
ECONF="${ECONF} --with-session-tracking=ck" |
156 |
# fi |
157 |
|
158 |
econf ${ECONF} |
159 |
} |
160 |
|
161 |
src_test() { |
162 |
cp libnm-util/tests/certs/test_ca_cert.pem src/settings/plugins/ifnet/tests/ || die |
163 |
default |
164 |
} |
165 |
|
166 |
src_install() { |
167 |
default |
168 |
# /var/run/NetworkManager is used by some distros, but not by Gentoo |
169 |
rmdir -v "${ED}/var/run/NetworkManager" || die "rmdir failed" |
170 |
|
171 |
# Need to keep the /etc/NetworkManager/dispatched.d for dispatcher scripts |
172 |
keepdir /etc/NetworkManager/dispatcher.d |
173 |
|
174 |
# Provide openrc net dependency only when nm is connected |
175 |
exeinto /etc/NetworkManager/dispatcher.d |
176 |
newexe "${FILESDIR}/10-openrc-status-r2" 10-openrc-status |
177 |
sed -e "s:@EPREFIX@:${EPREFIX}:g" \ |
178 |
-i "${ED}/etc/NetworkManager/dispatcher.d/10-openrc-status" || die |
179 |
|
180 |
# Add keyfile plugin support |
181 |
keepdir /etc/NetworkManager/system-connections |
182 |
chmod 0600 "${ED}"/etc/NetworkManager/system-connections/.keep* # bug #383765 |
183 |
insinto /etc/NetworkManager |
184 |
newins "${FILESDIR}/nm-system-settings.conf-ifnet" NetworkManager.conf |
185 |
|
186 |
# Allow users in plugdev group to modify system connections |
187 |
insinto /usr/share/polkit-1/rules.d/ |
188 |
doins "${FILESDIR}/01-org.freedesktop.NetworkManager.settings.modify.system.rules" |
189 |
if has_version '<sys-auth/polkit-0.106'; then |
190 |
insinto /etc/polkit-1/localauthority/10-vendor.d |
191 |
doins "${FILESDIR}/01-org.freedesktop.NetworkManager.settings.modify.system.pkla" |
192 |
fi |
193 |
|
194 |
# Default conf.d file |
195 |
newconfd "${FILESDIR}/conf.d.NetworkManager" NetworkManager |
196 |
|
197 |
# Remove useless .la files |
198 |
find "${D}" -name '*.la' -exec rm -f {} + || die "la file removal failed" |
199 |
} |
200 |
|
201 |
pkg_postinst() { |
202 |
elog "To modify system network connections without needing to enter the" |
203 |
elog "root password, add your user account to the 'plugdev' group." |
204 |
|
205 |
if [[ -e "${EROOT}etc/NetworkManager/nm-system-settings.conf" ]]; then |
206 |
ewarn "The ${PN} system configuration file has moved to a new location." |
207 |
ewarn "You must migrate your settings from ${EROOT}/etc/NetworkManager/nm-system-settings.conf" |
208 |
ewarn "to ${EROOT}etc/NetworkManager/NetworkManager.conf" |
209 |
ewarn |
210 |
ewarn "After doing so, you can remove ${EROOT}etc/NetworkManager/nm-system-settings.conf" |
211 |
fi |
212 |
|
213 |
# The polkit rules file moved to /usr/share |
214 |
old_rules="${EROOT}etc/polkit-1/rules.d/01-org.freedesktop.NetworkManager.settings.modify.system.rules" |
215 |
if [[ -f "${old_rules}" ]]; then |
216 |
case "$(md5sum ${old_rules})" in |
217 |
574d0cfa7e911b1f7792077003060240* ) |
218 |
# Automatically delete the old rules.d file if the user did not change it |
219 |
elog |
220 |
elog "Removing old ${old_rules} ..." |
221 |
rm -f "${old_rules}" || eerror "Failed, please remove ${old_rules} manually" |
222 |
;; |
223 |
* ) |
224 |
elog "The ${old_rules}" |
225 |
elog "file moved to /usr/share/polkit-1/rules.d/ in >=networkmanager-0.9.4.0-r4" |
226 |
elog "If you edited ${old_rules}" |
227 |
elog "without changing its behavior, you may want to remove it." |
228 |
;; |
229 |
esac |
230 |
fi |
231 |
} |