Commits

Sebastian Sdorra committed a7fbe3f

use user scm to run scm-server for rpm package installations

Comments (0)

Files changed (3)

scm-server/pom.xml

             <executions>
               <execution>
                 <goals>
+                  <goal>deb</goal>
                   <goal>rpm</goal>
                 </goals>
                 <phase>package</phase>
                 <architecture>noarch</architecture>
                 <os>linux</os>
               </platform>
+              <rpmPreInstallScript>${project.basedir}/src/main/nativepkg/rpm-create-user</rpmPreInstallScript>
               <mappings>
                 <files>
                   <file>
                 </files>
                 <links>
                   <link>
-                    <source>/usr/sbin/scm-server</source>
-                    <target>/opt/scm-server/bin/scm-server</target>
-                  </link>
-                  <link>
                     <source>/opt/scm-server/var/log</source>
                     <target>/var/log/scm</target>
                   </link>
                   </directory>
                   <directory>
                     <path>/var/cache/scm/work</path>
+                    <uname>scm</uname>
+                    <gname>scm</gname>
+                    <dirMode>0700</dirMode>
                   </directory>
                   <directory>
                     <path>/var/log/scm</path>
+                    <uname>root</uname>
+                    <gname>scm</gname>
+                    <dirMode>0770</dirMode>
                   </directory>
                   <directory>
                     <path>/var/lib/scm</path>
+                    <uname>scm</uname>
+                    <gname>scm</gname>
+                    <dirMode>0700</dirMode>
                   </directory>
                 </directories>
               </mappings>         

scm-server/src/main/nativepkg/default

 PORT=8080
 
 # change user
-# USER=scm
+USER=scm
 
 # home of scm-manager
-SCM_HOME=/var/lib/scm
+export SCM_HOME=/var/lib/scm
 
 # alternative jvm path
 JAVA_HOME="/usr/lib/jvm/jre"

scm-server/src/main/nativepkg/rpm-create-user

+getent group scm >/dev/null || groupadd -r scm
+getent passwd scm >/dev/null || \
+    useradd -r -g scm -M -s /sbin/nologin \
+    -c "user for the scm-server process" scm
+exit 0