[openbeos] Package Format Notes and Test Files

Hello all,

This message is primarily for Lukasz Zemczak, who is working on the pkg 
file installer for the Google Summer of Code. But since others may have 
some interest in this, I'm posting it to this list.

Below are my notes on this format. At the following URL is a zip file 
containing these notes (in docs.txt) as well as several example pkg 
files I built with PackageBuilder and their hex dumps generated by xxd 
(which comes with VIM.)

http://www.netrox.net/~mrcode/pkg_reader.zip

The notes:

The pkg file format consists of various 4 byte 0-terminated string tags 
and associated data in various formats.

The tags always have 2 bytes following the null terminator that appear 
to be some sort of flags or something. Or they may mean nothing.

Tag Names Expanded
------------------

* File Header

AlB: ???
PhIn: ???
FVer: File Version
AFla: ???
FSiz: File Size
COff: Catalog? Offset (gives a file offset where the FldI section 
begins)
AOff: Attribute? Offset (gives a file offset where the PkgA section 
begins)
FldI: Folder Install?, Field Info?
FDat: File Data?
PkgA: Package attributes?

* Install Directory Information

DPat: Directory Path (section header)
PaNa: Path Name
FDst: File Destination?

* License Information

Lic?: Has a License
LicP: License Pointer? (after this tag the file name for the license 
file on the host is stored)

* Group Information

IGrp: Install Group (section header)
GrpN: Group Name
GrpD: Group Description
GrHt: Group Help Text
GrId: Group Id

The group IDs are encoded in 4 bytes, starting from 0. A separator is 
encoded as a GrId of 0xFFFFFFFF.

* File Information

FiDa: File Data (section header)
FiMF: File ? (the deflated file data follows this)
FBeA: File's Be Attributes (section header)
BeAI: Be Attribute Information?
BeAN: Be Attribute Name (the name of the attribute follows, preceded by 
its length)
BeAT: Be Attribute Type (a four digit ASCII code follows, like MIMS = 
MIME String or CSTR = C String)
BeAD: Be Attribute Data (the deflated attribute data follows this, with 
other stuff in between, like the int64 length of the zipped data and 
the int64 expected length after unzipping and some random int32.)
FilI: File Information (section header)
Mime: The file's MIME type, followed by that type with the usual length 
+ string
Mode: The file's mode, followed by the mode in int32 it seems
VrsI: ???, it has 24 bytes following the usual null term and int16 flag
Name: the file's name, followed by length + string
Grps: Groups (int32)
Dest: Destination (int32, 0xFFFFFFFF means the install directory)
Cust: Customize? (int16)
Repl: Replace? (int16)
Plat: Platform (int32, 0xFFFFFFFF means any)
CTim: Creation Time
Mtim: Modification Time
OffT: Offset? (int32)
CmpS: Compressed Size (int64)
OrgS: Original Size (int64)

* Folder Information

FoDa: Folder Data
Similar attribute data as the files
FldI: Folder Information


Regards,
Ryan Leavengood

Other related posts: