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.8.6.ebuild,v 1.3 2013/10/12 14:11:18 ikelos Exp $ |
4 |
|
5 |
EAPI="5" |
6 |
GNOME_ORG_MODULE="NetworkManager" |
7 |
VALA_MIN_API_VERSION="0.18" |
8 |
VALA_USE_DEPEND="vapigen" |
9 |
|
10 |
inherit bash-completion-r1 gnome.org linux-info systemd user readme.gentoo toolchain-funcs vala virtualx udev eutils |
11 |
|
12 |
DESCRIPTION="Universal network configuration daemon for laptops, desktops, servers and virtualization hosts" |
13 |
HOMEPAGE="http://projects.gnome.org/NetworkManager/" |
14 |
|
15 |
LICENSE="GPL-2+" |
16 |
SLOT="0" # add subslot if libnm-util.so.2 or libnm-glib.so.4 bumps soname version |
17 |
IUSE="avahi bluetooth connection-sharing consolekit dhclient +dhcpcd gnutls +introspection kernel_linux +nss modemmanager +ppp resolvconf systemd test vala +wext" # wimax |
18 |
|
19 |
KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~ppc64 ~sparc ~x86" |
20 |
|
21 |
REQUIRED_USE=" |
22 |
modemmanager? ( ppp ) |
23 |
^^ ( nss gnutls ) |
24 |
^^ ( dhclient dhcpcd ) |
25 |
" |
26 |
|
27 |
# gobject-introspection-0.10.3 is needed due to gnome bug 642300 |
28 |
# wpa_supplicant-0.7.3-r3 is needed due to bug 359271 |
29 |
# TODO: Qt support? |
30 |
COMMON_DEPEND=" |
31 |
>=sys-apps/dbus-1.2 |
32 |
>=dev-libs/dbus-glib-0.94 |
33 |
>=dev-libs/glib-2.30 |
34 |
>=dev-libs/libnl-3.2.7:3= |
35 |
>=sys-auth/polkit-0.106 |
36 |
>=net-libs/libsoup-2.26:2.4= |
37 |
>=net-wireless/wpa_supplicant-0.7.3-r3[dbus] |
38 |
>=virtual/udev-165[gudev] |
39 |
bluetooth? ( >=net-wireless/bluez-4.82 ) |
40 |
avahi? ( net-dns/avahi:=[autoipd] ) |
41 |
connection-sharing? ( |
42 |
net-dns/dnsmasq[dhcp] |
43 |
net-firewall/iptables ) |
44 |
gnutls? ( |
45 |
dev-libs/libgcrypt:= |
46 |
net-libs/gnutls:= ) |
47 |
modemmanager? ( >=net-misc/modemmanager-0.7.991 ) |
48 |
nss? ( >=dev-libs/nss-3.11:= ) |
49 |
dhclient? ( =net-misc/dhcp-4*[client] ) |
50 |
dhcpcd? ( >=net-misc/dhcpcd-4.0.0_rc3 ) |
51 |
introspection? ( >=dev-libs/gobject-introspection-0.10.3 ) |
52 |
ppp? ( >=net-dialup/ppp-2.4.5[ipv6] ) |
53 |
resolvconf? ( net-dns/openresolv ) |
54 |
systemd? ( >=sys-apps/systemd-183 ) |
55 |
|| ( sys-power/upower >=sys-apps/systemd-183 ) |
56 |
" |
57 |
RDEPEND="${COMMON_DEPEND} |
58 |
consolekit? ( sys-auth/consolekit ) |
59 |
" |
60 |
DEPEND="${COMMON_DEPEND} |
61 |
dev-util/gtk-doc-am |
62 |
>=dev-util/intltool-0.40 |
63 |
>=sys-devel/gettext-0.17 |
64 |
>=sys-kernel/linux-headers-2.6.29 |
65 |
virtual/pkgconfig |
66 |
vala? ( $(vala_depend) ) |
67 |
test? ( |
68 |
dev-lang/python:2.7 |
69 |
dev-python/dbus-python[python_targets_python2_7] |
70 |
dev-python/pygobject:2[python_targets_python2_7] ) |
71 |
" |
72 |
|
73 |
sysfs_deprecated_check() { |
74 |
ebegin "Checking for SYSFS_DEPRECATED support" |
75 |
|
76 |
if { linux_chkconfig_present SYSFS_DEPRECATED_V2; }; then |
77 |
eerror "Please disable SYSFS_DEPRECATED_V2 support in your kernel config and recompile your kernel" |
78 |
eerror "or NetworkManager will not work correctly." |
79 |
eerror "See http://bugs.gentoo.org/333639 for more info." |
80 |
die "CONFIG_SYSFS_DEPRECATED_V2 support detected!" |
81 |
fi |
82 |
eend $? |
83 |
} |
84 |
|
85 |
pkg_pretend() { |
86 |
if use kernel_linux; then |
87 |
get_version |
88 |
if linux_config_exists; then |
89 |
sysfs_deprecated_check |
90 |
else |
91 |
ewarn "Was unable to determine your kernel .config" |
92 |
ewarn "Please note that if CONFIG_SYSFS_DEPRECATED_V2 is set in your kernel .config, NetworkManager will not work correctly." |
93 |
ewarn "See http://bugs.gentoo.org/333639 for more info." |
94 |
fi |
95 |
|
96 |
fi |
97 |
} |
98 |
|
99 |
pkg_setup() { |
100 |
enewgroup plugdev |
101 |
} |
102 |
|
103 |
src_prepare() { |
104 |
DOC_CONTENTS="To modify system network connections without needing to enter the |
105 |
root password, add your user account to the 'plugdev' group." |
106 |
|
107 |
# Bug #402085, https://bugzilla.gnome.org/show_bug.cgi?id=387832 |
108 |
epatch "${FILESDIR}/${PN}-0.9.8.4-pre-sleep.patch" |
109 |
|
110 |
# Use python2.7 shebangs for test scripts |
111 |
sed -e 's@\(^#!.*python\)@\12.7@' \ |
112 |
-i */tests/*.py || die |
113 |
|
114 |
# Fix completiondir, avoid eautoreconf, bug #465100 |
115 |
sed -i "s|^completiondir =.*|completiondir = $(get_bashcompdir)|" \ |
116 |
cli/completion/Makefile.in || die "sed completiondir failed" |
117 |
|
118 |
## Force use of /run, avoid eautoreconf |
119 |
sed -e 's:$localstatedir/run/:/run/:' -i configure || die |
120 |
|
121 |
use vala && vala_src_prepare |
122 |
|
123 |
epatch_user # don't remove, users often want custom patches for NM |
124 |
} |
125 |
|
126 |
src_configure() { |
127 |
# TODO: enable wimax when we have a libnl:3 compatible revision of it |
128 |
# We are not ready for bluez5 yet |
129 |
econf \ |
130 |
--enable-bluez4 \ |
131 |
--disable-more-warnings \ |
132 |
--disable-static \ |
133 |
--localstatedir=/var \ |
134 |
$(usex systemd '--disable-ifnet' '--enable-ifnet') \ |
135 |
--without-netconfig \ |
136 |
--with-dbus-sys-dir=/etc/dbus-1/system.d \ |
137 |
--with-udev-dir="$(udev_get_udevdir)" \ |
138 |
--with-iptables=/sbin/iptables \ |
139 |
--enable-concheck \ |
140 |
--with-crypto=$(usex nss nss gnutls) \ |
141 |
--with-session-tracking=$(usex systemd systemd $(usex consolekit consolekit no)) \ |
142 |
--with-suspend-resume=$(usex systemd systemd upower) \ |
143 |
$(use_enable introspection) \ |
144 |
$(use_enable ppp) \ |
145 |
--disable-wimax \ |
146 |
$(use_with dhclient) \ |
147 |
$(use_with dhcpcd) \ |
148 |
$(use_with modemmanager modem-manager-1) \ |
149 |
$(use_with resolvconf) \ |
150 |
$(use_enable test tests) \ |
151 |
$(use_enable vala) \ |
152 |
$(use_with wext) \ |
153 |
"$(systemd_with_unitdir)" |
154 |
} |
155 |
|
156 |
src_test() { |
157 |
# bug #???? |
158 |
cp libnm-util/tests/certs/test_ca_cert.pem src/settings/plugins/ifnet/tests/ || die |
159 |
Xemake check |
160 |
} |
161 |
|
162 |
src_install() { |
163 |
default |
164 |
|
165 |
readme.gentoo_create_doc |
166 |
|
167 |
# Gentoo init script |
168 |
newinitd "${FILESDIR}/init.d.NetworkManager" NetworkManager |
169 |
|
170 |
# /var/run/NetworkManager is used by some distros, but not by Gentoo |
171 |
rmdir -v "${ED}/var/run/NetworkManager" || die "rmdir failed" |
172 |
|
173 |
# Need to keep the /etc/NetworkManager/dispatched.d for dispatcher scripts |
174 |
keepdir /etc/NetworkManager/dispatcher.d |
175 |
|
176 |
# Provide openrc net dependency only when nm is connected |
177 |
exeinto /etc/NetworkManager/dispatcher.d |
178 |
newexe "${FILESDIR}/10-openrc-status-r4" 10-openrc-status |
179 |
sed -e "s:@EPREFIX@:${EPREFIX}:g" \ |
180 |
-i "${ED}/etc/NetworkManager/dispatcher.d/10-openrc-status" || die |
181 |
|
182 |
# Default conf.d file |
183 |
newconfd "${FILESDIR}/conf.d.NetworkManager" NetworkManager |
184 |
|
185 |
# Add keyfile plugin support |
186 |
keepdir /etc/NetworkManager/system-connections |
187 |
chmod 0600 "${ED}"/etc/NetworkManager/system-connections/.keep* # bug #383765 |
188 |
|
189 |
if ! use systemd; then |
190 |
insinto /etc/NetworkManager |
191 |
newins "${FILESDIR}/nm-system-settings.conf-ifnet" NetworkManager.conf |
192 |
fi |
193 |
|
194 |
# Allow users in plugdev group to modify system connections |
195 |
insinto /usr/share/polkit-1/rules.d/ |
196 |
doins "${FILESDIR}/01-org.freedesktop.NetworkManager.settings.modify.system.rules" |
197 |
|
198 |
prune_libtool_files --modules |
199 |
} |
200 |
|
201 |
pkg_postinst() { |
202 |
readme.gentoo_print_elog |
203 |
|
204 |
if [[ -e "${EROOT}etc/NetworkManager/nm-system-settings.conf" ]]; then |
205 |
ewarn "The ${PN} system configuration file has moved to a new location." |
206 |
ewarn "You must migrate your settings from ${EROOT}/etc/NetworkManager/nm-system-settings.conf" |
207 |
ewarn "to ${EROOT}etc/NetworkManager/NetworkManager.conf" |
208 |
ewarn |
209 |
ewarn "After doing so, you can remove ${EROOT}etc/NetworkManager/nm-system-settings.conf" |
210 |
fi |
211 |
|
212 |
# The polkit rules file moved to /usr/share |
213 |
old_rules="${EROOT}etc/polkit-1/rules.d/01-org.freedesktop.NetworkManager.settings.modify.system.rules" |
214 |
if [[ -f "${old_rules}" ]]; then |
215 |
case "$(md5sum ${old_rules})" in |
216 |
574d0cfa7e911b1f7792077003060240* ) |
217 |
# Automatically delete the old rules.d file if the user did not change it |
218 |
elog |
219 |
elog "Removing old ${old_rules} ..." |
220 |
rm -f "${old_rules}" || eerror "Failed, please remove ${old_rules} manually" |
221 |
;; |
222 |
* ) |
223 |
elog "The ${old_rules}" |
224 |
elog "file moved to /usr/share/polkit-1/rules.d/ in >=networkmanager-0.9.4.0-r4" |
225 |
elog "If you edited ${old_rules}" |
226 |
elog "without changing its behavior, you may want to remove it." |
227 |
;; |
228 |
esac |
229 |
fi |
230 |
|
231 |
if use systemd; then |
232 |
if [[ ${REPLACING_VERSIONS} < 0.9.8.6 ]]; then |
233 |
ewarn "Ifnet plugin won't be used with systemd support enabled" |
234 |
ewarn "as it is meant to be used with openRC and can cause collisions" |
235 |
ewarn "(like bug #485658)." |
236 |
ewarn "Because of this, you will likely need to reintroduce passwords" |
237 |
ewarn "for your used routers." |
238 |
fi |
239 |
|
240 |
if [[ -e "${EROOT}etc/NetworkManager/NetworkManager.conf" ]]; then |
241 |
if grep -q plugins | grep -q ifnet "${EROOT}etc/NetworkManager/NetworkManager.conf"; then |
242 |
ewarn "You seem to use 'ifnet' plugin in ${EROOT}etc/NetworkManager/NetworkManager.conf" |
243 |
ewarn "Since it won't be used when running under Systemd, you will need to stop setting" |
244 |
ewarn "ifnet plugin there to allow NetworkManager to work." |
245 |
fi |
246 |
fi |
247 |
fi |
248 |
} |