mountnetworkshare script on 10.8

nkalister
Valued Contributor

Hey JAMFnation, I've been using the mountnetworkshare script from the resource kit to mount user's network home directories in 10.7.x successfully for some time now- i did have to do some changes, since as supplied by JAMF it'll fail on any username starting with 'n', but I worked that out, and it's been great.
However, on 10.8.1, it's not working. There appear to be 2 problems- the launchagent plist file that is generated when I run the script as a login item from the JSS doesn't populate the location of the network directory properly- it's left in place as 'replaceMe', so the code on line 230 doesn't appear to be working any longer:

/usr/bin/sed "s:replaceMe:/usr/bin/osascript -e 'mount volume ("smb://$share")':g" "/Users/$loginUsername/Library/LaunchAgents/com.jamfsoftware.mapdrive.$volumeName.plist" > "/private/tmp/com.jamfsoftware.mapdrive.$volumeName.plist.tmp"

Also, if I substitute the proper usernames and run the script locally, it DOES populate the location properly, but then prompts me for a password when connecting, despite the fact that I can connect to the share using the kerberos ticket issued at login from the 'Connect to Server' interface.

Any ideas?

2 REPLIES 2

tsquillario
New Contributor

I'm running into the same issue. Did you ever figure out a fix for this? I'm on 10.8 to.

nkalister
Valued Contributor

I did, in fact. I'm almost embarrassed to post it though, since it's SUCH A HACK. but here it is :)

#!/bin/bash
loginUsername=`stat -f%Su /dev/console`
share=`/usr/bin/dscl /Search read /Users/$loginUsername SMBHome | head -1 | awk '{print $2}'`
share=`echo $share | sed 's:\:/:g'`
echo "/usr/bin/osascript -e 'mount volume ("smb:${share}")'" > /var/tmp/osa.sh
cat /var/tmp/osa.sh | /bin/bash

rm /var/tmp/osa.sh

I'm just running that instead of the script from the resourcekit these days. no need for a launchagent, really. that always seemed overly complicated to me anyhow.