Had script below working in fedora to access a blackberry playbook when plugged in. The script on fedora was put into /etc/NetworkManager/dispatcher.d/ directory. When the playbook is plugged in it is automatically mounted. However, can not get it to work in Kubuntu. This command works from command line 'sudo mount -t cifs -o username=playbook,password=***,rw //169.254.0.1/media /mnt/playbook '
ifconfig
usb0 Link encap:Ethernet HWaddr 72:d4:f2:43:b4:9f
inet addr:169.254.0.2 Bcast:169.254.0.3 Mask:255.255.255.252
Script NB username and password are not included
#!/bin/bash
IFACE=usb0
MOUNTPOINT=/mnt/playbook
MOUNTOPT="username=****,password=***,uid=***"
if [ "$1" != "$IFACE" ]; then
exit 0
fi
function check_mount() {
MOUNTED=$(mount |grep "on $MOUNTPOINT type")
test -n "$MOUNTED" && exit 0
}
function mount_device() {
IFS=. i=($(ifconfig $IFACE|grep "inet "|awk '{print $2}'))
unset IFS
n=${i[3]}
let n--
IP=${i[0]}.${i[1]}.${i[2]}.$n
mount.cifs -o $MOUNTOPT //${IP}/media $MOUNTPOINT
}
case "$2" in
'up')
check_mount
mount_device;;
'down') ;;
esac
exit 0
ifconfig
usb0 Link encap:Ethernet HWaddr 72:d4:f2:43:b4:9f
inet addr:169.254.0.2 Bcast:169.254.0.3 Mask:255.255.255.252
Script NB username and password are not included
#!/bin/bash
IFACE=usb0
MOUNTPOINT=/mnt/playbook
MOUNTOPT="username=****,password=***,uid=***"
if [ "$1" != "$IFACE" ]; then
exit 0
fi
function check_mount() {
MOUNTED=$(mount |grep "on $MOUNTPOINT type")
test -n "$MOUNTED" && exit 0
}
function mount_device() {
IFS=. i=($(ifconfig $IFACE|grep "inet "|awk '{print $2}'))
unset IFS
n=${i[3]}
let n--
IP=${i[0]}.${i[1]}.${i[2]}.$n
mount.cifs -o $MOUNTOPT //${IP}/media $MOUNTPOINT
}
case "$2" in
'up')
check_mount
mount_device;;
'down') ;;
esac
exit 0
Comment