Script works when added in policy, but not when added as postinstall in Composer

New Contributor II


When installing SPSS we use a pkg to place the files on the hard drive, and then run a script after to run the install and clear the files. This is working as expected when the script is added to the policy in jamf.

However, I thought it would be easier to add the script directly in the pkg instead, since it less to keep track off. So I just took the script and pasted it in a postinstall, built the pkg and created a new policy. The files are transfered to the correct location but the script does not seem to run.

I havent really used script inside pkgs much before, so it might very well be that I have misunderstood how it works. But as far as I understand, thats how it should work. Pasting the script below (also this might not be the best way to do things, but you know, learning by doing)


# This script is used together with the SPSS 26 Concurrent.pkg that adds the following files to the computer:
# /private/var/tmp/spss26install/SPSS_Statistics_Installer.bin
# /private/var/tmp/spss26install/
# /Library/Java/JavaVirtualMachines/zulu-8.jdk

#Changes to Java SDK 8 for this session in case a newer version is also installed
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8.0_242)

#Run SPSS installer
./private/var/tmp/spss26install/SPSS_Statistics_Installer.bin -f

#Remove temporary files
rm -R /private/var/tmp/spss26install
rm -R /Library/Java/JavaVirtualMachines/zulu-8.jdk