distribute pkg with .xml configuration file

ralvarezOES
New Contributor III

Hi,

I'm trying to deploy the new TeamViewerHost.pkg file to my MacBooks. To install this, TeamViewer recommends running it with an .xml configuration file like this:

sudo installer -applyChoiceChangesXML choices.xml -pkg TeamViewerHost.pkg -target /

Does anyone know how I would do this in Jamf?

I've tried just running the installer in a policy, but it prompts the user to set it up, just as if you were running the installer locally.

5 REPLIES 5

mm2270
Legendary Contributor II

For something like this, you need to drop the installer package and the custom XML onto the Mac in a custom, usually temporary location, such as /private/tmp/ and then run a postinstall script that calls the installer binary with your XML file as the choices.xml file.

Start by opening /private/tmp/ or some other location on the Mac you are building your package on, and make a new folder. Inside that folder place the installer package for Team Viewer and the XML file you'd like to use to customize the installation.

Then, while in Composer, drag that folder from the Finder into the sidebar of the application. Composer will automatically copy in that directory and its contents and make a new Source.
You can rename the Source at this point if you want, since this will become the name of the final package.
Now turn down the disclosure triangle for the Source to reveal the Scripts folder. Right click on it and choose Add shell script > postinstall Once the script is added, you're going to add something like the following

#!/bin/sh

/usr/sbin/installer -pkg /private/tmp/folderName/TeamViewerHost.pkg -tgt / -applyChoiceChangesXML /private/tmp/folderName/choices.xml

rm -R "/private/tmp/folderName"

Make sure to customize the folderName in the above to reflect the actual name of the folder that holds those files.

Of course, you can do more in the script, such as detect the success or failure status by capturing the exit code of the installer command and doing something appropriate with that, but generally speaking the above is the base framework to get what you're after.

Edit: Just wanted to mention that if you'd rather not have to roll these types of custom packages every time you come across one that can use a choices.xml customization, you might want to add a vote to this Feature Request. Sadly, like SO many other requests, it was asked for years ago but there's been zero movement on it. But all we can do is keep pushing.

ralvarezOES
New Contributor III

Thanks for the detailed instructions. I'm working on this now. I've never used Composer before so hopefully I'll learn something new.

ralvarezOES
New Contributor III

I'm still working on my third attempt at this. My first try I tried to deploy the package in Jamf School and it stayed on "Installing" status. The second package I created I gave some additional permissions to the file app pkg and .xml file in Composer. This package status says it's installed, but is only reporting 838B when the app should be for like 70MB. And the app is not installed.

I'm going to try to edit the script portion next to see if that's the issue.

ralvarezOES
New Contributor III

here's my script. I tested removing the "rm" portion and I can see the files TeamViewerHost.pkg and choices.xml did get copied to the /private/tmp/Teamviewer/ folder. So it must be something with executing the app or maybe permissions. Here's what I'm using:

#!/bin/sh

sudo /usr/sbin/installer -pkg /private/tmp/TeamViewer/TeamViewerHost.pkg -tgt / -applyChoiceChangesXML /private/tmp/TeamViewer/choices.xml

Levi_
Contributor

@ralvarezOES I'm stuck on this too and have tried removing the rm command entry also with no luck. I know for TV15 and forward we are supposed to install it this way but I am going to try and fall back to the prior method and see what happens. If you do get this working can you please let me know what you did?

Edit: So I did get this working after all. Instead of just downloading a generic TVHost pkg from the design and deploy page, I extracted the pkg from a customized host dmg. I also modified the script to assign the TVHost my customizations which you'll see with the idc<yourhostconfig> and I also renamed the pkg to reflect it.

#!/bin/sh

/usr/sbin/installer -pkg /private/tmp/TeamViewerInstall/"Install TeamViewerHost-idc<yourhostconfig>.pkg" -tgt / -applyChoiceChangesXML /private/tmp/TeamViewerInstall/choices.xml

There is a catch though, even though the steps from TV state it assigns the host to your Org, It appears it really doesn't and you need a follow-up script to do that piece from what I gather which I am working on next - https://www.jamf.com/jamf-nation/discussions/38458/teamviewer-assignment-not-working-reliable