Skip to content

Commit 99d0acf

Browse files
committed
xbps/repositories/custom.md: document creating a repository
- 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
1 parent cebc45c commit 99d0acf

File tree

4 files changed

+78
-38
lines changed

4 files changed

+78
-38
lines changed

book.toml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ theme = "src/theme"
1010
[output.html.redirect]
1111
"/about-this-handbook.html" = "/about/about-this-handbook.html"
1212
"/config/man.html" = "/config/package-documentation/man.html"
13+
"/xbps/repositories/signing.html" = "/xbps/repositories/custom.html"
1314

1415
[output.latex]
1516
optional = true

src/SUMMARY.md

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
- [Using Tor Mirrors](./xbps/repositories/mirrors/tor.md)
7676
- [Restricted Packages](./xbps/repositories/restricted.md)
7777
- [Custom Repositories](./xbps/repositories/custom.md)
78-
- [Signing Repositories](./xbps/repositories/signing.md)
7978
- [Troubleshooting XBPS](./xbps/troubleshooting/index.md)
8079
- [Common Issues](./xbps/troubleshooting/common-issues.md)
8180
- [Static XBPS](./xbps/troubleshooting/static.md)

src/xbps/repositories/custom.md

+77-2
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,87 @@ For example, to define a remote repository:
2222
# echo 'repository=http://my.domain.com/repo' > /etc/xbps.d/my-remote-repo.conf
2323
```
2424

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

2929
To define a local repository:
3030

3131
```
32-
# echo 'repository=/path/to/repo' > /etc/xbps.d/my-local-repo.conf
32+
# echo 'repository=/path/to/repository/dir' > /etc/xbps.d/my-local-repo.conf
3333
```
34+
35+
## Creating custom repositories
36+
37+
The [xbps-rindex(1)](https://man.voidlinux.org/xbps-rindex.1) utility is used to
38+
manage xbps repositories.
39+
40+
> When creating a repository for another architecture, prepend `xbps-rindex`
41+
> commands with `XBPS_TARGET_ARCH`. For example: `XBPS_TARGET_ARCH=armv7l-musl
42+
> xbps-rindex ...`
43+
44+
### Adding packages to the repository index
45+
46+
For xbps to know about a package, it must be added to the repository's index.
47+
Packages can be added to the repository index with `--add`:
48+
49+
```
50+
$ xbps-rindex --add /path/to/repository/dir/*.xbps
51+
```
52+
53+
### Signing repositories and packages
54+
55+
Remote repositories **must** be signed. Local repositories do not need to be
56+
signed.
57+
58+
The private key for signing packages needs to be a PEM-encoded RSA key. The key
59+
can be generated with either
60+
[ssh-keygen(1)](https://man.voidlinux.org/ssh-keygen.1) or
61+
[openssl(1)](https://man.voidlinux.org/openssl.1):
62+
63+
```
64+
$ ssh-keygen -t rsa -b 4096 -m PEM -f private.pem
65+
```
66+
67+
```
68+
$ openssl genrsa -des3 -out private.pem 4096
69+
```
70+
71+
Once the key is generated, the public part of the private key has to be added to
72+
the repository metadata. This step is required only once.
73+
74+
```
75+
$ xbps-rindex --privkey private.pem --sign --signedby "I'm Groot" /path/to/repository/dir
76+
```
77+
78+
Then sign one or more packages with the following command:
79+
80+
```
81+
$ xbps-rindex --privkey private.pem --sign-pkg /path/to/repository/dir/*.xbps
82+
```
83+
84+
> Packages added later will not be automatically signed. Repeat the previous
85+
> command to sign newly-added packages.
86+
87+
### Cleaning the repository index
88+
89+
When adding new versions of packages, `--remove-obseletes` can be used to purge
90+
the old version from both the repository index and remove the `.xbps` and `.sig`
91+
files from disk:
92+
93+
```
94+
$ xbps-rindex --remove-obseletes /path/to/repository/dir
95+
```
96+
97+
When removing a package from the repository, first remove the files from disk,
98+
then use `--clean` to remove the package from the repository index:
99+
100+
```
101+
$ xbps-rindex --clean /path/to/repository/dir
102+
```
103+
104+
### Serving remote repositories
105+
106+
Remote repositories can be served by any HTTP daemon, like nginx or lighttpd, by
107+
configuring it to serve `/path/to/repository/dir` on the domain and path
108+
desired.

src/xbps/repositories/signing.md

-35
This file was deleted.

0 commit comments

Comments
 (0)