1 |
# Copyright 1999-2006 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/sys-apps/hal/hal-0.5.7-r2.ebuild,v 1.2 2006/05/28 06:55:08 cardoe Exp $ |
4 |
|
5 |
inherit eutils linux-info debug |
6 |
|
7 |
DESCRIPTION="Hardware Abstraction Layer" |
8 |
HOMEPAGE="http://www.freedesktop.org/Software/hal" |
9 |
SRC_URI="http://freedesktop.org/~david/dist/${P}.tar.gz" |
10 |
|
11 |
LICENSE="|| ( GPL-2 AFL-2.0 )" |
12 |
SLOT="0" |
13 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86" |
14 |
IUSE="acpi crypt debug doc dmi pcmcia selinux" |
15 |
|
16 |
RDEPEND=">=dev-libs/glib-2.6 |
17 |
>=sys-apps/dbus-0.60 |
18 |
>=sys-fs/udev-078 |
19 |
>=sys-apps/util-linux-2.12r |
20 |
|| ( >=sys-kernel/linux-headers-2.6 >=sys-kernel/mips-headers-2.6 ) |
21 |
dev-libs/expat |
22 |
sys-libs/libcap |
23 |
sys-apps/pciutils |
24 |
dev-libs/libusb |
25 |
sys-apps/hotplug |
26 |
dmi? ( >=sys-apps/dmidecode-2.7 ) |
27 |
crypt? ( >=sys-fs/cryptsetup-luks-1.0.1 ) |
28 |
selinux? ( sys-libs/libselinux )" |
29 |
|
30 |
DEPEND="${RDEPEND} |
31 |
dev-util/pkgconfig |
32 |
>=dev-util/intltool-0.29 |
33 |
doc? ( app-doc/doxygen app-text/docbook-sgml-utils )" |
34 |
|
35 |
## HAL Daemon drops privledges so we need group access to read disks |
36 |
HALDAEMON_GROUPS="haldaemon,plugdev,disk,cdrom,cdrw,floppy,usb" |
37 |
|
38 |
function notify_uevent() { |
39 |
eerror |
40 |
eerror "You must enable Kernel Userspace Events in your kernel." |
41 |
eerror "This can be set under 'General Setup'. It is marked as" |
42 |
eerror "CONFIG_KOBJECT_UEVENT in the config file." |
43 |
eerror |
44 |
ebeep 5 |
45 |
} |
46 |
|
47 |
function notify_uevent_2_6_16() { |
48 |
eerror |
49 |
eerror "You must enable Kernel Userspace Events in your kernel." |
50 |
eerror "For this you need to enable 'Hotplug' under 'General Setup' and" |
51 |
eerror "basic networking. They are marked CONFIG_HOTPLUG and CONFIG_NET" |
52 |
eerror "in the config file." |
53 |
eerror |
54 |
ebeep 5 |
55 |
} |
56 |
|
57 |
function notify_procfs() { |
58 |
eerror |
59 |
eerror "You must enable the proc filesystem in your kernel." |
60 |
eerror "For this you need to enable '/proc file system support' under" |
61 |
eerror "'Pseudo filesystems' in 'File systems'. It is marked" |
62 |
eerror "CONFIG_PROC_FS in the config file." |
63 |
eerror |
64 |
ebeep 5 |
65 |
} |
66 |
|
67 |
pkg_setup() { |
68 |
linux-info_pkg_setup |
69 |
|
70 |
kernel_is ge 2 6 15 || die "HAL requires a kernel version 2.6.15 or newer" |
71 |
|
72 |
if kernel_is lt 2 6 16 ; then |
73 |
linux_chkconfig_present KOBJECT_UEVENT || notify_uevent |
74 |
else |
75 |
(linux_chkconfig_present HOTPLUG && linux_chkconfig_present NET) \ |
76 |
|| notify_uevent_2_6_16 |
77 |
fi |
78 |
|
79 |
if use acpi ; then |
80 |
linux_chkconfig_present PROC_FS || notify_procfs |
81 |
fi |
82 |
|
83 |
if [ -d ${ROOT}/etc/hal/device.d ]; then |
84 |
eerror "HAL 0.5.x will not run with the HAL 0.4.x series of" |
85 |
eerror "/etc/hal/device.d/ so please remove this directory" |
86 |
eerror "with rm -rf /etc/hal/device.d/ and then re-emerge." |
87 |
eerror "This is due to configuration protection of /etc/" |
88 |
die "remove /etc/hal/device.d/" |
89 |
fi |
90 |
} |
91 |
|
92 |
src_unpack() { |
93 |
unpack ${A} |
94 |
cd "${S}" |
95 |
|
96 |
# sony screen brightness patch |
97 |
# epatch "${FILESDIR}"/${PN}-0.5.7-sony-brightness.patch |
98 |
|
99 |
# handle ignored volumes properly |
100 |
epatch "${FILESDIR}"/${PN}-0.5.7-ignored-volumes.patch |
101 |
|
102 |
# Fix bash in hald scripts |
103 |
epatch "${FILESDIR}"/${PN}-0.5.7-hald-scripts.patch |
104 |
|
105 |
# probe partition table |
106 |
epatch "${FILESDIR}"/${PN}-0.5.7-part-table.patch |
107 |
|
108 |
# fix pmu support crash |
109 |
epatch "${FILESDIR}"/${PN}-0.5.7-pmu-fix.patch |
110 |
|
111 |
# unclean unmount |
112 |
epatch "${FILESDIR}"/${PN}-0.5.7-unclean-unmount-r1.patch |
113 |
|
114 |
# allow plugdev group people to mount |
115 |
epatch "${FILESDIR}"/${PN}-0.5.7-plugdev-allow-send.patch |
116 |
|
117 |
# rescan devices on resume |
118 |
epatch "${FILESDIR}"/${PN}-0.5.7-rescan-on-resume.patch |
119 |
|
120 |
# detect hibernate-ram script as well |
121 |
epatch "${FILESDIR}"/${PN}-0.5.7-hibernate.patch |
122 |
} |
123 |
|
124 |
src_compile() { |
125 |
econf \ |
126 |
--with-doc-dir=/usr/share/doc/${PF} \ |
127 |
--with-os-type=gentoo \ |
128 |
--with-pid-file=/var/run/hald.pid \ |
129 |
--enable-hotplug-map \ |
130 |
$(use_enable debug verbose-mode) \ |
131 |
$(use_enable pcmcia pcmcia-support) \ |
132 |
$(use_enable acpi acpi-proc) \ |
133 |
$(use_enable doc docbook-docs) \ |
134 |
$(use_enable doc doxygen-docs) \ |
135 |
$(use_enable selinux) \ |
136 |
|| die "configure failed" |
137 |
|
138 |
emake || die "make failed" |
139 |
} |
140 |
|
141 |
src_install() { |
142 |
make DESTDIR="${D}" install || die |
143 |
dodoc AUTHORS ChangeLog NEWS README |
144 |
|
145 |
# remove dep on gnome-python |
146 |
mv "${D}"/usr/bin/hal-device-manager "${D}"/usr/share/hal/device-manager/ |
147 |
|
148 |
# hal umount for unclean unmounts |
149 |
exeinto /lib/udev/ |
150 |
newexe "${FILESDIR}"/hal-unmount.dev hal_unmount |
151 |
|
152 |
# initscript |
153 |
newinitd "${FILESDIR}"/0.5-hald.rc hald |
154 |
|
155 |
# Script to unmount devices if they are yanked out (from upstream) |
156 |
exeinto /etc/dev.d/default |
157 |
doexe "${FILESDIR}"/hal-unmount.dev |
158 |
|
159 |
# We now create and keep /media here as both gnome-mount and pmount |
160 |
# use these directories, to avoid collision. |
161 |
dodir /media |
162 |
keepdir /media |
163 |
} |
164 |
|
165 |
pkg_postinst() { |
166 |
# Despite what people keep changing this location. Either one works.. it doesn't matter |
167 |
# http://dev.gentoo.org/~plasmaroo/devmanual/ebuild-writing/functions/ |
168 |
|
169 |
# Create groups for hotplugging and HAL |
170 |
enewgroup haldaemon || die "Problem adding haldaemon group" |
171 |
enewgroup plugdev || die "Problem adding plugdev group" |
172 |
|
173 |
# HAL drops priviledges by default now ... |
174 |
# ... so we must make sure it can read disk/cdrom info (ie. be in ${HALDAEMON_GROUPS} groups) |
175 |
enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS} || die "Problem adding haldaemon user" |
176 |
|
177 |
# Make sure that the haldaemon user is in the ${HALDAEMON_GROUPS} |
178 |
# If users have a problem with this, let them file a bug |
179 |
usermod -G ${HALDAEMON_GROUPS} haldaemon |
180 |
|
181 |
einfo "The HAL daemon needs to be running for certain applications to" |
182 |
einfo "work. Suggested is to add the init script to your start-up" |
183 |
einfo "scripts, this should be done like this :" |
184 |
einfo "\`rc-update add hald default\`" |
185 |
echo |
186 |
einfo "Looking for automounting support? Add yourself to the plugdev group" |
187 |
} |