Blame | Last modification | View Log | RSS feed
#!/bin/bash# This file must be executable to work! chmod 755!key="$1"opts="-fstype=cifs"for P in /bin /sbin /usr/bin /usr/sbindoif [ -x $P/smbclient ]thenSMBCLIENT=$P/smbclientbreakfidone[ -x $SMBCLIENT ] || exit 1$SMBCLIENT -gNL $key 2>/dev/null| awk -v key="$key" -v opts="$opts" -F'|' -- 'BEGIN { ORS=""; first=1 }/Disk/ {if (first)print opts; first=0dir = $2loc = $2# Enclose mount dir and location in quotes# Double quote "$" in location as it is specialgsub(/\$$/, "\\$", loc);gsub(/\&/,"\\\\&",loc)print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""}END { if (!first) print "\n"; else exit 1 }'