[Pkg-bluetooth-commits] r1060 - in /packages/bluez/trunk/debian: bluez.bluetooth.init bluez.config bluez.postinst bluez.templates control po/ po/POTFILES.in po/ja.po po/templates.pot

iwamatsu at users.alioth.debian.org iwamatsu at users.alioth.debian.org
Fri Jun 3 04:09:02 UTC 2011


Author: iwamatsu
Date: Fri Jun  3 04:09:01 2011
New Revision: 1060

URL: http://svn.debian.org/wsvn/pkg-bluetooth/?sc=1&rev=1060
Log:
Add support debconf to bluez package.
This provides interface to add the user who using bluetooth 
devices to the bluetooth group.


Added:
    packages/bluez/trunk/debian/bluez.config   (with props)
    packages/bluez/trunk/debian/bluez.templates
    packages/bluez/trunk/debian/po/
    packages/bluez/trunk/debian/po/POTFILES.in
    packages/bluez/trunk/debian/po/ja.po
    packages/bluez/trunk/debian/po/templates.pot
Modified:
    packages/bluez/trunk/debian/bluez.bluetooth.init
    packages/bluez/trunk/debian/bluez.postinst
    packages/bluez/trunk/debian/control

Modified: packages/bluez/trunk/debian/bluez.bluetooth.init
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk/debian/bluez.bluetooth.init?rev=1060&op=diff
==============================================================================
--- packages/bluez/trunk/debian/bluez.bluetooth.init (original)
+++ packages/bluez/trunk/debian/bluez.bluetooth.init Fri Jun  3 04:09:01 2011
@@ -26,21 +26,21 @@
 DAEMON=/usr/sbin/bluetoothd
 HCIATTACH=/usr/sbin/hciattach
 
-HID2HCI=/lib/udev/hid2hci
 HID2HCI_ENABLED=1
 HID2HCI_UNDO=1
 
 UART_CONF=/etc/bluetooth/uart
 
-RFCOMM=/usr/bin/rfcomm
 RFCOMM_NAME=rfcomm
-RFCOMM_CONF=/etc/bluetooth/rfcomm.conf
+RFCOMM=/usr/bin/$RFCOMM_NAME
+RFCOMM_CONF=/etc/bluetooth/$RFCOMM_NAME.conf
 SDPTOOL=/usr/bin/sdptool
 
 SSD_OPTIONS="--oknodo --quiet --exec $DAEMON"
 
-test -f /usr/sbin/bluetoothd || exit 0
-
+test -f $DAEMON || exit 0
+
+# FIXME: any of the sourced files may fail if/with syntax errors
 test -f /etc/default/bluetooth && . /etc/default/bluetooth
 test -f /etc/default/rcS && . /etc/default/rcS
 
@@ -48,36 +48,36 @@
 
 set -e
 
+# FIXME: this function is possibly a no-op
 run_sdptool()
 {
+	# declaring IFS local in this function, removes the need to
+	# save/restore it
+	local IFS o
+
 	test -x $SDPTOOL || return 1
 
+# FIXME: where does SDPTOOL_OPTIONS come from?
 	if ! test -z "$SDPTOOL_OPTIONS" ; then
-		oldifs="$IFS"
 		IFS=";"
 		for o in $SDPTOOL_OPTIONS ; do
 			#echo "execing $SDPTOOL $o"
 			IFS=" "
-			if [ "$VERBOSE" != "no" ]; then
+			if [ "$VERBOSE" != no ]; then
 				$SDPTOOL $o
 			else
 				$SDPTOOL $o >/dev/null 2>&1
 			fi
 		done
-		IFS="$oldifs"
-	fi
-
-}
-
-enable_hci_input()
-{
-    log_progress_msg "switching to HID/HCI no longer done in init script, see /usr/share/doc/bluez/NEWS.Debian.gz"
-}
-
-disable_hci_input()
-{
-    log_progress_msg "switching to HID/HCI no longer done in init script, see /usr/share/doc/bluez/NEWS.Debian.gz"
-}
+	fi
+}
+
+hci_input()
+{
+    log_progress_msg "switching to HID/HCI no longer done in init script, see /usr/share/doc/bluez/NEWS.Debian.gz" || :
+}
+alias enable_hci_input=hci_input
+alias disable_hci_input=hci_input
 
 start_uarts()
 {
@@ -93,7 +93,7 @@
 
 stop_uarts()
 {
-	killall hciattach > /dev/null 2>&1 || true
+	killall ${HCIATTACH##*/} >/dev/null 2>&1 || :
 }
 
 start_rfcomm()
@@ -102,10 +102,10 @@
 		# rfcomm must always succeed for now: users
 		# may not yet have an rfcomm-enabled kernel
                 if [ "$VERBOSE" != no ]; then
-                       log_progress_msg "rfcomm"
-                       $RFCOMM -f $RFCOMM_CONF bind all || true
+		       log_progress_msg "${RFCOMM##*/}"
+		       $RFCOMM -f $RFCOMM_CONF bind all || :
                 else
-                       $RFCOMM -f $RFCOMM_CONF bind all >/dev/null 2>&1 || true
+		       $RFCOMM -f $RFCOMM_CONF bind all >/dev/null 2>&1 || :
                 fi
 	fi
 }
@@ -114,10 +114,10 @@
 {
 	if [ -x $RFCOMM ] ; then
                if [ "$VERBOSE" != no ]; then
-                       log_progress_msg "rfcomm"
-                       $RFCOMM unbind all || true
+		       log_progress_msg "${RFCOMM##*/}"
+		       $RFCOMM unbind all || :
                else
-                       $RFCOMM unbind all >/dev/null 2>&1 || true
+		       $RFCOMM unbind all >/dev/null 2>&1 || :
                fi
 	fi
 }
@@ -126,41 +126,40 @@
 {
 	if [ -x $RFCOMM ] && [ -f $RFCOMM_CONF ] ; then
                if [ "$VERBOSE" != no ]; then
-                       log_progress_msg  "rfcomm"
-                       $RFCOMM unbind all || true
-                       $RFCOMM -f $RFCOMM_CONF bind all || true
+		       log_progress_msg  "${RFCOMM##*/}"
+		       $RFCOMM unbind all || :
+		       $RFCOMM -f $RFCOMM_CONF bind all || :
                else
-                       $RFCOMM unbind all >/dev/null 2>&1|| true
-                       $RFCOMM -f $RFCOMM_CONF bind all >/dev/null 2>&1 || true
+		       $RFCOMM unbind all >/dev/null 2>&1|| :
+		       $RFCOMM -f $RFCOMM_CONF bind all >/dev/null 2>&1 || :
                fi
 	fi
 }
 
-case "$1" in
+case $1 in
   start)
 	log_daemon_msg "Starting $DESC"
 
-	if test "$BLUETOOTH_ENABLED" = "0"; then
+	if test "$BLUETOOTH_ENABLED" = 0; then
 		log_progress_msg "disabled. see /etc/default/bluetooth"
 		log_end_msg 0
 		exit 0
 	fi
 
 	start-stop-daemon --start $SSD_OPTIONS
-	log_progress_msg "bluetoothd"
-
-	run_sdptool || true
-
-	start_uarts || true
-
-	if test "$HID2HCI_ENABLED" = "1"; then
-		enable_hci_input || true
-	fi
-	start_rfcomm || true
-
-	if test "$HIDD_ENABLED" = "1" ||
-			test "$PAND_ENABLED" = "1" ||
-			test "$DUND_ENABLED" = "1"; then
+	log_progress_msg "${DAEMON##*/}"
+
+	run_sdptool || :
+
+	start_uarts || :
+
+	if test "$HID2HCI_ENABLED" = 1; then
+		enable_hci_input
+	fi
+	start_rfcomm || :
+
+	if test "$HIDD_ENABLED" = 1 ||
+		test "$PAND_ENABLED" = 1 || test "$DUND_ENABLED" = 1; then
 		log_progress_msg "compatibily daemons not started, see bluez-compat package"
 	fi
 
@@ -168,18 +167,18 @@
   ;;
   stop)
 	log_daemon_msg "Stopping $DESC"
-	if test "$BLUETOOTH_ENABLED" = "0"; then
+	if test "$BLUETOOTH_ENABLED" = 0; then
 		log_progress_msg "disabled."
 		log_end_msg 0
 		exit 0
 	fi
-	stop_rfcomm || true
-	if test "$HID2HCI_UNDO" = "1"; then
-		disable_hci_input || true
+	stop_rfcomm || :
+	if test "$HID2HCI_UNDO" = 1; then
+		disable_hci_input
 	fi
 	start-stop-daemon --stop $SSD_OPTIONS
-	log_progress_msg "bluetoothd"
-	stop_uarts || true
+	log_progress_msg "${DAEMON}"
+	stop_uarts || :
 	log_end_msg 0
   ;;
   restart|force-reload)
@@ -192,7 +191,6 @@
   ;;
   *)
 	N=/etc/init.d/bluetooth
-	# echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
 	echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
 	exit 1
 	;;

Added: packages/bluez/trunk/debian/bluez.config
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk/debian/bluez.config?rev=1060&op=file
==============================================================================
--- packages/bluez/trunk/debian/bluez.config (added)
+++ packages/bluez/trunk/debian/bluez.config Fri Jun  3 04:09:01 2011
@@ -1,0 +1,33 @@
+#!/bin/bash
+set -e
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
+db_get bluez/users
+if [ -n "$( echo $RET | grep \${ )" ]; then
+	db_set bluez/users ""
+	db_fset bluez/users seen false
+fi
+
+db_metaget bluez/users users
+users="$(getent passwd | awk -F: '{if ($3 >= 1000 && $3 < 60000) print $1}' | sort | tr '\n' ',' | sed 's@,@, @g;s@, $@@g')"
+bt=$(getent group bluetooth | cut -d: -f4 | sed -e 's@,@ @g')
+
+# Don't show users already in bluetooth
+for u in $bt; do
+	users=$(echo $users | sed "s@$u, @@g;s@, $u\$@@g;s@^$u\$@@g");
+done
+
+db_subst bluez/users users "$users"
+
+db_input high bluez/users || true
+db_go
+
+db_get bluez/users
+users=$(echo $RET | sed -e 's@,@@g')
+
+# Add selected users
+for u in $users; do
+	adduser --quiet $u bluetooth
+done

Propchange: packages/bluez/trunk/debian/bluez.config
------------------------------------------------------------------------------
    svn:executable = *

Modified: packages/bluez/trunk/debian/bluez.postinst
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk/debian/bluez.postinst?rev=1060&op=diff
==============================================================================
--- packages/bluez/trunk/debian/bluez.postinst (original)
+++ packages/bluez/trunk/debian/bluez.postinst Fri Jun  3 04:09:01 2011
@@ -1,5 +1,9 @@
 #!/bin/sh
 # snippet from http://www.dpkg.org/dpkg/ConffileHandling
+
+set -e
+
+. /usr/share/debconf/confmodule
 
 # Move a conffile without triggering a dpkg question
 mv_conffile() {
@@ -13,7 +17,6 @@
     fi
 }
 
-set -e
 case "$1" in
     configure)
         if [ -e /etc/init.d/bluez-utils ]; then
@@ -51,3 +54,7 @@
 esac
 
 #DEBHELPER#
+
+db_stop;
+
+exit 0

Added: packages/bluez/trunk/debian/bluez.templates
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk/debian/bluez.templates?rev=1060&op=file
==============================================================================
--- packages/bluez/trunk/debian/bluez.templates (added)
+++ packages/bluez/trunk/debian/bluez.templates Fri Jun  3 04:09:01 2011
@@ -1,0 +1,6 @@
+Template: bluez/users
+Type: multiselect
+Choices: ${users}
+_Description: Users to add to the bluetooth group:
+ Users who should be able to use bluetooth device need to be added to the
+ group "bluetooth".

Modified: packages/bluez/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk/debian/control?rev=1060&op=diff
==============================================================================
--- packages/bluez/trunk/debian/control (original)
+++ packages/bluez/trunk/debian/control Fri Jun  3 04:09:01 2011
@@ -4,6 +4,7 @@
 Maintainer: Debian Bluetooth Maintainers <pkg-bluetooth-maintainers at lists.alioth.debian.org>
 Uploaders: Andrea Veri <andrea.veri89 at gmail.com>, Nobuhiro Iwamatsu <iwamatsu at debian.org>
 DM-Upload-Allowed: yes
+Build-Depends-Indep: po-debconf
 Build-Depends: debhelper (>= 7),
                autotools-dev,
                cdbs,

Added: packages/bluez/trunk/debian/po/POTFILES.in
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk/debian/po/POTFILES.in?rev=1060&op=file
==============================================================================
--- packages/bluez/trunk/debian/po/POTFILES.in (added)
+++ packages/bluez/trunk/debian/po/POTFILES.in Fri Jun  3 04:09:01 2011
@@ -1,0 +1,1 @@
+[type: gettext/rfc822deb] bluez.templates

Added: packages/bluez/trunk/debian/po/ja.po
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk/debian/po/ja.po?rev=1060&op=file
==============================================================================
--- packages/bluez/trunk/debian/po/ja.po (added)
+++ packages/bluez/trunk/debian/po/ja.po Fri Jun  3 04:09:01 2011
@@ -1,0 +1,33 @@
+# Debconf translations for bluez.
+# Copyright 2011 Nobuhiro Iwamatsu
+# This file is distributed under the same license as the bluez package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: bluez at packages.debian.org\n"
+"POT-Creation-Date: 2011-06-02 08:39+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: multiselect
+#. Description
+#: ../templates:1001
+msgid "Users to add to the bluetooth group:"
+msgstr "bluetooth グループに追加するユーザ:"
+
+#. Type: multiselect
+#. Description
+#: ../templates:1001
+msgid ""
+"Users who should be able to use bluetooth devices need to be added to the group "
+"\"bluetooth\"."
+msgstr ""
+"bluetooth デバイスを使用可能なユーザは「bluetooth」グループに追加されている"
+"å¿
要があります。"

Added: packages/bluez/trunk/debian/po/templates.pot
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/trunk/debian/po/templates.pot?rev=1060&op=file
==============================================================================
--- packages/bluez/trunk/debian/po/templates.pot (added)
+++ packages/bluez/trunk/debian/po/templates.pot Fri Jun  3 04:09:01 2011
@@ -1,0 +1,31 @@
+# Debconf translations for bluez.
+# Copyright 2011 Nobuhiro Iwamatsu
+# This file is distributed under the same license as the bluez package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: bluez at packages.debian.org\n"
+"POT-Creation-Date: 2011-06-02 08:39+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: multiselect
+#. Description
+#: ../templates:1001
+msgid "Users to add to the bluetooth group:"
+msgstr ""
+
+#. Type: multiselect
+#. Description
+#: ../templates:1001
+msgid ""
+"Users who should be able to use bluetooth devices need to be added to the group "
+"\"bluetooth\"."
+msgstr ""




More information about the Pkg-bluetooth-commits mailing list