@@ -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
2727packages from remote repositories if they are not signed.
2828
2929To 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.
0 commit comments