commit:     ec9321fa791adba089e1c378427309c594587e31
Author:     Lucio Sauer <watermanpaint <AT> posteo <DOT> net>
AuthorDate: Thu Jul 11 00:49:08 2024 +0000
Commit:     David Roman <davidroman96 <AT> gmail <DOT> com>
CommitDate: Thu Jul 11 00:52:08 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=ec9321fa

dev-ml/ollama: move log ownership changes to pkg_preinst

Since the ollama UID and GID are dynamically assigned, we cannot rely on
them being the same on different machines. Calling fowners ollama:ollama
<file> in src_install could cause permission issues at runtime, when
e.g. a binary package is created on one machine and used on another.

Moving the offending code to pkg_preinst, which is called for binary and
source packages, solves the issue.

Closes: https://github.com/gentoo/guru/pull/210
Signed-off-by: Lucio Sauer <watermanpaint <AT> posteo.net>

 dev-ml/ollama/ollama-9999.ebuild | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dev-ml/ollama/ollama-9999.ebuild b/dev-ml/ollama/ollama-9999.ebuild
index 269471175..a8b1e063e 100644
--- a/dev-ml/ollama/ollama-9999.ebuild
+++ b/dev-ml/ollama/ollama-9999.ebuild
@@ -61,14 +61,16 @@ src_compile() {
 }
 
 src_install() {
-       touch /var/log/ollama.log || die
-       fowners ollama:ollama /var/log/ollama.log
-
        dobin ollama
        doinitd "${FILESDIR}"/ollama
        fperms 0755 /etc/init.d/ollama
 }
 
+pkg_preinst() {
+       touch /var/log/ollama.log || die
+       fowners ollama:ollama /var/log/ollama.log
+}
+
 pkg_postinst() {
        einfo "Quick guide:"
        einfo "ollama serve"

Reply via email to