dmenumountcifs (877B)
1 #!/bin/sh 2 # Gives a wmenu prompt to mount unmounted local NAS shares for read/write. 3 # Requirements - "%wheel ALL=(ALL) NOPASSWD: ALL" 4 # 5 # Browse for mDNS/DNS-SD services using the Avahi daemon... 6 srvname=$(avahi-browse _smb._tcp -t | awk '{print $4}' | wmenu -i -p "Which NAS?") || exit 1 7 notify-send "Searching for network shares..." "Please wait..." 8 # Choose share disk... 9 share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | wmenu -i -p "Mount which share?") || exit 1 10 # Format URL... 11 share2mnt=//"$srvname".local/"$share" 12 13 sharemount() { 14 mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && sudo mkdir /mnt/"$share") 15 [ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="",noperm /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0 16 notify-send "Netshare $share already mounted"; exit 1 17 } 18 19 sharemount