Custom PKG built with Packages fails to install....sometimes

Chuey
Contributor III

I code signed a script, put it in a tar.gz and then created a custom PKG using the Packages App with a post-install script to move the file into its place -- Packages App found here.

I followed this guide by Carl Ashley found here

I have a MacBook Air that it installs on successfully (macOS 10.14.3)

Just got a brand new MacBook Pro that it fails to install on (macOS 10.14.3)

It puts my pList into the right place but it appears my post install script, which unzips the tar.gz and moves the file -- fails...causing the PKG to fail to install. Not sure why this is happening.

I followed the guide from Carly Ashley and I'm just wondering if its the post install script. Here is the code i'm using:

#!/bin/bash

resources=$(dirname $0)
target_vol=$3
package_bundle_id=$INSTALL_PKG_SESSION_ID

/usr/bin/tar -xpf ${resources}/file.tar.gz -C /Library/Scripts/Folder
/usr/sbin/chown root:wheel /Library/Scripts/Folder/mount.sh

I pulled this directly from the article. Like I said it works on the one machine but not the one I just got in today?

I'm not too familiar with the packages app or how to access files bundled with it via command line.

Any help is much appreciated.

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

If I had to take a guess, you probably need to create the directory /Library/Scripts/Folder or whatever it actually is before untaring it. mkdir -p /Library/Scripts/Folder/ The -C option in tar moves into a directory before un-taring, but it doesn't create the directory path you specify. If it's not there, the move into the folder, and subsequently the untar will fail.
Is it possible you pre-created the directory path on the first machine you tested it on, as part of your testing, and that's why it works on that first system?

View solution in original post

2 REPLIES 2

mm2270
Legendary Contributor III

If I had to take a guess, you probably need to create the directory /Library/Scripts/Folder or whatever it actually is before untaring it. mkdir -p /Library/Scripts/Folder/ The -C option in tar moves into a directory before un-taring, but it doesn't create the directory path you specify. If it's not there, the move into the folder, and subsequently the untar will fail.
Is it possible you pre-created the directory path on the first machine you tested it on, as part of your testing, and that's why it works on that first system?

Chuey
Contributor III

@mm2270 Wow, that was it! Thanks so much for stating the obvious that I over looked!