Replace files in a package?

DanJ_LRSFC
Contributor III

I have a package that I need to replace/edit a couple of files in, is there a quick/easy way to do this without having to install the package to its absolute destination location?

Specifically, I have a package that contains a folder "/Library/Application Support/ABMaintainer" with a binary file ABMaintainer and a plist file com.abtutor.permanentPreferences.plist, I need to be able to replace those two files with the newest versions without having to actually copy them locally to their final "/Library/Application Support/ABMaintainer" location on my Mac.

I tried using Composer but it didn't seem like it would let me replace the files unless I had them already in their destination locations.

1 ACCEPTED SOLUTION

sdagley
Esteemed Contributor II

@DanJ_LRSFC Did you create the package in Composer on your Mac? If not you can use the Convert to Source button in Composer. Just find the files you want to replace in the Composer window for the package and drag the new files into the appropriate spots in the package structure. They don't have to be in the actual locations on your Mac. Just be sure to reset the permissions after you drag the new files into Composer.

View solution in original post

3 REPLIES 3

walt
Contributor III

i dont know if this will work or help for this specific case, but for something like Cisco AnyConnect I used pkgutil

(assuming the pkg is on the desktop)

cd ~/Desktop
pkgutil --expand PackageName.pkg ~/Desktop/packagename-expanded (this will create a new folder with the pkg files)
pkgutil --flatten ~/Desktop/packagename-expanded ~/Desktop/PackageName.pkg

sdagley
Esteemed Contributor II

@DanJ_LRSFC Did you create the package in Composer on your Mac? If not you can use the Convert to Source button in Composer. Just find the files you want to replace in the Composer window for the package and drag the new files into the appropriate spots in the package structure. They don't have to be in the actual locations on your Mac. Just be sure to reset the permissions after you drag the new files into Composer.

donmontalvo
Esteemed Contributor III

Expanding and flattening would strip the signing cert, if the original was signed. If Computer is set up to sign, should be fine. If signing matters in your shop.

--
https://donmontalvo.com