From 76b5892ff23bd161388909d3c5605b8cbfb5bdf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Canek=20Pel=C3=A1ez=20Vald=C3=A9s?= Date: Thu, 2 Dec 2010 19:04:31 -0600 Subject: [PATCH] Bluez ebuild with systemd use flag that avoid the installation of rules or scripts that call /etc/init.d scripts. It also contains a working bluetooth.service unit. --- net-wireless/bluez/Manifest | 15 ++ net-wireless/bluez/bluez-4.75.ebuild | 187 +++++++++++++++++++++ net-wireless/bluez/files/4.18/conf.d-hidd | 5 + net-wireless/bluez/files/4.60/bluetooth-conf.d | 7 + net-wireless/bluez/files/4.60/cups-location.patch | 13 ++ net-wireless/bluez/files/bluetooth-conf.d | 7 + net-wireless/bluez/files/bluetooth-init.d | 33 ++++ net-wireless/bluez/files/bluetooth.service | 10 + net-wireless/bluez/files/bluez-4.18-udev.rules | 5 + net-wireless/bluez/files/bluez-4.18-udev.script | 28 +++ net-wireless/bluez/files/bluez-plugdev.patch | 14 ++ net-wireless/bluez/files/conf.d-dund | 4 + net-wireless/bluez/files/init.d-dund | 25 +++ net-wireless/bluez/files/init.d-hidd | 30 ++++ 14 files changed, 383 insertions(+), 0 deletions(-) create mode 100644 net-wireless/bluez/Manifest create mode 100644 net-wireless/bluez/bluez-4.75.ebuild create mode 100644 net-wireless/bluez/files/4.18/conf.d-hidd create mode 100644 net-wireless/bluez/files/4.60/bluetooth-conf.d create mode 100644 net-wireless/bluez/files/4.60/cups-location.patch create mode 100644 net-wireless/bluez/files/bluetooth-conf.d create mode 100644 net-wireless/bluez/files/bluetooth-init.d create mode 100644 net-wireless/bluez/files/bluetooth.service create mode 100644 net-wireless/bluez/files/bluez-4.18-udev.rules create mode 100644 net-wireless/bluez/files/bluez-4.18-udev.script create mode 100755 net-wireless/bluez/files/bluez-plugdev.patch create mode 100644 net-wireless/bluez/files/conf.d-dund create mode 100644 net-wireless/bluez/files/init.d-dund create mode 100644 net-wireless/bluez/files/init.d-hidd diff --git a/net-wireless/bluez/Manifest b/net-wireless/bluez/Manifest new file mode 100644 index 0000000..9553dd1 --- /dev/null +++ b/net-wireless/bluez/Manifest @@ -0,0 +1,15 @@ +AUX 4.18/conf.d-hidd 89 RMD160 31407e00bcb00eb0b9c1adeb7434a922bfb967e9 SHA1 dc6831fa817c8bd2378830e13bc96d3ff3fdffa2 SHA256 8fc50b8c644e0bc69eacef2a9555118b2f4758aafcb42e8ea3ca1293e8f3a211 +AUX 4.60/bluetooth-conf.d 181 RMD160 287e1806e25a4f74b4a9f6fc401b78dac31d44ee SHA1 595f897553a6e99000b4a4757f8973b9f39ce11d SHA256 63a96c907996158f637abc3202235b81e7c8a998df487b3e83554062433dd2f8 +AUX 4.60/cups-location.patch 311 RMD160 25260d0d4c0b28def0ca29dbe4579d582c632a06 SHA1 0e5218280082a2121c7553e79aba9cbb703c9fe0 SHA256 2240f0ce509f323f0b657049140a75fda3d83242b02546d81eeaa1bb3f7c26ec +AUX bluetooth-conf.d 181 RMD160 287e1806e25a4f74b4a9f6fc401b78dac31d44ee SHA1 595f897553a6e99000b4a4757f8973b9f39ce11d SHA256 63a96c907996158f637abc3202235b81e7c8a998df487b3e83554062433dd2f8 +AUX bluetooth-init.d 758 RMD160 eadf94d4c911a19b2031504437465f89c5665192 SHA1 cd7b908dea49bbe0b7cb98662ec9101979905900 SHA256 c80aee8e7ef6973dfdd45130dc1a6dcbc8af917080a2e4a2d71e272c74090922 +AUX bluetooth.service 161 RMD160 27c86e32da67a2c594f62b042850e9ffa52a9a95 SHA1 4447c6c8bc11c5490902f6bee141d2a72e875d32 SHA256 1aa2e08f325d7f7902b61deb2c30c78eeae685003f383a2812720df9f5d972d0 +AUX bluez-4.18-udev.rules 228 RMD160 ab9b4ce8907c62eb9d1f14406cc2ff3f5ec69a19 SHA1 14e652de6cfed28f215727800460e600129007c2 SHA256 7577c2ed295b67f960f17ac65a44889c6536c125b34e33860d6d9f128a59fa82 +AUX bluez-4.18-udev.script 752 RMD160 d8f60749dbe497bef7362a4c3f56b2b83ca079cb SHA1 0c39b4b4f4c57fb334daa793f89c0ffac046b956 SHA256 cb41a4eeea5137fb27d82d74f34e5e7dd725ddf8442c39ea623afe0d3c041fcf +AUX bluez-plugdev.patch 469 RMD160 a70cd0310240491cf14a5a6d7b60e760804e9816 SHA1 b273aac740e7c19aebc441c6c77e0ba8d32f3480 SHA256 ec3f06f24f530574edf5eef308afcf16bb7e0a88336a454a0b24698d2491f5f2 +AUX conf.d-dund 96 RMD160 cf0a59a45f6f1bab134e4aab3545a94dfe094ae0 SHA1 c8d3196d8a917ee5240900af8478bb5adc6c7dea SHA256 fcbf3993c373a71e14557ed35854e839fd7ebf3526f753c83cee07194afca64b +AUX init.d-dund 551 RMD160 273a9fb1989b80f12dc9813e9fe9ca42bd010e33 SHA1 51a24ecdf6d973c09553ed525e97e1cad2d6261f SHA256 e4985a2295d1cd2361b4a6a01b2d474820bf66cb1ff9251742d7aacd0fa574aa +AUX init.d-hidd 780 RMD160 46a761ad2e151c2e1d997a9455edf4e3e4d61df0 SHA1 7d2d80a91517d5fa2965c1ac6078d8cc4f382198 SHA256 b1878d70112fd8fa1b851aaa4caa5e2b4efb55bf8e2dda02c014b55ce93adedb +DIST bluez-4.75.tar.gz 1081608 RMD160 ff1efd6f179fcf506a48f0c3bfef5a1174a9c0ca SHA1 da50e5f5fef2d3f622589395313ed28827d6666b SHA256 fd861de5c966dc563e6a1c34400bb0c0fe1277e37655ab3ce3f48356035f61b8 +DIST oui.txt 2242423 RMD160 3bc6dddb90f1d66403318b38b808b112ff677e32 SHA1 bdccd06d48a9e6b5510f1011c0ec0114e008deda SHA256 3dd21812fb79a965c0dac89a66f7f1362f0d0eabe6e131f1cecc46bf6fe6fa1e +EBUILD bluez-4.75.ebuild 5338 RMD160 776f9a6870193e34677d871debd91e739aafe9c2 SHA1 a69678c4a1efbfc9dc7a72a94bb0976352304836 SHA256 4a78fd7ca565b82ba1db8361acc30052e517058115297e84edd1dc15a7787931 diff --git a/net-wireless/bluez/bluez-4.75.ebuild b/net-wireless/bluez/bluez-4.75.ebuild new file mode 100644 index 0000000..924827a --- /dev/null +++ b/net-wireless/bluez/bluez-4.75.ebuild @@ -0,0 +1,187 @@ + +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/bluez-4.75.ebuild,v 1.5 2010/11/05 12:04:37 fauli Exp $ + +EAPI="2" + +inherit multilib eutils + +DESCRIPTION="Bluetooth Tools and System Daemons for Linux" +HOMEPAGE="http://bluez.sourceforge.net/" +SRC_URI="mirror://kernel/linux/bluetooth/${P}.tar.gz + http://standards.ieee.org/regauth/oui/oui.txt" +LICENSE="GPL-2 LGPL-2.1" +SLOT="0" +KEYWORDS="amd64 arm hppa ~ppc ~ppc64 x86 systemd" + +IUSE="alsa attrib caps +consolekit cups debug gstreamer maemo6 health old-daemons pcmcia pnat test-programs usb systemd" + +CDEPEND="alsa? ( + media-libs/alsa-lib[alsa_pcm_plugins_extplug,alsa_pcm_plugins_ioplug] + ) + caps? ( >=sys-libs/libcap-ng-0.6.2 ) + gstreamer? ( + >=media-libs/gstreamer-0.10 + >=media-libs/gst-plugins-base-0.10 ) + usb? ( dev-libs/libusb ) + cups? ( net-print/cups ) + >=sys-fs/udev-146[extras] + >=dev-libs/glib-2.14 + sys-apps/dbus + media-libs/libsndfile + >=dev-libs/libnl-1.1 + !net-wireless/bluez-libs + !net-wireless/bluez-utils" +DEPEND="sys-devel/flex + >=dev-util/pkgconfig-0.20 + ${CDEPEND}" +RDEPEND="${CDEPEND} + consolekit? ( sys-auth/pambase[consolekit] ) + test-programs? ( + dev-python/dbus-python + dev-python/pygobject )" + +pkg_setup() { + if ! use consolekit; then + enewgroup plugdev + fi +} + +src_prepare() { + if ! use consolekit; then + # No consolekit for at_console etc, so we grant plugdev the rights + epatch "${FILESDIR}/bluez-plugdev.patch" + fi + + if use cups; then + epatch "${FILESDIR}/4.60/cups-location.patch" + fi +} + +src_configure() { + econf \ + $(use_enable caps capng) \ + --enable-network \ + --enable-serial \ + --enable-input \ + --enable-audio \ + --enable-service \ + $(use_enable gstreamer) \ + $(use_enable alsa) \ + $(use_enable usb) \ + --enable-netlink \ + --enable-tools \ + --enable-bccmd \ + --enable-dfutool \ + $(use_enable old-daemons hidd) \ + $(use_enable old-daemons pand) \ + $(use_enable old-daemons dund) \ + $(use_enable attrib) \ + $(use_enable health) \ + $(use_enable pnat) \ + $(use_enable maemo6) \ + $(use_enable cups) \ + $(use_enable test-programs test) \ + --enable-udevrules \ + --enable-configfiles \ + $(use_enable pcmcia) \ + $(use_enable debug) \ + --localstatedir=/var \ + --disable-hal +} + +src_install() { + emake DESTDIR="${D}" install || die "make install failed" + + dodoc AUTHORS ChangeLog README || die + + if use test-programs ; then + cd "${S}/test" + dobin simple-agent simple-service monitor-bluetooth + newbin list-devices list-bluetooth-devices + for b in apitest hsmicro hsplay test-* ; do + newbin "${b}" "bluez-${b}" + done + insinto /usr/share/doc/${PF}/test-services + doins service-* + + cd "${S}" + fi + + if use old-daemons; then + newconfd "${FILESDIR}/4.18/conf.d-hidd" hidd || die + newinitd "${FILESDIR}/init.d-hidd" hidd || die + newconfd "${FILESDIR}/conf.d-dund" dund || die + newinitd "${FILESDIR}/init.d-dund" dund || die + fi + + insinto /etc/bluetooth + doins \ + input/input.conf \ + audio/audio.conf \ + network/network.conf \ + serial/serial.conf \ + || die + + if ! use systemd; then + insinto /etc/udev/rules.d/ + newins "${FILESDIR}/${PN}-4.18-udev.rules" 70-bluetooth.rules || die + exeinto /$(get_libdir)/udev/ + newexe "${FILESDIR}/${PN}-4.18-udev.script" bluetooth.sh || die + else + insinto /lib/systemd/system/ + newins "${FILESDIR}/bluetooth.service" bluetooth.service + fi + + newinitd "${FILESDIR}/bluetooth-init.d" bluetooth || die + newconfd "${FILESDIR}/4.60/bluetooth-conf.d" bluetooth || die + + # Install oui.txt as requested in bug #283791 and approved by upstream + insinto /var/lib/misc + doins "${DISTDIR}/oui.txt" || die +} + +pkg_postinst() { + udevadm control --reload-rules && udevadm trigger --subsystem-match=bluetooth + + if ! has_version "net-dialup/ppp"; then + elog + elog "To use dial up networking you must install net-dialup/ppp." + fi + + if ! has_version "net-wireless/gnome-bluetooth" && ! has_version "net-wireless/kbluetooth"; then + elog + elog "For desktop integration you can try net-wireless/gnome-bluetooth" + elog "for gnome and net-wireless/kbluetooth for kde." + fi + + if ! use old-daemons; then + elog + elog "Use the old-daemons use flag to get the old daemons like hidd or pand" + elog "installed. Please note that 'bluetooth' init script doesn't stop the old" + elog "daemons after you update it, so it's recommended to stop all of them using" + elog "their own init scripts or manually killing them." + fi + + if use consolekit; then + elog + elog "If you want to use rfcomm as a normal user, you need to add the user" + elog "to the uucp group." + else + elog + elog "Since you have the consolekit use flag disabled, you will only be able to run" + elog "bluetooth clients as root. If you want to be able to run bluetooth clientes as " + elog "a regular user, you need to enable the consolekit use flag for this package or" + elog "to add the user to the plugdev group." + fi + + if use old-daemons; then + elog + elog "dund and hidd init scripts were installed because you have the old-daemons" + elog "use flag on. They are not started by default via udev so please add them" + elog "to the required runlevels using rc-update add . If" + elog "you need init scripts for the other daemons, please file requests" + elog "to https://bugs.gentoo.org." + fi +} diff --git a/net-wireless/bluez/files/4.18/conf.d-hidd b/net-wireless/bluez/files/4.18/conf.d-hidd new file mode 100644 index 0000000..1677ef0 --- /dev/null +++ b/net-wireless/bluez/files/4.18/conf.d-hidd @@ -0,0 +1,5 @@ +# Bluetooth hidd daemon configuraton file + +# Arguments to hidd +HIDD_OPTIONS="--encrypt" + diff --git a/net-wireless/bluez/files/4.60/bluetooth-conf.d b/net-wireless/bluez/files/4.60/bluetooth-conf.d new file mode 100644 index 0000000..b0cc744 --- /dev/null +++ b/net-wireless/bluez/files/4.60/bluetooth-conf.d @@ -0,0 +1,7 @@ +# Bluetooth configuraton file + +# Bind rfcomm devices (allowed values are "true" and "false") +RFCOMM_ENABLE=true + +# Config file for rfcomm +RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf" diff --git a/net-wireless/bluez/files/4.60/cups-location.patch b/net-wireless/bluez/files/4.60/cups-location.patch new file mode 100644 index 0000000..66ed8dc --- /dev/null +++ b/net-wireless/bluez/files/4.60/cups-location.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.tools b/Makefile.tools +index d9a2425..a382e05 100644 +--- a/Makefile.tools ++++ b/Makefile.tools +@@ -122,7 +122,7 @@ EXTRA_DIST += tools/dfubabel.1 tools/avctrl.8 + + + if CUPS +-cupsdir = $(libdir)/cups/backend ++cupsdir = `cups-config --serverbin`/backend + + cups_PROGRAMS = cups/bluetooth + diff --git a/net-wireless/bluez/files/bluetooth-conf.d b/net-wireless/bluez/files/bluetooth-conf.d new file mode 100644 index 0000000..b0cc744 --- /dev/null +++ b/net-wireless/bluez/files/bluetooth-conf.d @@ -0,0 +1,7 @@ +# Bluetooth configuraton file + +# Bind rfcomm devices (allowed values are "true" and "false") +RFCOMM_ENABLE=true + +# Config file for rfcomm +RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf" diff --git a/net-wireless/bluez/files/bluetooth-init.d b/net-wireless/bluez/files/bluetooth-init.d new file mode 100644 index 0000000..6e19ffb --- /dev/null +++ b/net-wireless/bluez/files/bluetooth-init.d @@ -0,0 +1,33 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/bluetooth-init.d,v 1.1 2010/09/07 11:00:27 pacho Exp $ + +depend() { + after coldplug + need dbus localmount +} + +start() { + ebegin "Starting Bluetooth" + + udevadm trigger --subsystem-match=bluetooth --action=add + eend $? + + if [ "${RFCOMM_ENABLE}" = "true" -a -x /usr/bin/rfcomm ]; then + if [ -f "${RFCOMM_CONFIG}" ]; then + eindent + ebegin "Starting rfcomm" + /usr/bin/rfcomm -f "${RFCOMM_CONFIG}" bind all + eoutdent + eend $? + else + ewarn "Not enabling rfcomm because RFCOMM_CONFIG does not exists" + fi + fi +} + +stop() { + ebegin "Shutting down Bluetooth" + eend 0 +} diff --git a/net-wireless/bluez/files/bluetooth.service b/net-wireless/bluez/files/bluetooth.service new file mode 100644 index 0000000..a344dee --- /dev/null +++ b/net-wireless/bluez/files/bluetooth.service @@ -0,0 +1,10 @@ +[Unit] +Description=Bluetooth +After=NetworkManager.service + +[Service] +Type=simple +ExecStart=/usr/sbin/bluetoothd --nodetach + +[Install] +WantedBy=graphical.target diff --git a/net-wireless/bluez/files/bluez-4.18-udev.rules b/net-wireless/bluez/files/bluez-4.18-udev.rules new file mode 100644 index 0000000..b3ccd5b --- /dev/null +++ b/net-wireless/bluez/files/bluez-4.18-udev.rules @@ -0,0 +1,5 @@ +# Start/Stop bluetooth service on device insertion. Gentoo specific. +SUBSYSTEM=="bluetooth", KERNEL=="hci[0-9]*", RUN+="bluetooth.sh" + +# So that normal users can dial out. +SUBSYSTEM=="tty", SUBSYSTEMS=="bluetooth", GROUP="uucp" diff --git a/net-wireless/bluez/files/bluez-4.18-udev.script b/net-wireless/bluez/files/bluez-4.18-udev.script new file mode 100644 index 0000000..a532e26 --- /dev/null +++ b/net-wireless/bluez/files/bluez-4.18-udev.script @@ -0,0 +1,28 @@ +#!/bin/sh +# +# bluetooth.sh: udev external RUN script +# +# Copyright: +# 2005-2006 Henrik Brix Andersen +# 2007 Petteri Räty +# 2008 Tiziano Müller +# Distributed under the terms of the GNU General Public License v2 + +script=/etc/init.d/bluetooth + +# Find out where sysfs is mounted. Exit if not available +sysfs=`grep -F sysfs /proc/mounts | awk '{print $2}'` +if [ "$sysfs" = "" ]; then + echo "sysfs is required" + exit 1 +fi + +if [ ! -d $sysfs/class/bluetooth/hci[0-9]* -a ! -d $sysfs/bus/bluetooth/devices/hci[0-9]* ]; then + if $script --quiet status; then + IN_HOTPLUG=1 $script --quiet stop + fi +else + if ! $script --quiet status; then + IN_HOTPLUG=1 $script --quiet start + fi +fi diff --git a/net-wireless/bluez/files/bluez-plugdev.patch b/net-wireless/bluez/files/bluez-plugdev.patch new file mode 100755 index 0000000..726838a --- /dev/null +++ b/net-wireless/bluez/files/bluez-plugdev.patch @@ -0,0 +1,14 @@ +diff -Nurp bluez-4.39.orig/src/bluetooth.conf bluez-4.39/src/bluetooth.conf +--- bluez-4.39.orig/src/bluetooth.conf 2008-12-20 20:18:10.000000000 +0100 ++++ bluez-4.39/src/bluetooth.conf 2009-09-05 13:30:34.411581498 +0200 +@@ -17,6 +17,10 @@ + + + ++ ++ ++ ++ + + + diff --git a/net-wireless/bluez/files/conf.d-dund b/net-wireless/bluez/files/conf.d-dund new file mode 100644 index 0000000..a199fc7 --- /dev/null +++ b/net-wireless/bluez/files/conf.d-dund @@ -0,0 +1,4 @@ +# Bluetooth DUN daemon configuraton file + +# Arguments to dund +DUND_OPTIONS="--search --persist" diff --git a/net-wireless/bluez/files/init.d-dund b/net-wireless/bluez/files/init.d-dund new file mode 100644 index 0000000..c8c8663 --- /dev/null +++ b/net-wireless/bluez/files/init.d-dund @@ -0,0 +1,25 @@ +#!/sbin/runscript +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/init.d-dund,v 1.1 2010/09/24 21:32:51 pacho Exp $ + +depend() { + need bluetooth +} + +start() { + local result service + + ebegin "Starting dund" + start-stop-daemon --start --quiet \ + --exec /usr/bin/dund -- ${DUND_OPTIONS} + result="$?" + eend ${result} +} + +stop() { + ebegin "Stopping dund" + /usr/bin/dund -K + start-stop-daemon --stop --quiet --exec /usr/bin/dund + eend $? +} diff --git a/net-wireless/bluez/files/init.d-hidd b/net-wireless/bluez/files/init.d-hidd new file mode 100644 index 0000000..39399a9 --- /dev/null +++ b/net-wireless/bluez/files/init.d-hidd @@ -0,0 +1,30 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/init.d-hidd,v 1.1 2010/09/07 11:00:27 pacho Exp $ + +depend() { + need bluetooth +} + +start() { + local result service + + ebegin "Starting hidd" + start-stop-daemon --start --quiet \ + --exec /usr/bin/hidd -- ${HIDD_OPTIONS} --server + result="$?" + service="/etc/bluetooth/input.service" + if [ ${result} -ne 0 ] && grep -q "Autostart=true" "${service}"; then + eerror "You have Autostart=true in ${service}." + eerror "Change this to false if you want to use hidd." + fi + eend ${result} +} + +stop() { + ebegin "Stopping hidd" + hidd --killall + start-stop-daemon --stop --quiet --exec /usr/bin/hidd + eend $? +} -- 1.7.2.2