You are not logged in.

#1 2023-08-18 19:08:56

rashfeather
Member
Registered: 2010-01-25
Posts: 13

Veilid

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

#2 2023-08-18 19:23:05

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Veilid

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

#3 2023-08-18 19:26:43

rashfeather
Member
Registered: 2010-01-25
Posts: 13

Re: Veilid

Trilby wrote:

The proper way to do this is with a systemd-sysusers file.

Can you point me to an example?

Trilby wrote:

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

#4 2023-08-18 19:31:57

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Veilid

man sysusers.d


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2023-08-19 23:02:03

loqs
Member
Registered: 2014-03-06
Posts: 18,077

Re: Veilid

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

#6 2023-08-20 09:54:56

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,116
Website

Re: Veilid

rashfeather wrote:
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

#7 2023-08-22 13:22:43

loqs
Member
Registered: 2014-03-06
Posts: 18,077

Re: Veilid

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

#8 2023-09-06 20:07:34

piratebill
Member
From: Sol System
Registered: 2011-10-20
Posts: 136

Re: Veilid

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

Board footer

Powered by FluxBB