Best Method to run App installation and then custom scripts

Fissionchips
New Contributor

Hey All,

I feel like this question has been answered in many parts over many threads, but I'm pretty noobish and having trouble putting it all together. I'm looking for the best way to accomplish the following:

User downloads one file (assumedly a DMG) User opens the DMG, runs "RUN-ME-FIRST" file (type to be determined)
System automagically installs an app (prompting user for credentials along the way, and yes this has already written and functional)
Once complete, system automagically runs a script which will move a file included on the DMG to the System/Library/LaunchAgents folder, then runs a modification to permissions on that file

My goal is to have this whole process kick off with one click from the user after they've opened the DMG. Can I do this with a bash script?

This is for running the user client for PaperCut and setting it up to automatically start at user login.

10 REPLIES 10

CapU
Contributor III

Hi

I packaged up the login hook and added it to the policy along with the paper cut installer.
Works great

bsolomon
New Contributor

CapU,

Can you elaborate on that setup for PaperCut? That's exactly what I have been struggling with.

Thanks,
brs

StoneMagnet
Contributor III

@Fissionchips What you're asking for is easily accomplished with a post install script as part of a .pkg. Is there a specific reason you're trying to do this as a .dmg instead? You could use a .dmg, Casper policy, and a script but it should be much easier with a .pkg and Composer makes it pretty easy to build.

Fissionchips
New Contributor

I originally looked at doing it as a PKG, but perhaps was using the wrong tool. I've been attempting using a free tool called Iceberg. I couldn't make sense of how it was selecting source files and their destination. Sounds like Jamf Composer is easier?

CapU
Contributor III

I used Composer to assist in capturing the settings in the application and to be sure Papercut was in the correct location. When I got an updated version I installed paper cut then manually copied the file into Applications. For some reason its wasn't updating. I used a tool called Lingon to help me get the login hook and packed it seperatley so I can just add the login hook package to any paper cut updates in the future.

Fissionchips
New Contributor

CapU, your method also interests me. Did you modify PaperCuts "Client-local-install.app" to include the login hook?

StoneMagnet
Contributor III

@Fissionchips Yes, Jamf Composer has a much more approachable UI than Iceberg. In addition to the ability to manually create a .pkg (or .dmg) by specifying what files you want included you can have it do a before and after snapshot of a 3rd party's installer in order to capture what they do then build on it for your own installer.

CapU
Contributor III

@Fissionchips Just using Composer to create a snapshot won't create the login hook. I used Lingon then created a package with the login hook seperate so I can just apply the login hook to future installs

CapU
Contributor III

@Fissionchips Reading your post again...I wouldn't be able to trust my users with installing anything themselves. Here we (I) either push the software, run a policy or have the Tech run Self Service. If it's run from Self Service then the package has to be a 1 click no questions asked procedure.

Chris_Hafner
Valued Contributor II

Just so we're all on the same page, this is how I handle Papercut client. There are likely better ways, but this way is mine:
1) On a machine with Composer, create a LaunchAgent for the papercut client as per the following instructions: (https://www.papercut.com/kb/Main/MacClientStartupWithLaunchd) and place it in /Library/LaunchAgents
2) Install PCClient on that machine and modify any settings you need in /Applications/PCClient/Contents/Resources/config.properties -All I do is simply uncomment (remove the # symbol) the line #hide-balance=y and then save the file.
3) Open Composer, cancel the wizards that auto launch and then drag in the PCClient app (/Applications/PCClient). This will create a new composer package/dmg "policy".
4) Drag the LaunchAgent (com.papercut.client./plist) into the same window so that it looks like this:
b03236ffd28c46bd9fc9077f3266df7b
5) Check your permissions on these two files. Mine look like this:
e9f9ea27f3a740b7b309acae29e13026
aeca9a117b4b4304b7c04033c811a11d

After this, package as you wish. I use .dmg because I create uninstallers out of this policy (One HAS to unload the launchAgent before uninstalling, FYI)