How to create package from command line?

Joined
Aug 11, 2012
Messages
85
Reaction score
1
Points
8
Location
San Diego, CA
The only relevant post I can find is Create an OS X package from the command line - Mac OS X Hints but it isn't very helpful... man package says there is no such option as "dstroot", and also gives no examples of how to create. That post also refers to somehow coming up with an info file but gives a bad link.

Here's the scoop... I have a package that I modified. It's a XAR archive, so I broke it open, opened up the payload (which was a gripped cpio archive), modified one line in one file, and reversed my steps. But when I run my resulting package, I get:

Code:
Feb 11 14:46:53 flamingo installd[95098]: PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=110 "An error occurred while extracting files from the package “cma.pkg”." UserInfo=0x103ba63f0 {NSLocalizedDescription=An error occurred while extracting files from the package “cma.pkg”., NSURL=file://localhost/Users/jnojr/tmp2/assets/cma.pkg#cma.pkg, PKInstallPackageIdentifier=comp.nai.cmamac, NSUnderlyingError=0x103b9d810 "The operation couldn’t be completed. cpio read error: bad file format"} {
	    NSLocalizedDescription = "An error occurred while extracting files from the package \U201ccma.pkg\U201d.";
	    NSURL = "file://localhost/Users/jnojr/tmp2/assets/cma.pkg#cma.pkg";
	    NSUnderlyingError = "Error Domain=BOMCopierFatalError Code=1 \"The operation couldn\U2019t be completed. cpio read error: bad file format\" UserInfo=0x103ba73b0 {NSLocalizedFailureReason=cpio read error: bad file format, offset=16222840, type=BOMCopierFatalError, sourcePath=/Users/jnojr/tmp2/assets/cma.pkg, destinationPath=/tmp/PKInstallSandbox.TAKSaX/Scripts/comp.nai.cmamac.Ci5OOT}";
	    PKInstallPackageIdentifier = "comp.nai.cmamac";
	}
Feb 11 14:46:53 flamingo installer[95094]: install:didFailWithError:Error Domain=PKInstallErrorDomain Code=110 "An error occurred while extracting files from the package “cma.pkg”." UserInfo=0x7fe88946daa0 {NSUnderlyingError=0x7fe88946c050 "The operation couldn’t be completed. cpio read error: bad file format", NSURL=file://localhost/Users/jnojr/tmp2/assets/cma.pkg#cma.pkg, PKInstallPackageIdentifier=comp.nai.cmamac, NSLocalizedDescription=An error occurred while extracting files from the package “cma.pkg”.}
Feb 11 14:46:54 flamingo installer[95094]: Install failed: The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.

The steps I took to create my package:

cd tmp2; xar -xf /Volumes/MFECMA/cma.pkg
cd cma.pkg
mkdir tmp; cd tmp
cat ../Payload | gunzip -dc | cpio -i
EDIT FILE
rm -f ../Payload
find . | cpio -o | gzip -c > ../Payload
cd ..
rm -fr tmp
cd ..
xar -cf ../cma.pkg .

I'm not sure if I screwed up, did a typo, or what. Or if there's another process that I need to follow.
 
OP
jnojr
Joined
Aug 11, 2012
Messages
85
Reaction score
1
Points
8
Location
San Diego, CA
I found pkgbuild, and tried:

pkgbuild --analyze --root /tmp/Sample.dst components.plist
pkgbuild --identifier com.sample.pkg.app --root /tmp/Sample.dst --component-plist components-edited.plist Sample.pkg

That didn't work either... it created a package that seemed to run successfully, but didn't actually do anything.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top