| 1 |
# Copyright 1999-2005 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.2.ebuild,v 1.2 2005/08/26 05:40:23 cardoe Exp $ |
| 4 |
|
| 5 |
inherit eutils linux-info versionator flag-o-matic |
| 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="~x86 ~amd64 ~ia64 ~ppc ~ppc64" |
| 14 |
IUSE="debug pcmcia doc pam_console" |
| 15 |
|
| 16 |
|
| 17 |
### We don't technically "need" pam, but without pam_console, stuff |
| 18 |
### doesn't work (particularly NetworkManager). |
| 19 |
### dep on a specific util-linux version for managed mount patches #70873 |
| 20 |
RDEPEND=">=dev-libs/glib-2.6 |
| 21 |
>=sys-apps/dbus-0.33 |
| 22 |
dev-libs/expat |
| 23 |
>=sys-fs/udev-063 |
| 24 |
sys-apps/hotplug |
| 25 |
>=sys-apps/util-linux-2.12i |
| 26 |
>=sys-kernel/linux-headers-2.6 |
| 27 |
dev-libs/libusb |
| 28 |
pam_console? ( sys-libs/pam )" |
| 29 |
|
| 30 |
DEPEND="${RDEPEND} |
| 31 |
dev-util/pkgconfig |
| 32 |
>=dev-util/intltool-0.29 |
| 33 |
doc? ( app-doc/doxygen )" |
| 34 |
|
| 35 |
## HAL Daemon drops privledges so we need group access to read disks |
| 36 |
HALDAEMON_GROUPS="haldaemon,disk,cdrom,cdrw,floppy" |
| 37 |
|
| 38 |
# We need to run at least a 2.6.10 kernel, this is a |
| 39 |
# way to ensure that to some extent |
| 40 |
pkg_setup() { |
| 41 |
|
| 42 |
linux-info_pkg_setup |
| 43 |
kernel_is ge 2 6 10 \ |
| 44 |
|| die "You need a 2.6.10 or newer kernel to run this package" |
| 45 |
|
| 46 |
if use pam_console && ! built_with_use sys-libs/pam pam_console ; then |
| 47 |
eerror "You need to build pam with pam_console support" |
| 48 |
eerror "Please remerge sys-libs/pam with USE=pam_console" |
| 49 |
die "pam without pam_console detected" |
| 50 |
fi |
| 51 |
|
| 52 |
if [ -d ${D}/etc/hal/device.d ]; then |
| 53 |
eerror "HAL 0.5.x will not run with the HAL 0.4.x series of" |
| 54 |
eerror "/etc/hal/device.d/ so please remove this directory" |
| 55 |
eerror "with rm -rf /etc/hal/device.d/ and then re-emerge." |
| 56 |
eerror "This is due to configuration protection of /etc/" |
| 57 |
die "remove /etc/hal/device.d/" |
| 58 |
fi |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
src_unpack() { |
| 63 |
unpack ${A} |
| 64 |
cd ${S} |
| 65 |
epatch ${FILESDIR}/hal-udev-63.patch |
| 66 |
# remove pamconsole option |
| 67 |
use pam_console || epatch ${FILESDIR}/${PN}-0.5.1-old_storage_policy.patch |
| 68 |
} |
| 69 |
|
| 70 |
src_compile() { |
| 71 |
|
| 72 |
local myconf |
| 73 |
|
| 74 |
# NOTE: fstab-sync dies at an assert() and is deprecated upstream. |
| 75 |
# As such, no need to support it. |
| 76 |
econf \ |
| 77 |
`use_enable debug verbose-mode` \ |
| 78 |
`use_enable pcmcia pcmcia-support` \ |
| 79 |
--enable-sysfs-carrier \ |
| 80 |
--enable-hotplug-map \ |
| 81 |
`use_enable doc docbook-docs` \ |
| 82 |
`use_enable doc doxygen-docs` \ |
| 83 |
--with-pid-file=/var/run/hald.pid \ |
| 84 |
|| die "configure failed" |
| 85 |
|
| 86 |
emake || die "make failed" |
| 87 |
|
| 88 |
} |
| 89 |
|
| 90 |
src_install() { |
| 91 |
|
| 92 |
make DESTDIR=${D} install || die |
| 93 |
|
| 94 |
# We install this in a seperate package to avoid gnome-python dep |
| 95 |
rm ${D}/usr/bin/hal-device-manager |
| 96 |
|
| 97 |
# initscript |
| 98 |
newinitd ${FILESDIR}/0.5-hald.rc hald |
| 99 |
|
| 100 |
dodoc AUTHORS COPYING ChangeLog INSTALL NEWS README |
| 101 |
|
| 102 |
# Script to unmount devices if they are yanked out (from upstream) |
| 103 |
exeinto /etc/dev.d/default |
| 104 |
doexe ${FILESDIR}/hal-unmount.dev |
| 105 |
|
| 106 |
|
| 107 |
} |
| 108 |
|
| 109 |
pkg_postinst() { |
| 110 |
## |
| 111 |
## The old hal ran as root. This was *very* bad because of all the user IO that HAL does. |
| 112 |
## The new hal runs as 'haldaemon', but haldaemon needs to be in the appropriate groups to work. |
| 113 |
## Below is a hack to make this transition (upgrade from previous versions) smooth. |
| 114 |
## We need to add the user/groups *after* package compilation/installation, so that we |
| 115 |
## don't change the user without the package being installed. |
| 116 |
## |
| 117 |
enewgroup haldaemon || die "Problem adding haldaemon group" |
| 118 |
# HAL drops priviledges by default now ... |
| 119 |
# ... so we must make sure it can read disk/cdrom info (ie. be in ${HALDAEMON_GROUPS} groups) |
| 120 |
enewuser haldaemon -1 "-1" /dev/null ${HALDAEMON_GROUPS} || die "Problem adding haldaemon user" |
| 121 |
|
| 122 |
# Make sure that the haldaemon user is in the ${HALDAEMON_GROUPS} |
| 123 |
# If users have a problem with this, let them file a bug |
| 124 |
usermod -G ${HALDAEMON_GROUPS} haldaemon |
| 125 |
|
| 126 |
einfo "The HAL daemon needs to be running for certain applications to" |
| 127 |
einfo "work. Suggested is to add the init script to your start-up" |
| 128 |
einfo "scripts, this should be done like this :" |
| 129 |
einfo "\`rc-update add hald default\`" |
| 130 |
} |