installing into ~/Applications

AVmcclint
Honored Contributor

I'm having difficulty building a package with Composer that puts a folder that contains files into ~/Applications (or any ~/ subfolder for that matter). It appears that whenever I try to deploy it, it actually creates everything in bold: /Users/cmcintosh/Applications/stuff/files-andstuff-in-here What's so bad about that? It doesn't put the files into the user's home folder who is running the policy via self service. It creates a user folder in my name on their computer. How are you supposed to tell Composer to not put it in the home folder of the person who created the package? I've tried doing it as a .dmg and as a .pkg but both methods continue to recreate the original path literally.

If I use FEU for the policy's package then it does work but it puts it in EVERY user's home folder. How do I distribute to ONLY the user who is running the policy?

10 REPLIES 10

mm2270
Legendary Contributor III

You will have to script this unfortunately. Drop your actual payload (the application) into a place like /private/tmp/, bring it into Composer from that loction, then use a postinstall script to move it into the current user's home directory, creating the ~/Applications/ directory in the process if needed. There's no way I know of to tell Composer to do this other than with a script. It just uses whatever path you've copied the application in from as its final destination.

AVmcclint
Honored Contributor

Thanks. That's what I was afraid of. I guess I can live with installing files into every user's folder for now.

Reason #4,912 why JSS needs to recognize "~" for installs and scripts.

mm2270
Legendary Contributor III

Well, technically policies being run by certain triggers captures $3 as the current user, but passing that to a pkg or dmg install to have it drop files in that user's directory without utilizing a script, I don't know of a way to do.
Also, in case I wasn't clear in my explanation above, by "postinstall" script, I actually mean a postinstall script directly within the .pkg install itself, which can be done right in Composer, not a separate script to run from the JSS. In a way this makes the pkg self contained and can be run by anyone or by any process and would not be reliant on some extra script to run in the policy.

Lastly, you may also want to look at Packages.app. It may have some functionality for this, but I have not looked to see.

Jerod
New Contributor III

When you create a package source in Composer, you can change the directory it installs into (add directories or files, etc). You could try changing the directory there before creating the package, then you wouldn't need to script anything.

AVmcclint
Honored Contributor

That's the problem. What do I change it to? Can I substitute cmcintosh with ? would it recognize that I don't want to create a cmcintosh folder? or would it create a folder called "" within /Users?

mm2270
Legendary Contributor III

No, it will not. What's proposed above won't help since you can't build a Composer install to use a path like ~/Applications/ It only understands absolute paths as far as I have ever known.

bentoms
Release Candidate Programs Tester

Yep. Agree with what @mm2270 has said.

Casper will lay down stuff as it appears in the DMG.

So, /Users/admin/Applications/some.app will install in that location.

You'll need to grab the username of the logged in user then copy the app from a temp location to where you want it.

user-kMDjUsheqD
New Contributor

Hello,

Wanted to know if you were able to get pkg's installed into the ~Applications folder? I wanted to try this method so users can autoupdate apps.

Thanks

AJPinto
Honored Contributor III

@user-kMDjUsheqD with how old this thread is its probably best to start a new discussions topic. However, if I am not mistaken if you use composer and build the package as a dmg JAMF Admin gives you some options that may do what you are looking for.

If you build the package as a DMG you have the option to use Fill User Templates (FUT) and Fill Existing user home directories (FEU) in JAMF Admin. FEU would replace any user specific variables, in theory it would change /users/{LabUser}/applications to /users/{whatever}/applications based on whoever was logged in. Me personally I would use a post install script as they recommended in 2015 with this thread, I am not sure if the FUT and FEU features were in JAMF 6 years ago.

PaulHazelden
Valued Contributor

FUT and FEU were there 6 years ago, and their behaviour was the same as now. FEU will fill all existing users accounts. FUT will fill all of the templates. You can use Composer to make a package and apply it to all Users and or all Templates. Plus then if as was suggested before is required, to add to a specific user account, you will need to either write a script and add it to the package in Composer. Use Composer to put the file in a Temp location and then the Post install script to copy it to their home location. Or again have Composer place the file in a temp location and then have a script set to run after, and add it to the policy. This will give you access to the parameters like $3 for the logged in username. Never tried to add to an individuals home location, so I would suggest you test it thoroughly, and then test it again.