You are not logged in.
Pages: 1
Hey all, I'm trying to write a PKGBUILD for the server and CLI components of Veilid (https://gitlab.com/veilid/veilid), but I'm getting stuck on the part where I need to create a user.
I researched a bunch of old threads, but I still haven't found some code samples on which to base some work.
Here's the PR I'm trying to review: https://github.com/socketwench/veilid-g … nux/pull/2
Offline
Reject that PR, it's just completely wrong and will fail spectacularly in all kinds of cases as it (tries to) create a user on the build root not the target machine the package in installed on.
The proper way to do this is with a systemd-sysusers file.
Note too that there are other issues with that PKGBUILD. The arch cannot be "any", the description doesn't really describe anything (and it includes the package name which it shouldn't)*, license should be MPL2 to match the name from the common licenses, and the source should be listed in the source array not obtaind during prepare().
*this thread title has a related problem.
Last edited by Trilby (2023-08-18 19:23:49)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
The proper way to do this is with a systemd-sysusers file.
Can you point me to an example?
Note too that there are other issues with that PKGBUILD.
Yep! This is only the second time I've ever tried to write one. This is why it's only on Github right now. I didn't want to submit it to AUR until more of the bugs are worked out.
Offline
man sysusers.d
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Some other issues in the PKGBUILD.
wasm-bindgen-cli and wasm-pack are not used as the target arch is x86-64 not wasm32 if they were need wasm-bindgen and wasm-pack are already packaged.
I suspect all the depends should be makedepends.
The PKGBUILD is not following Rust_package_guidelines.
Offline
Trilby wrote:The proper way to do this is with a systemd-sysusers file.
Can you point me to an example?
It's a group here, but the process is the same for adding users:
https://aur.archlinux.org/cgit/aur.git/ … t-mode#n29
https://github.com/conqp/tablet-mode/bl … mode.group
Inofficial first vice president of the Rust Evangelism Strike Force
Offline
diff of changes adding git sources to sources array, disable lto option which breaks build try to use LTO with rust flags instead, use cargo fetch in prepare and frozen option in build.
diff --git a/PKGBUILD b/PKGBUILD
index 28cbf11..32c257c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,4 +1,5 @@
pkgname=veilid-server-git
+_pkgname=veilid
pkgver=20230813
pkgrel=1
pkgdesc="Tools and the backend server for the privacy-focused application framework Veilid"
@@ -6,18 +7,54 @@ arch=('x86_64')
url="https://gitlab.com/veilid/veilid/"
license=('MPL2')
makedepends=('git' 'rust' 'capnproto' 'protobuf')
-source=("systemd-sysusers.conf")
-sha256sums=('21fd31902c990813d8f33258d0bb5ab4a002deeeedb88865982d69124b803031')
+options=('!lto')
+source=("git+https://gitlab.com/veilid/veilid.git"
+ "git+https://gitlab.com/veilid/cursive.git"
+ "git+https://gitlab.com/veilid/cursive-buffered-backend.git"
+ "git+https://gitlab.com/veilid/cursive-flexi-logger-view.git"
+ "git+https://gitlab.com/veilid/keyring-manager.git"
+ "git+https://gitlab.com/veilid/keyvaluedb.git"
+ "git+https://gitlab.com/veilid/libmdns.git"
+ "git+https://gitlab.com/veilid/mdns.git"
+ "git+https://gitlab.com/veilid/hashlink.git"
+ "git+https://gitlab.com/veilid/rust-igd.git"
+ "systemd-sysusers.conf")
+sha256sums=('SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ '21fd31902c990813d8f33258d0bb5ab4a002deeeedb88865982d69124b803031')
+
+# Use LTO
+export CARGO_PROFILE_RELEASE_LTO=true CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
+
+# Use debug
+export CARGO_PROFILE_RELEASE_DEBUG=2
prepare() {
cd "$_pkgname"
- if [ -d veilid-git ]; then rm -Rf veilid-git; fi
- git clone --recurse-submodules https://gitlab.com/veilid/veilid.git veilid-git
+ git submodule init
+ git config submodule.external/cursive.url "$srcdir/cursive"
+ git config submodule.external/cursive-buffered-backend.url "$srcdir/cursive-buffered-backend"
+ git config submodule.external/cursive-flexi-logger-view.url "$srcdir/cursive-flexi-logger-view"
+ git config submodule.external/keyring-manager.url "$srcdir/keyring-manager"
+ git config submodule.external/keyvaluedb.url "$srcdir/keyvaluedb"
+ git config submodule.external/libmdns.url "$srcdir/libmdns"
+ git config submodule.external/mdns.url "$srcdir/mdns"
+ git config submodule.external/hashlink.url "$srcdir/hashlink"
+ git config submodule.external/rust-igd.url "$srcdir/rust-igd"
+ git -c protocol.file.allow=always submodule update
+ cargo fetch --locked --target x86_64-unknown-linux-gnu
}
pkgver() {
cd "$_pkgname"
- cd veilid-git
( set -o pipefail
git describe --long --tag | sed -r 's/([^-]*-g)/r\1/;s/-/./g' ||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
@@ -26,18 +63,18 @@ pkgver() {
build() {
cd "$_pkgname"
- cargo build --features=rt-tokio --manifest-path=veilid-git/Cargo.toml --release --bin veilid-server
- cargo build --features=rt-tokio --manifest-path=veilid-git/Cargo.toml --release --bin veilid-cli
+ cargo build --features=rt-tokio --release --frozen --bin veilid-server
+ cargo build --features=rt-tokio --release --frozen --bin veilid-cli
}
package() {
cd "$_pkgname"
install -m 755 -d "${pkgdir}/usr/lib/sysusers.d"
install -m 644 "${srcdir}/systemd-sysusers.conf" "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
- install -Dm744 veilid-git/target/release/veilid-cli "${pkgdir}/usr/bin/veilid-cli"
- install -Dm744 veilid-git/target/release/veilid-server "${pkgdir}/usr/bin/veilid-server"
- install -Dm744 veilid-git/package/linux/veilid-server.conf "${pkgdir}/etc/veilid-server/veilid-server.conf"
- install -Dm744 veilid-git/package/systemd/veilid-server.service "${pkgdir}/usr/lib/systemd/system/veilid-server.service"
+ install -Dm744 target/release/veilid-cli "${pkgdir}/usr/bin/veilid-cli"
+ install -Dm744 target/release/veilid-server "${pkgdir}/usr/bin/veilid-server"
+ install -Dm744 package/linux/veilid-server.conf "${pkgdir}/etc/veilid-server/veilid-server.conf"
+ install -Dm744 package/systemd/veilid-server.service "${pkgdir}/usr/lib/systemd/system/veilid-server.service"
install -d --mode=750 "${pkgdir}/var/db/veilid-server/"
}
Not done use systemd-tmpfiles to change ownership of /var/db/veilid-server/.
Edit:
An alternative to using systemd-tmpfiles would be change the config to use /var/lib/veilid-server/ instead of /var/db/veilid-server/ then override veilid-server.service adding RuntimeDirectory then systemd will adjust the permissions when the service starts you could also use ConfigurationDirectory for /etc/veilid-server/.
[1] https://gitlab.com/veilid/veilid/-/blob … erver.conf
Last edited by loqs (2023-08-22 18:52:54)
Offline
If you are still stuck on this, I have an example on how to do this. Checkout the kavita-bin package in the AUR. https://aur.archlinux.org/packages/kavita-bin
Specifically the kavita.sysusers file. Details on that are https://man.archlinux.org/man/sysusers.d.5.
Offline
Pages: 1