]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
clamav: Proper create users and groups during package installation.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 12 Feb 2023 15:20:12 +0000 (16:20 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 16 Feb 2023 11:25:33 +0000 (11:25 +0000)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
clamav/clamav.nm

index d4548a94abd69b85d662f9cf9c8700ab3d32669b..14765e000ff5b84292ad2d63a1a041f24cc838c5 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = clamav
 version    = 0.103.7
-release    = 1
+release    = 2
 
 groups     = System Environment/Daemons
 url        = https://www.clamav.net
@@ -55,13 +55,7 @@ build
        # User and group have to exist to compile the source code,
        # so we have to create them
        prepare_cmds
-               groupadd -g 497 -r clamupdate
-               useradd -u 497 -r -s /sbin/nologin -d /var/lib/clamav -M \
-                       -c 'Clamav database update user' -g clamupdate clamupdate
-
-               groupadd -g 496 -r clamscan
-               useradd -u 496 -r -s /sbin/nologin -d / -M \
-                       -g clamscan clamscan
+               %{create_users}
        end
 
        test
@@ -69,11 +63,28 @@ build
        end
 end
 
+create_users
+       # Create user and group for clamupdate.
+       getent group clamupdate || groupadd -g 497 -r clamupdate || :
+       getent passwd clamupdate || useradd -u 497 -r -s /sbin/nologin \
+               -d /var/lib/clamav -M -c 'Clamav database update user' \
+               -g clamupdate clamupdate || :
+
+       # Create user and group for clamscan.
+       getent group clamscan || groupadd -g 496 -r clamscan || :
+       getent passwd clamscan || useradd -u 496 -r -s /sbin/nologin \
+               -d / -M -g clamscan clamscan || :
+end
+
 packages
        package %{name}
                requires
                        %{name}-libs = %{thisver}
                end
+
+               script prein
+                       %{create_users}
+               end
        end
 
        package %{name}-libs