A MatterLinux repo is a FTP or web server that contains unique [packages](/wiki/package). 

# Structure 
A repo contains:

- Packages (`.mpf`)
- Package signatures (`.mpf.sig`)
- Repo metadata
- Package list

### Package Files and Signatures
MatterLinux repos contain at least two package. Each package also has a PGP signature 
that can be used to verify the package. These signatures belong to public key fingerprint
specified in the repo metadata.

### Repo Metadata
Repo metadata contains information about the repo itself. Such as the repo name,
author and the public key used to sign the packages.

This metadata can be found in the `repo` file at the root of the repo. For example
the repo metadata for `https://pkgs.matterlinux.xyz/base` is located at 
`https://pkgs.matterlinux.xyz/base/repo`. `INI` format is used for this metadata file.

### Package List
A list containing all packages and all the package metadata can be found in an 
archive file named after the repo. For example the package list for 
`https://pkgs.matterlinux.xyz/base` is located at `https://pkgs.matterlinux.xyz/base/base.tar.gz`.

This archive file contains a file named `pkgs`, which contains repo package list in the 
`INI` format. It contains the package names, descriptions, versions, sums and dependencies.

### Repo Source
Source for a repo has a simple structure that also contains all the source files for the packages.
For example lets take a look the structure of the [`base`](https://pkgs.matterlinux.xyz/base) 
repo source:
```
├── dist
│   ├── acl_2.3.1.mpf
│   ├── acl_2.3.1.mpf.sig
│   ├── base.tar.gz
│   ...
│   ├── repo
│   ├── sed_4.9.mpf
│   ├── sed_4.9.mpf.sig
│   ...
├── LICENSE.txt
├── README.md
├── repo.sh
├── sign-dist.sh
└── src
    ├── acl
    │   └── pkg.sh
    ├── attr
    │   └── pkg.sh
    ├── autoconf
    │   └── pkg.sh
    ├── automake
    │   └── pkg.sh
    ├── bash
    │   ├── pkg.sh
    │   ├── skelprof
    │   └── skelrc
    ...
```
Let's break this down:

- `LICENSE.txt`: License used for the repo. **All the packages in the repo should use a license
compatible with this license.**
- `README.md`: README file. Contains a small description about the repo.
- `repo.sh`: Repo script contains information about the repo, later used to build the 
repo metadata.
- `src`: Contains package sources (package scripts, extra patches, configuration files etc.)
- `dist`: Contains the compiled (built) packages. 
- `sign-dist.sh`: An extra shell script that you can find in the official repos. It is just a 
small script that is used to sign all the packages in the `dist` directory if they are built 
without the signatures.

# Usage 
MatterLinux releases offer 2 different repos, `base` and `desktop`. There are also development/testing 
`base` and `desktop` repos ("next repos"). URLs for these repos and the mirrors can be found at the [mirrors page](/wiki/mirrors). 

This repos can provide packages for users, these packages can be managed using the 
[MatterLinux Package Manager (`mp`)](https://git.matterlinux.xyz/matter/mp). For more information see the page for [package management](/wiki/package_man).

### Building an already existing repo
To build an already existing repo, such as the `base` or the `desktop` repo, first you will need to 
download the repos source. Source for the `base` and the `desktop` repo can be found on 
[MatterLinux Git Server](https://git.matterlinux.xyz/matter).

After downloading the repo source, you will need to install the `mp-repo` tool, which is the tool 
used for building MatterLinux repos. To do so please follow the steps [here](https://git.matterlinux.xyz/Matter/mp-repo#installation).

Finally to build the repo:
```
$ mp-repo <repo dir>
```

You will mostly likely want to disable package signing though, as you are probably not the 
owner of the repo:
```
$ mp-repo --no-sign <repo dir>
```

### Creating a new repo
If you want to create an unofficial repo, setup the folder structure for the source repo as 
explained above. Then create a repo script, you can copy one from the official repos and 
edit it.

After adding your packages and building them with `mp-repo`, you can host them on an FTP
or a web server to make it available to other people. Also you can add this unofficial repo 
to this wiki page [by creating an issue](https://git.matterlinux.xyz/Matter/content/issues).
