On Mon, 2007-11-26 at 10:49 +0100, muzzol wrote:
> hi!
>
> is any token related to user trying to mount passed to autofs?
>
> i've tried $USER and other variables without any success.
So you're not using version 5 then, or are you?
Version 5 sets several variables in the environment, USER, GROUP, HOME,
UID and GID.
>
> what i want to do is something like:
>
> ============================================
>
> #!/bin/bash
>
> # $Id: auto.smb,v 1.3 2005/04/05 13:02:09 raven Exp $
>
> # This file must be executable to work! chmod 755!
>
> key="$1"
> mountopts="-fstype=cifs"
> smbopts=""
> credfile="/home/$USER/auto.smb.$key"
>
> 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
> mountopts="$mountopts,credentials=$credfile"
> smbopts="-A $credfile"
> else
> smbopts="-N"
> fi
>
> $SMBCLIENT $smbopts -gL $key 2>/dev/null| awk -v key="$key" -v
> opts="$mountopts" -F'|' -- '
> BEGIN { ORS=""; first=1 }
> /Disk/ { if (first) { print opts; first=0 }; sub(/ /, "\\ ",
> $2); print " \\\n\t /" $2, "://" key "/" $2 }
> END { if (!first) print "\n"; else exit 1 }
> '
>
> ============================================
>
> note the credfile line:
>
> credfile="/home/$USER/auto.smb.$key"
>
> if there's no variable, can any additional parameter be passwd to the
> executables mappings beside the key?
No other parameters can be passed to program maps.
I don't really know of a sane way to do this.
Ian
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs