Mount a share on a Mac using a login hook

Posted by Arcath on Super User See other posts from Super User or by Arcath
Published on 2009-12-14T11:48:44Z Indexed on 2010/03/28 18:03 UTC
Read the original article Hit count: 334

Filed under:
|
|
|

I have a script that mounts a Samba share to a folder on the desktop, it runs no problem but when its setup as a LoginHook it doesn't mount the folder.

Does anyone have a working login hook that mounts a share that they can post? Or know any issues with mounting shares during login?

This is my Script:

#!/usr/bin/env ruby
@domain="Lancaster"
@user=ARGV[0]
#@[email protected](/\n/,"")
@userfolder="/Users/" + @user.to_s
@smbshare="//#{@user}@hercules/everyone"
system("mkdir #{@userfolder}/Desktop/everyone")
system("mount_smbfs #{@smbshare} #{@userfolder}/Desktop/everyone | #{@userfolde$
system("
/usr/bin/osascript <<-EOF
        tell application \"System Events\"
                activate
                display dialog \"Welcome to the #{@domain} domain #{@user}\n\nY$
        end tell
EOF
")

© Super User or respective owner

Related posts about mac

Related posts about osx