From 75dc9a4dea3b08f375eebdcbc63fc44dffa492c1 Mon Sep 17 00:00:00 2001 From: Robby Workman Date: Fri, 23 Apr 2010 14:35:57 -0500 Subject: Renamed from blueman_open to blueman-open --- blueman_open | 104 ----------------------------------------------------------- 1 file changed, 104 deletions(-) delete mode 100755 blueman_open (limited to 'blueman_open') diff --git a/blueman_open b/blueman_open deleted file mode 100755 index f46d97a..0000000 --- a/blueman_open +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -# Blueman Mount Script for Slackware -# by Zarren Spry & Robby Workman - - -DEBUG=${DEBUG:-"1"} -if [ ! -z $DEBUG ];then - dbg_msg="Check /var/log/messages for errors." -else - dbg_msg="Enable *DEBUG* for error log." -fi - -device_addr=$1 -device_name=$(hcitool name $device_addr) -own_name=$(basename $0) -basedir=${basedir:-$HOME/.gvfs} -dir=${basedir} -browser=${browser:-"xdg-open"} -max_tries=5 - -# Check for kdialog -if which kdialog 1>/dev/null 2>/dev/null; then - messagetype="kdialog" -else - messagetype="libnotify" -fi - -# Mount function -mount_device () -{ - loop=0 - while [ $loop -lt $max_tries ] - do - [ ! -z $DEBUG ] && logger -i -t $own_name "Perform $loop try to mount device $device_name to $dir using gvfs." - [ ! -z $DEBUG ] && logger -i -t $own_name "Execute: gvfs-mount obex://["$device_addr"]" - out=$(gvfs-mount obex://["$device_addr"] 2>&1) - [ ! -z $DEBUG ] && logger -i -t $own_name "$out" - mounts=$(ls $dir | grep $device_name) - [ ! -z $DEBUG ] && logger -i -t $own_name "Found $mounts mounted inside $dir" - - if [ "$mounts" = "$device_name" ] ;then - MSG_TXT="Successfully mounted $device_name to $dir" - if [ $messagetype == "kdialog" ]; then - kdialog --passivepopup "$MSG_TXT" 2 - elif [ $messagetype == "libnotify" ]; then - notify-send --expire-time=20000 --icon=blueman "$MSG_TXT" - fi - [ ! -z $DEBUG ] && logger -i -t $own_name "Open $dir/$device_name with $browser" - out=$($browser $dir/$device_name 2>&1) - [ ! -z $DEBUG ] && logger -i -t $own_name "$out" - exit 0 - else - [ ! -z $DEBUG ] && logger -i -t $own_name "Failed to mount $device_name to $dir/$device_name from try $loop " - if [ $loop -ne 4 ]; then - MSG_TXT="Attempt $loop to mount $device_name to $dir failed. Retrying, please wait ..." - else - MSG_TXT="Failed to mount $device_name to $dir. $dbg_msg" - fi - if [ $messagetype == "kdialog" ]; then - kdialog --passivepopup "$MSG_TXT" 3 - elif [ $messagetype == "libnotify" ]; then - notify-send --expire-time=20000 --icon=blueman "$MSG_TXT" - fi - fi - sleep 2 - ((loop += 1)) - done -} - -# Unmount function -umount_device () -{ - mounts=$(ls $dir | grep $device_name) - if [ "$mounts" = "$device_name" ] ;then - [ ! -z $DEBUG ] && logger -i -t $own_name "Performing umount of $dir/$device_name." - out=$(gvfs-mount -u obex://[$device_addr] 2>&1) - [ ! -z $DEBUG ] && logger -i -t $own_name "$out" - if [ -d $dir/$device_name ] ;then - [ ! -z $DEBUG ] && logger -i -t $own_name "$device_name failed to unmount. Please perform its umount manually." - MSG_TXT="Failed to umount $dir - $dbg_msg" - if [ $messagetype == "kdialog" ]; then - kdialog --passivepopup "$MSG_TXT" 3 - elif [ $messagetype == "libnotify" ]; then - notify-send --expire-time=20000 --icon=blueman "$MSG_TXT" - fi - else - [ ! -z $DEBUG ] && logger -i -t $own_name "Successfully unmounted $device_name." - fi - else - [ ! -z $DEBUG ] && logger -i -t $own_name "$dir is not mounted - no need to perform umount..." - fi -} - -# Main -MSG_TXT="Mount device is in progress... Please wait..." -if [ $messagetype == "kdialog" ]; then - kdialog --passivepopup "$MSG_TXT" 4 -elif [ $messagetype == "libnotify" ]; then - notify-send --expire-time=20000 --icon=blueman "$MSG_TXT" -fi - -umount_device -mount_device - -- cgit v1.2.3