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