diff options
author | Robby Workman <rworkman@slackware.com> | 2010-04-23 14:35:57 -0500 |
---|---|---|
committer | Robby Workman <rworkman@slackware.com> | 2010-04-23 14:35:57 -0500 |
commit | 75dc9a4dea3b08f375eebdcbc63fc44dffa492c1 (patch) | |
tree | 091037943cbc0f4b3731cc40f9035cdf4440cd1a /blueman_open | |
parent | c6cac647c6fce88e0a7edf5530d9b36cca1ef39e (diff) | |
download | blueman-open-75dc9a4dea3b08f375eebdcbc63fc44dffa492c1.tar.xz |
Renamed from blueman_open to blueman-open
Diffstat (limited to 'blueman_open')
-rwxr-xr-x | blueman_open | 104 |
1 files changed, 0 insertions, 104 deletions
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 - |