Skip to content

Commit

Permalink
xbps/repositories/custom.md: document creating a repository
Browse files Browse the repository at this point in the history
- xbps/repositories/signing.md was merged into custom.md with minor
  modifications
  - signing.md is now redirected to custom.md
- incorporates @camoz's change to show using 4096-bit RSA keys for signing

closes void-linux#641
  • Loading branch information
classabbyamp committed May 30, 2022
1 parent fbd6bca commit f438a8e
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 38 deletions.
1 change: 1 addition & 0 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ theme = "src/theme"
[output.html.redirect]
"/about-this-handbook.html" = "/about/about-this-handbook.html"
"/config/man.html" = "/config/package-documentation/man.html"
"/xbps/repositories/signing.html" = "/xbps/repositories/custom.html"

[output.latex]
optional = true
Expand Down
1 change: 0 additions & 1 deletion src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
- [Using Tor Mirrors](./xbps/repositories/mirrors/tor.md)
- [Restricted Packages](./xbps/repositories/restricted.md)
- [Custom Repositories](./xbps/repositories/custom.md)
- [Signing Repositories](./xbps/repositories/signing.md)
- [Troubleshooting XBPS](./xbps/troubleshooting/index.md)
- [Common Issues](./xbps/troubleshooting/common-issues.md)
- [Static XBPS](./xbps/troubleshooting/static.md)
Expand Down
79 changes: 77 additions & 2 deletions src/xbps/repositories/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,87 @@ For example, to define a remote repository:
# echo 'repository=http://my.domain.com/repo' > /etc/xbps.d/my-remote-repo.conf
```

Remote repositories need to be [signed](./signing.md).
Remote repositories need to be [signed](#signing-repositories-and-packages).
[xbps-install(1)](https://man.voidlinux.org/xbps-install.1) refuses to install
packages from remote repositories if they are not signed.

To define a local repository:

```
# echo 'repository=/path/to/repo' > /etc/xbps.d/my-local-repo.conf
# echo 'repository=/path/to/repository/dir' > /etc/xbps.d/my-local-repo.conf
```

## Creating custom repositories

The [xbps-rindex(1)](https://man.voidlinux.org/xbps-rindex.1) utility is used to
manage xbps repositories.

> When creating a repository for another architecture, prepend `xbps-rindex`
> commands with `XBPS_TARGET_ARCH`. For example: `XBPS_TARGET_ARCH=armv7l-musl
> xbps-rindex ...`
### Adding packages to the repository index

For xbps to know about a package, it must be added to the repository's index.
Packages can be added to the repository index with `--add`:

```
$ xbps-rindex --add /path/to/repository/dir/*.xbps
```

### Signing repositories and packages

Remote repositories **must** be signed. Local repositories do not need to be
signed.

The private key for signing packages needs to be a PEM-encoded RSA key. The key
can be generated with either
[ssh-keygen(1)](https://man.voidlinux.org/ssh-keygen.1) or
[openssl(1)](https://man.voidlinux.org/openssl.1):

```
$ ssh-keygen -t rsa -b 4096 -m PEM -f private.pem
```

```
$ openssl genrsa -des3 -out private.pem 4096
```

Once the key is generated, the public part of the private key has to be added to
the repository metadata. This step is required only once.

```
$ xbps-rindex --privkey private.pem --sign --signedby "I'm Groot" /path/to/repository/dir
```

Then sign one or more packages with the following command:

```
$ xbps-rindex --privkey private.pem --sign-pkg /path/to/repository/dir/*.xbps
```

> Packages added later will not be automatically signed. Repeat the previous
> command to sign newly-added packages.
### Cleaning the repository index

When adding new versions of packages, `--remove-obseletes` can be used to purge
the old version from both the repository index and remove the `.xbps` and `.sig`
files from disk:

```
$ xbps-rindex --remove-obseletes /path/to/repository/dir
```

When removing a package from the repository, first remove the files from disk,
then use `--clean` to remove the package from the repository index:

```
$ xbps-rindex --clean /path/to/repository/dir
```

### Serving remote repositories

Remote repositories can be served by any HTTP daemon, like nginx or lighttpd, by
configuring it to serve `/path/to/repository/dir` on the domain and path
desired.
35 changes: 0 additions & 35 deletions src/xbps/repositories/signing.md

This file was deleted.

0 comments on commit f438a8e

Please sign in to comment.