.TH "ALPM-MTREEv2" 5 .SH "NAME" .PP \fBALPM\-MTREE\fP \- Package directory hierarchy description format\. .SH "DESCRIPTION" .PP The \fBmtree\fP format is a textual format that describes the hierarchy and metadata of files in a directory\. .PP \fBmtree\fP is a well\-known format that can, for example, be used for installation instructions or to verify files' metadata and the hierarchy of a directory\. .PP The \fBALPM\-MTREE\fP format adheres to the official \fBmtree\fP specification\. However, \fB\.MTREE\fP files used in the context of ALPM packages only use a subset of the official \fBmtree\fP format that makes sense in the scope of packaging\. .SS "Properties" .PP \fB\.MTREE\fP files that're generated by `\f[CR]makepkg\fP` only contain the following properties: .RS .Bl .IP \(bu 4 `\f[CR]type\fP` .El .Bl .IP \(bu 4 `\f[CR]uid\fP` .El .Bl .IP \(bu 4 `\f[CR]gid\fP` .El .Bl .IP \(bu 4 `\f[CR]mode\fP` .El .Bl .IP \(bu 4 `\f[CR]time\fP` .El .Bl .IP \(bu 4 `\f[CR]size\fP` .El .Bl .IP \(bu 4 `\f[CR]md5\fP` .El .Bl .IP \(bu 4 `\f[CR]sha256\fP` .El .Bl .IP \(bu 4 `\f[CR]link\fP` .El .RE .PP Furthermore, as `\f[CR]mtree\fP` files are used in the scope of Arch Linux packaging and always relate to files inside of Arch Linux packages\. Due to this, all paths inside an \fBALPM\-MTREE\fP must be relative to the package, except link destinations, which may point outside of a package\. .SB "Path Type Property" .PP In contrast to all available types in \fBmtree\fP, \fBALPM\-MTREE\fP only allows three file types: .RS .Bl .IP \(bu 4 `\f[CR]dir\fP` A directory .El .Bl .IP \(bu 4 `\f[CR]file\fP` A file .El .Bl .IP \(bu 4 `\f[CR]link\fP` A symbolic link .El .RE .PP The other types are forbidden, as they should not be included in package\. .SB "Required Fields by File Type" .PP \fBALPM\-MTREE\fP requires specific values to be set for certain file types, which is something \fBmtree\fP doesn't enforce by spec\. .PP The \fBdir\fP path type requires the following properties to be set: .RS .Bl .IP \(bu 4 `\f[CR]path\fP` .El .Bl .IP \(bu 4 `\f[CR]uid\fP` .El .Bl .IP \(bu 4 `\f[CR]gid\fP` .El .Bl .IP \(bu 4 `\f[CR]mode\fP` .El .Bl .IP \(bu 4 `\f[CR]time\fP` .El .RE .PP The \fBfile\fP path type requires the following properties to be set: .RS .Bl .IP \(bu 4 `\f[CR]path\fP` .El .Bl .IP \(bu 4 `\f[CR]uid\fP` .El .Bl .IP \(bu 4 `\f[CR]gid\fP` .El .Bl .IP \(bu 4 `\f[CR]mode\fP` .El .Bl .IP \(bu 4 `\f[CR]size\fP` .El .Bl .IP \(bu 4 `\f[CR]md5_digest\fP` .El .Bl .IP \(bu 4 `\f[CR]sha256_digest\fP` .El .Bl .IP \(bu 4 `\f[CR]time\fP` .El .RE .PP The \fBlink\fP path type requires the following properties to be set: .RS .Bl .IP \(bu 4 `\f[CR]path\fP` .El .Bl .IP \(bu 4 `\f[CR]uid\fP` .El .Bl .IP \(bu 4 `\f[CR]gid\fP` .El .Bl .IP \(bu 4 `\f[CR]mode\fP` .El .Bl .IP \(bu 4 `\f[CR]link\fP` .El .Bl .IP \(bu 4 `\f[CR]time\fP` .El .RE .SS "Usage in Pacman" .PP In Pacman \fBALPM\-MTREE\fP files are solely used to verify that installed files are identical to the original files without having to keep the original package around\. \fB\.MTREE\fP files are implicitly generated and included when creating packages via `\f[CR]makepkg\fP`\. The gzip\-compressed \fB\.MTREE\fP file is located in the root of ALPM based packages .SS "Versioning" .PP The \fBALPM\-MTREE\fP format exists in multiple versions\. The information in this document is for version 2, which is the current version\. It has been introduced with the release of pacman 6\.1\.0 on 2024\-03\-04\. .SB "Changes since the last version" .PP The \fBmd5\fP field is no longer generated, effectively making this a breaking change\. .SH "EXAMPLES" .RS .PP .nf #mtree /set type=file uid=0 gid=0 mode=644 \./\.BUILDINFO time=1696727741\.0 size=5574 sha256digest=708be566788a6a2712bcd40425d93761569ede07371781374edb1f22e2a3eb96 \./\.PKGINFO time=1696727741\.0 size=830 sha256digest=3aa17bec02b34c157e7c739c62e0e37a9d19f1459d404d7c6f2c14c6008127cd /set mode=755 type=dir \./usr time=1731613789\.0 \./usr/bin time=1731613789\.0 \./usr/bin/resolvconf time=1731613789\.0 mode=777 type=link link=resolvectl .fi .RE .SS "Generation" .PP ALPM's mtree files are generated by calling: .RS .PP .nf bsdtar \ \-\-format=mtree \ \-\-options='!all,use\-set,type,uid,gid,mode,time,size,sha256,link' \ $folder .fi .RE .SS "Usages" .PP In the context of ALPM and `\f[CR]pacman\fP`, the `\f[CR]mtree\fP` file's main purpose is to provide a performant way of getting a package's file metadata without having to extract and read the whole package\. .PP This data is then used to verify installed files on the target system against the original files from the package\. Take a look at `\f[CR]pacman\fP`'s query check functionality for more detail\. .SH "SEE ALSO" .PP \fBmtree\fP(5), \fBmakepkg\fP(8), \fBpacman\fP(8)