Trying to create a DMG file to deploy that will install a safari shortcut to everyones desktop. Or possibly in the Applications folder, when I open composer and drag the Icon from my desktop in, it creates the folder
Obviously not everyone will have a "Simon" user folder and I want it to go to theres, is there something like $username or something that will work and edit the folder named Simon?
If you create a DMG as shown with Users>Simon>Desktop>GreyConnect.webloc and:
Deploy without FEU/FUT checked, you will get this on the target computer:
Deploy with FEU (Fill Existing Users) checked, you will get this on the target computer:
(installed in the Desktop folder for every user)
Deploy with FUT (Fill User Templates) checked, you will get this on the target computer:
(installed in all of the User templates, so any new user that logs in to the machine will get it)
So the username in the composer package doesn't really matter, though when I do those packages I like to use a generic "packaging" account. You can use FEU and FUT simultaneously if you want.
There is another option, using a package (PKG) that contains the file and a script to copy the files where they need to go in the user's directories.
There's also going the completely scripted way, though this would only work for the logged in user and not on a global level for any future accounts.
#!/bin/bash loggedInUser=$(stat -f%Su /dev/console) loggedInUID=$(id -u "$loggedInUser") /bin/launchctl asuser "$loggedInUID" sudo -iu "$loggedInUser" "/usr/bin/osascript << EOF tell application "Finder" set mySource to POSIX file "/Applications/Safari.app" as alias make new alias to mySource at desktop set name of result to "Safari" end tell EOF"
Like @mm2270 I would consider doing this with a script. A script makes it easy to make changes or remove the shortcut in the future.
The following as a login script should accomplish the task.
#!/bin/bash echo [InternetShortcut] > /Users/$3/Desktop/Test.url echo URL=http://somewebsite.com >> /Users/$3/Desktop/Test.url chown $3 /Users/$3/Desktop/Test.url