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