From 9de2cb23a53166a404fdca973bc9a46bcc904e17 Mon Sep 17 00:00:00 2001 From: Ralph Moritz Date: Tue, 11 May 2010 15:18:33 +0200 Subject: system/bluez-utils: Initial import --- system/bluez-utils/README | 7 ++ system/bluez-utils/bluez-utils.SlackBuild | 91 ++++++++++++++++++++++++ system/bluez-utils/bluez-utils.info | 8 +++ system/bluez-utils/doinst.sh | 19 +++++ system/bluez-utils/rc.bluetooth.new | 114 ++++++++++++++++++++++++++++++ system/bluez-utils/slack-desc | 11 +++ 6 files changed, 250 insertions(+) create mode 100644 system/bluez-utils/README create mode 100644 system/bluez-utils/bluez-utils.SlackBuild create mode 100644 system/bluez-utils/bluez-utils.info create mode 100644 system/bluez-utils/doinst.sh create mode 100644 system/bluez-utils/rc.bluetooth.new create mode 100644 system/bluez-utils/slack-desc diff --git a/system/bluez-utils/README b/system/bluez-utils/README new file mode 100644 index 0000000000..06a471e663 --- /dev/null +++ b/system/bluez-utils/README @@ -0,0 +1,7 @@ +Bluetooth utilities + +These are the official Linux bluetooth utilities. + +You will need to have the bluez-libs and dbus packages +installed to build this. + diff --git a/system/bluez-utils/bluez-utils.SlackBuild b/system/bluez-utils/bluez-utils.SlackBuild new file mode 100644 index 0000000000..f229e56dc7 --- /dev/null +++ b/system/bluez-utils/bluez-utils.SlackBuild @@ -0,0 +1,91 @@ +#!/bin/sh + +# Slackware build script for bluez-utils + +# Copyright (C) 2007 by Ralph Moritz +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Modified by the SlackBuilds.org project + +APP=bluez-utils +PKG_APP=bluez_utils # Hyphens aren't acceptable +VERSION=3.9 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PKG_APP +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" +fi + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +rm -rf $TMP/$APP-$VERSION +cd $TMP || exit 1 +tar vzxf $CWD/$APP-$VERSION.tar.gz || exit 1 +cd $APP-$VERSION || exit 1 +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --libexecdir=/lib \ + || exit 1 + +make || exit 1 +make install-strip DESTDIR=$PKG || exit 1 + +mkdir -p $PKG/usr/doc/$PKG_APP-$VERSION +cp -a ChangeLog README INSTALL COPYING AUTHORS $PKG/usr/doc/$PKG_APP-$VERSION +cp $CWD/$APP.SlackBuild $PKG/usr/doc/$PKG_APP-$VERSION +find $PKG/usr/doc/$PKG_APP-$VERSION -type f -exec chmod 0644 {} \; + +if [ -d $PKG/usr/man ]; then + ( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; + for i in $(find . -type l) ; do + ln -s $(readlink $i).gz $i.gz && rm $i; + done + ) +fi + +# Install custom init script +install -D -m 0755 $CWD/rc.bluetooth.new $PKG/etc/rc.d/rc.bluetooth.new + +# Don't clobber existing config files +mv $PKG/etc/bluetooth/hcid.conf $PKG/etc/bluetooth/hcid.conf.new +mv $PKG/etc/bluetooth/rfcomm.conf $PKG/etc/bluetooth/rfcomm.conf.new + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PKG_APP-$VERSION-$ARCH-$BUILD$TAG.tgz diff --git a/system/bluez-utils/bluez-utils.info b/system/bluez-utils/bluez-utils.info new file mode 100644 index 0000000000..f71e784fc0 --- /dev/null +++ b/system/bluez-utils/bluez-utils.info @@ -0,0 +1,8 @@ +PRGNAM="bluez-utils" +VERSION="3.9" +HOMEPAGE="http://www.bluez.org" +DOWNLOAD="http://bluez.sourceforge.net/download/bluez-utils-3.9.tar.gz" +MD5SUM="023a5e6a436f86a28baeec91e4c62736" +MAINTAINER="Ralph Moritz" +EMAIL="me@ralphm.info" +APPROVED="rworkman" diff --git a/system/bluez-utils/doinst.sh b/system/bluez-utils/doinst.sh new file mode 100644 index 0000000000..98c277e6b8 --- /dev/null +++ b/system/bluez-utils/doinst.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +config() { + NEW="$1" + OLD="`dirname $NEW`/`basename $NEW .new`" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +config etc/bluetooth/hcid.conf.new +config etc/bluetooth/rfcomm.conf.new +config etc/rc.d/rc.bluetooth.new + diff --git a/system/bluez-utils/rc.bluetooth.new b/system/bluez-utils/rc.bluetooth.new new file mode 100644 index 0000000000..f303055e79 --- /dev/null +++ b/system/bluez-utils/rc.bluetooth.new @@ -0,0 +1,114 @@ +#!/bin/sh +# +# Start/stop the Bluetooth daemons +# + +set -e + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +NAME=rc.bluetooth +DESC="Bluetooth subsystem" + +HCID_NAME=hcid +SDPD_NAME=sdpd +HIDD_NAME=hidd +HID2HCI_NAME=hid2hci +RFCOMM_NAME=rfcomm +PAND_NAME=pand +DUND_NAME=dund + +HCID_EXEC="`which $HCID_NAME || true`" +SDPD_EXEC="`which $SDPD_NAME || true`" +HIDD_EXEC="`which $HIDD_NAME || true`" +HID2HCI_EXEC="`which $HID2HCI_NAME || true`" +RFCOMM_EXEC="`which $RFCOMM_NAME || true`" +PAND_EXEC="`which $PAND_NAME || true`" +DUND_EXEC="`which $DUND_NAME || true`" + +HCID_ENABLE=true +SDPD_ENABLE=false +HIDD_ENABLE=false +HID2HCI_ENABLE=false +RFCOMM_ENABLE=false +DUND_ENABLE=false +PAND_ENABLE=false + +HCID_CONFIG="/etc/bluetooth/hcid.conf" +RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf" + +HIDD_OPTIONS="" +DUND_OPTIONS="" +PAND_OPTIONS="" + +start() { + echo -n "Starting $DESC:" + if $HCID_ENABLE && [ -x "$HCID_EXEC" ] && [ -f "$HCID_CONFIG" ] ; then + if $SDPD_ENABLE ; then + $HCID_EXEC -f $HCID_CONFIG + else + $HCID_EXEC -s -f $HCID_CONFIG + fi + echo -n " $HCID_NAME" + fi + if $SDPD_ENABLE && [ -x "$SDPD_EXEC" ] ; then + $SDPD_EXEC + echo -n " $SDPD_NAME" + fi + if $HIDD_ENABLE && [ -x "$HIDD_EXEC" ] ; then + $HIDD_EXEC $HIDD_OPTIONS --server || true + echo -n " $HIDD_NAME" + fi + if $HID2HCI_ENABLE && [ -x "$HID2HCI_EXEC" ] ; then + $HID2HCI_EXEC --tohci > /dev/null 2>&1 || true + echo -n " $HID2HCI_NAME" + fi + if $RFCOMM_ENABLE && [ -x "$RFCOMM_EXEC" ] && [ -f "$RFCOMM_CONFIG" ] ; then + $RFCOMM_EXEC -f $RFCOMM_CONFIG bind all || true + echo -n " $RFCOMM_NAME" + fi + if $DUND_ENABLE && [ -x "$DUND_EXEC" ] && [ -n "$DUND_OPTIONS" ] ; then + $DUND_EXEC $DUND_OPTIONS + echo -n " $DUND_NAME" + fi + if $PAND_ENABLE && [ -x "$PAND_EXEC" ] && [ -n "$PAND_OPTIONS" ] ; then + $PAND_EXEC $PAND_OPTIONS + echo -n " $PAND_NAME" + fi + echo "." +} + +stop() { + echo -n "Stopping $DESC:" + killall $PAND_NAME > /dev/null 2>&1 || true + echo -n " $PAND_NAME" + killall $DUND_NAME > /dev/null 2>&1 || true + echo -n " $DUND_NAME" + if [ -x "$RFCOMM_EXEC" ] ; then + $RFCOMM_EXEC release all > /dev/null 2>&1 || true + echo -n " $RFCOMM_NAME" + fi + killall $HIDD_NAME > /dev/null 2>&1 || true + echo -n " $HIDD_NAME" + killall $SDPD_NAME > /dev/null 2>&1 || true + echo -n " $SDPD_NAME" + killall $HCID_NAME > /dev/null 2>&1 || true + echo -n " $HCID_NAME" + echo "." +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|restart}" >&2 + exit 1 + ;; +esac diff --git a/system/bluez-utils/slack-desc b/system/bluez-utils/slack-desc new file mode 100644 index 0000000000..a208350d1a --- /dev/null +++ b/system/bluez-utils/slack-desc @@ -0,0 +1,11 @@ +bluez_utils: Bluetooth utilities +bluez_utils: +bluez_utils: These are the official Linux bluetooth utilities. +bluez_utils: +bluez_utils: +bluez_utils: +bluez_utils: +bluez_utils: +bluez_utils: +bluez_utils: +bluez_utils: -- cgit v1.2.3