Index | Thread | Search

From:
Kirill A. Korinsky <kirill@korins.ky>
Subject:
Re: misc/llama.cpp: add rc script for llama-server
To:
ports@openbsd.org
Date:
Mon, 10 Nov 2025 21:42:42 +0100

Download raw body.

Thread
On Mon, 10 Nov 2025 20:18:37 +0100,
Stuart Henderson <stu@spacehopper.org> wrote:
> > 
> > Probably don't understand. LOCALSTATEDIR is /var, isn't it?
> 
> the whole point of having a variable is for the extremely unlikely
> case somebody might rebuild packages with it set to something
> different.
> 
> so, in that case, all references within the package need to be
> consistent with each other, either /var, or ${LOCALSTATEDIR}.
> 

I don't understand how to use ${LOCALSTATEDIR} in .login file, so I've
replaced to /var and /etc both variables in PLIST.

Ok for this?

Index: misc/llama.cpp/Makefile
===================================================================
RCS file: /home/cvs/ports/misc/llama.cpp/Makefile,v
diff -u -p -r1.11 Makefile
--- misc/llama.cpp/Makefile	4 Nov 2025 15:05:41 -0000	1.11
+++ misc/llama.cpp/Makefile	10 Nov 2025 15:39:50 -0000
@@ -3,6 +3,7 @@ COMMENT =		LLM inference system
 GH_ACCOUNT =		ggml-org
 GH_PROJECT =		llama.cpp
 GH_TAGNAME =		b6934
+REVISION =		0
 PKGNAME =		llama.cpp-0.0.${GH_TAGNAME:S/b//}
 
 SHARED_LIBS +=		llama 3.0
Index: misc/llama.cpp/pkg/PLIST
===================================================================
RCS file: /home/cvs/ports/misc/llama.cpp/pkg/PLIST,v
diff -u -p -r1.5 PLIST
--- misc/llama.cpp/pkg/PLIST	1 Oct 2025 19:44:07 -0000	1.5
+++ misc/llama.cpp/pkg/PLIST	10 Nov 2025 20:41:45 -0000
@@ -1,3 +1,6 @@
+@newgroup _llama-server:583
+@newuser _llama-server:583:_llama-server::llama-server account:${LOCALSTATEDIR}/db/llama-server:/sbin/nologin
+@rcscript ${RCDIR}/llama_server
 bin/convert_hf_to_gguf.py
 @bin bin/llama-batched
 @bin bin/llama-batched-bench
@@ -43,3 +46,10 @@ lib/cmake/llama/llama-version.cmake
 @lib lib/libllama.so.${LIBllama_VERSION}
 @lib lib/libmtmd.so.${LIBmtmd_VERSION}
 lib/pkgconfig/llama.pc
+@owner _llama-server
+@group _llama-server
+@sample /var/db/llama-server/
+@owner
+@group
+share/examples/login.conf.d/llama_server
+@sample /etc/login.conf.d/llama_server
Index: misc/llama.cpp/pkg/llama_server.login
===================================================================
RCS file: misc/llama.cpp/pkg/llama_server.login
diff -N misc/llama.cpp/pkg/llama_server.login
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ misc/llama.cpp/pkg/llama_server.login	10 Nov 2025 20:36:25 -0000
@@ -0,0 +1,5 @@
+llama_server:\
+	:datasize=16G:\
+        :coredumpsize=0:\
+        :setenv=LLAMA_CACHE=/var/db/llama-server:\
+	:tc=daemon:
Index: misc/llama.cpp/pkg/llama_server.rc
===================================================================
RCS file: misc/llama.cpp/pkg/llama_server.rc
diff -N misc/llama.cpp/pkg/llama_server.rc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ misc/llama.cpp/pkg/llama_server.rc	10 Nov 2025 15:39:50 -0000
@@ -0,0 +1,12 @@
+#!/bin/ksh
+
+daemon="${TRUEPREFIX}/bin/llama-server"
+daemon_user="_llama-server"
+daemon_logger="daemon.info"
+
+. /etc/rc.d/rc.subr
+
+rc_bg=YES
+rc_reload=NO
+
+rc_cmd $1
Index: infrastructure/db/user.list
===================================================================
RCS file: /home/cvs/ports/infrastructure/db/user.list,v
diff -u -p -r1.473 user.list
--- infrastructure/db/user.list	19 Oct 2025 16:23:20 -0000	1.473
+++ infrastructure/db/user.list	10 Nov 2025 15:57:31 -0000
@@ -91,7 +91,7 @@ id  user		group		port
 580 _puppet		_puppet		sysutils/ruby-{puppet,openvox}
 581 _piknik		_piknik		sysutils/piknik
 582 _tabled		_tabled		sysutils/tabled
-#583			_kdesud		x11/kde/base3
+583 _llama-server	_llama-server	misc/llama.cpp
 584 _wstunnel		_wstunnel	net/wstunnel
 585 _lighttpd		_lighttpd	www/lighttpd
 586 _gnugk		_gnugk		net/gnugk


-- 
wbr, Kirill