Run app installer from self service as the user

Mikeness
New Contributor

I have an app installer that we would like to make available in self service. We'd like when the user clicks to install that it NOT install as root, but as the user that clicks it. Any way to make this work?

3 REPLIES 3

r0blee
New Contributor III

Did you create the installer or is it an installer from a Developer?
What is it trying to do?

If you install the files to a temporary location you could run a post install script or something similar that get's the current user from the Jamf binary as it will be $3 or could do a check like this:

currentUser=$3
if [[ $3 == "" ]]; then currentUser=stat -f%Su /dev/console
fi

so that way you have a full back option for discovering the username and then use dscl to find their home directory location:

currentUserHome=dscl /Search read /Users/$currentUser NFSHomeDirectory | cut -d' ' -f 2 | head -n 1

Like I said it all depends on the type of installer and what you're doing but maybe these will give you some ideas.

Rob

Mikeness
New Contributor

Thanks r0blee, it is a pkg file from an outside developer. It installs an agent on the machine and it requires the user run it as themselves. I know I could do the tricks you mentioned, but is there really no easier/cleaner way?

r0blee
New Contributor III

Probably not as that’s the thing when you use the original developers installer is you have no control over whatever script they are using in their pkg.

Rob