SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I took the auto.smb from CentOS 6.2 and modified it slightly to cater for my Win 7 env at work. Same script, works on CentOS by visiting /smb/<host>/<share>. On Slackware 14, it doesn't work UNTIL autofs is restarted manually after bootup. And from then on, it just works like a charm.
I think the issue lies in autofs being started too early in rc.M? Has anyone seen this problem before?
Another thing is, the script can't handle default shares well, e.g. C$. Anyone's got a solution on this?
Code:
#!/bin/bash
# This file must be executable to work! chmod 755!
key="$1"
credfile="${HOME}/.auto.smb.$USER"
[ "x$GROUP" == "x" ] || grpopt=",gid=$GROUP"
opts="-fstype=cifs,nosuid,file_mode=0664,dir_mode=0775,uid=$USER,sec=ntlm"$grpopt
for P in /bin /sbin /usr/bin /usr/sbin
do
if [ -x $P/smbclient ]
then
SMBCLIENT=$P/smbclient
break
fi
done
[ -x $SMBCLIENT ] || exit 1
if [ -e "$credfile" ]; then
opts=$opts",credentials=$credfile"
smbclientopts="-d 2 -A "$credfile
else
smbclientopts="-N"
fi
$SMBCLIENT $smbclientopts -gL $key 2>/dev/null \
| awk -v key="$key" -v opts="$opts" -F'|' -- '
BEGIN { ORS=""; first=1 }
/Disk/ {
if (first)
print opts; first=0
dir = $2
loc = $2
# Enclose mount dir and location in quotes
# Double quote "$" in location as it is special
gsub(/\$$/, "\\$", loc);
gsub(/\&/,"\\\\&",loc)
print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
}
END { if (!first) print "\n"; else exit 1 }
'
It starts before wicd or networkmanager. But even so, I thought it only mounted drives or points when needed. So, until you have someone or something actively trying to access a file on an autofs moount, it really should make no difference. Having said that though, it will be trivial to cut+paste the code and move it lower down and see how it goes. That's the great thing about Slackware - you can fiddle. Please report back on your findings. If you're right, I guess it will be moved down "officially".
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.