Improve RPM
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 13 Feb 2012 11:03:37 +0000 (11:03 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 13 Feb 2012 11:03:37 +0000 (11:03 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@5062 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

dist/pom.xml
dist/slc-maven/pom.xml [new file with mode: 0644]
dist/slc-maven/src/main/rpm/var/lib/slc/.m2/settings.xml [new file with mode: 0644]
dist/slc-maven/src/main/scripts/preremove [new file with mode: 0644]
dist/slc/src/main/scripts/preinstall-5
dist/slc/src/main/scripts/preinstall-6
dist/slc/src/main/scripts/preremove-5
dist/slc/src/main/scripts/preremove-6

index 2f05fa731f978c915444c094944fe3a580acb94d..f8e3950223b32dc0da97d82e097dd7312820dc38 100644 (file)
        <name>SLC Distribution</name>
        <modules>
                <module>slc</module>
+               <module>slc-maven</module>
        </modules>
+       <profiles>
+               <profile>
+                       <id>rpmbuild</id>
+                       <build>
+                               <plugins>
+                                       <plugin>
+                                               <artifactId>maven-antrun-plugin</artifactId>
+                                               <executions>
+                                                       <execution>
+                                                               <phase>install</phase>
+                                                               <goals>
+                                                                       <goal>run</goal>
+                                                               </goals>
+                                                               <configuration>
+                                                                       <target>
+                                                                               <copy todir="${rpm.stagingRepository}" verbose="true">
+                                                                                       <fileset dir="${project.build.directory}/rpm"
+                                                                                               includes="*/RPMS/**/*.rpm" />
+                                                                                       <flattenmapper />
+                                                                               </copy>
+                                                                       </target>
+                                                               </configuration>
+                                                       </execution>
+                                               </executions>
+                                       </plugin>
+                               </plugins>
+                       </build>
+               </profile>
+       </profiles>
 </project>
\ No newline at end of file
diff --git a/dist/slc-maven/pom.xml b/dist/slc-maven/pom.xml
new file mode 100644 (file)
index 0000000..b12644b
--- /dev/null
@@ -0,0 +1,77 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.argeo.slc</groupId>
+               <artifactId>dist</artifactId>
+               <version>0.13.1-SNAPSHOT</version>
+       </parent>
+       <groupId>org.argeo.slc.dist</groupId>
+       <artifactId>slc-maven</artifactId>
+       <packaging>pom</packaging>
+       <name>SLC Distribution Maven</name>
+       <dependencies>
+               <dependency>
+                       <groupId>org.argeo.slc.runtime</groupId>
+                       <artifactId>org.argeo.slc.support.maven</artifactId>
+               </dependency>
+       </dependencies>
+       <profiles>
+               <profile>
+                       <id>rpmbuild</id>
+                       <build>
+                               <plugins>
+                                       <plugin>
+                                               <groupId>org.codehaus.mojo</groupId>
+                                               <artifactId>rpm-maven-plugin</artifactId>
+                                               <executions>
+                                                       <execution>
+                                                               <id>rpm-slc-maven</id>
+                                                               <phase>package</phase>
+                                                               <goals>
+                                                                       <goal>rpm</goal>
+                                                               </goals>
+                                                               <configuration>
+                                                                       <name>slc-maven</name>
+                                                                       <copyright>2011 Argeo</copyright>
+                                                                       <mappings>
+                                                                               <mapping>
+                                                                                       <directory>/usr/share/osgi</directory>
+                                                                                       <username>root</username>
+                                                                                       <groupname>root</groupname>
+                                                                                       <filemode>644</filemode>
+                                                                                       <directoryIncluded>false</directoryIncluded>
+                                                                                       <dependency>
+                                                                                               <includes>
+                                                                                                       <include>org.argeo.slc.runtime:org.argeo.slc.support.maven</include>
+                                                                                               </includes>
+                                                                                       </dependency>
+                                                                               </mapping>
+                                                                               <mapping>
+                                                                                       <directory>/var/lib/slc/.m2</directory>
+                                                                                       <username>slc</username>
+                                                                                       <groupname>slc</groupname>
+                                                                                       <filemode>644</filemode>
+                                                                                       <directoryIncluded>false</directoryIncluded>
+                                                                                       <sources>
+                                                                                               <source>
+                                                                                                       <location>src/main/var/lib/slc/.m2</location>
+                                                                                               </source>
+                                                                                       </sources>
+                                                                               </mapping>
+                                                                       </mappings>
+                                                                       <preremoveScriptlet>
+                                                                               <scriptFile>src/main/scripts/preremove</scriptFile>
+                                                                       </preremoveScriptlet>
+                                                                       <requires>
+                                                                               <require>slc</require>
+                                                                       </requires>
+                                                               </configuration>
+                                                       </execution>
+                                               </executions>
+                                       </plugin>
+                               </plugins>
+                       </build>
+               </profile>
+       </profiles>
+</project>
\ No newline at end of file
diff --git a/dist/slc-maven/src/main/rpm/var/lib/slc/.m2/settings.xml b/dist/slc-maven/src/main/rpm/var/lib/slc/.m2/settings.xml
new file mode 100644 (file)
index 0000000..3957593
--- /dev/null
@@ -0,0 +1,30 @@
+<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                     http://maven.apache.org/xsd/settings-1.0.0.xsd">
+       <mirrors>
+               <mirror>
+                       <id>slc-repo</id>
+                       <name>SLC Repository</name>
+                       <url>http://localhost:7080/org.argeo.slc.repo.webapp/maven</url>
+                       <mirrorOf>*</mirrorOf>
+               </mirror>
+       </mirrors>
+       <servers>
+               <server>
+                       <id>slc-repo</id>
+                       <username>root</username>
+                       <password>demo</password>
+               </server>
+               <server>
+                       <id>localrepo</id>
+                       <username>root</username>
+                       <password>demo</password>
+               </server>
+               <server>
+                       <id>localrepo.snapshots</id>
+                       <username>root</username>
+                       <password>demo</password>
+               </server>
+       </servers>
+</settings>
+
diff --git a/dist/slc-maven/src/main/scripts/preremove b/dist/slc-maven/src/main/scripts/preremove
new file mode 100644 (file)
index 0000000..cbeb211
--- /dev/null
@@ -0,0 +1,4 @@
+if [ $1 = "0" ];then
+       APP=slc
+       rm -rf /var/lib/$APP/.m2/repository
+fi
index c51911ab2e4af6ec2aa29bf5adaeaff91276890d..b599581bb491939f7f92c3c7a15302a2a96297eb 100644 (file)
@@ -1,8 +1,12 @@
 if [ $1 = "1" ];then
        APP=%{name}
        
-       # create application user (EL5)
-       useradd -r --home-dir /var/lib/$APP --shell /sbin/nologin --create-home $APP
+       # check if user exists
+       /bin/id $APP 2>/dev/null
+       if [ $? -ne 0 ];then
+               # create application user (EL5)
+               useradd -r --home-dir /var/lib/$APP --shell /sbin/nologin --create-home $APP
+       fi
        
        # give read access to group on home
        chmod g+r /var/lib/$APP
index 488dac31944ee3e824959f36df4cf6d9be4e79f2..15a4ef13d0c6d0df0d038e29d4543d0e605d486f 100644 (file)
@@ -1,8 +1,12 @@
 if [ $1 = "1" ];then
        APP=%{name}
        
-       # create application user (EL6)
-       useradd --system --home-dir /var/lib/$APP --shell /sbin/nologin --user-group --create-home $APP
+       # check if user exists
+       /bin/id $APP 2>/dev/null
+       if [ $? -ne 0 ];then
+               # create application user (EL6)
+               useradd --system --home-dir /var/lib/$APP --shell /sbin/nologin --user-group --create-home $APP
+       fi
        
        # give read access to group on home
        chmod g+r /var/lib/$APP
index c3c339b109842dec614b8936924aeab7ac74db5d..e5532dbc5937b378416e95d3f7274c3608ed039a 100644 (file)
@@ -2,5 +2,5 @@ if [ $1 = "0" ];then
        #APP=%{name} => doesn't work
        APP=slc
        /sbin/chkconfig --del $APP
-       userdel $APP
+       #userdel $APP
 fi
index c3c339b109842dec614b8936924aeab7ac74db5d..e5532dbc5937b378416e95d3f7274c3608ed039a 100644 (file)
@@ -2,5 +2,5 @@ if [ $1 = "0" ];then
        #APP=%{name} => doesn't work
        APP=slc
        /sbin/chkconfig --del $APP
-       userdel $APP
+       #userdel $APP
 fi