Simplest Enterprise Continuous Integration Solutions
Showing posts with label Package Software. Show all posts
Showing posts with label Package Software. Show all posts

Saturday, August 17, 2013

Enterprise Linux: Use YUM Groups command

How to use yum group commands:

grouplist
groupinfo
groupinstall
groupremove
groupupdate


How to configure own YUM group in own repository for yum groups command

1. yum-groups-manager command execution, for example, DEMO 3.0.0

[root@linux64-app-server ~]# yum-groups-manager -n "DEMO 3.0.0" --id=demo3.0.0 --save=demo3.0.0.xml --mandatory demo-core demo-application
[root@linux64-app-server ~]# cat demo3.0.0.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">
<comps>

  <group>
   <id>demo3.0.0</id>
   <default>false</default>
   <uservisible>true</uservisible>
   <display_order>1024</display_order>
   <name>DEMO 3.0.0</name>
   <description></description>
    <packagelist>
      <packagereq type="mandatory">demo-core</packagereq>
      <packagereq type="mandatory">demo-application</packagereq>
    </packagelist>
  </group>
</comps>

2. createrepo command execution with demo3.0.0.xml yum group file

[root@linux64-app-server ~]# createrepo -g /root/demo3.0.0.xml --update /var/www/html/demo-repo/el/6


2.1 repodata with group file looks like

[root@linux64-app-server ~]# find /var/www/html/demo-repo/el/6/repodata
/var/www/html/demo-repo/el/6/repodata
/var/www/html/demo-repo/el/6/repodata/9c6c9a5c272f1dc5b8b0600da36b221c2f3ba27534947ac85dda74ead3fc1932-demo3.0.0.xml
/var/www/html/demo-repo/el/6/repodata/294ee3556b87cc20d28047c46a61b20f17423bd5ffe06869bd625613dff49c68-filelists.sqlite.bz2
/var/www/html/demo-repo/el/6/repodata/repomd.xml
/var/www/html/demo-repo/el/6/repodata/653d4aa8c51772f506dd805d3a2cf3ce645875d871b32324cadff15afeda3751-demo3.0.0.xml.gz
/var/www/html/demo-repo/el/6/repodata/6be82151e5dc44e9d520883151e60356a6c5c93619595578231330aa49467ab3-filelists.xml.gz
/var/www/html/demo-repo/el/6/repodata/3edf95b23750b20e9707e8b4fe247355fd516475655a8f355cf1f1dcdd8cdc70-primary.xml.gz
/var/www/html/demo-repo/el/6/repodata/c0225427874c49ca6cd5f285c40686e487cf30e8327b7e0f95e860724ce8763d-other.xml.gz
/var/www/html/demo-repo/el/6/repodata/3331bfd414bb08c33c26adf51c209d8a9b2c0403821f514bfe4cc1c9560022c3-primary.sqlite.bz2
/var/www/html/demo-repo/el/6/repodata/3d9422756573f00068b6cee6281aec9985775f82abd91f75070c7a2cf7c7549c-other.sqlite.bz2

3. demo-repo.repo file looks like

[root@linux64-app-server ~]# cat /etc/yum.repos.d/demo-repo.repo
[demo-repo]
name=(local yum repo of) DEMO-REPO
baseurl=http://<YUM-REPO-Server>/demo-repo/el/6
enabled=1
gpgcheck=0

4. yum grouplist, yum groupinfo command execution, for example, DEMO 3.0.0

[root@linux64-app-server ~]# yum grouplist | grep DEMO
   DEMO 3.0.0
[root@linux64-app-server ~]#  yum groupinfo "DEMO 3.0.0"
Loaded plugins: security
Setting up Group Process

Group: DEMO 3.0.0
Mandatory Packages:
   demo-core
   demo-application

5. yum groupinstall command execution, for example, DEMO 3.0.0

[root@linux64-app-server ~]# yum groupinstall "DEMO 3.0.0"
Loaded plugins: security
Setting up Group Process
Resolving Dependencies
--> Running transaction check
---> Package demo-core.x86_64 0:3.0.0-19683 will be installed
---> Package demo-application.noarch 0:3.0.0-21746 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================
Package                                                  Arch              Version                                   Repository            Size
=================================================================================================================================================
Installing:
demo-core                                                x86_64            3.0.0-19683                               demo-repo             87 M
demo-application                                         noarch            3.0.0-21746                               demo-repo             25 M

Transaction Summary
=================================================================================================================================================
Install       2 Package(s)

Total download size: 112 M
Installed size: 197 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): demo-core-3.0.0-19683.x86_64.rpm                                                                                   |  87 MB     00:01
(2/2): demo-application-3.0.0-21746.noarch.rpm                                                                            |  25 MB     00:00
-------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                             65 MB/s | 112 MB     00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : demo-application-3.0.0-21746.noarch                                                                    1/2
  Installing : demo-core-3.0.0-19683.x86_64                                                                           2/2
  Verifying  : demo-application-3.0.0-21746.noarch                                                                    1/2
  Verifying  : demo-core-3.0.0-19683.x86_64                                                                           2/2

Installed:
  demo-core.x86_64 0:3.0.0-19683    demo-application.noarch 0:3.0.0-21746

Complete!

6. yum groupremove command execution, for example, DEMO 3.0.0

[root@linux64-app-server ~]# yum groupremove "DEMO 3.0.0"
Loaded plugins: security
Setting up Group Process
Resolving Dependencies
--> Running transaction check
---> Package demo-core.x86_64 0:3.0.0-19683 will be erased
---> Package demo-application.noarch 0:3.0.0-21746 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================
Package                                                  Arch              Version                                  Repository             Size
=================================================================================================================================================
Removing:
demo-core                                               x86_64             3.0.0-19683                              @demo-repo            168 M
demo-application                                        noarch             3.0.0-21746                              @demo-repo             29 M

Transaction Summary
=================================================================================================================================================
Remove        2 Package(s)

Installed size: 197 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : demo-core-3.0.0-19683.x86_64                                                                           1/2
  Erasing    : demo-application-3.0.0-21746.noarch                                                                    2/2
  Verifying  : demo-application-3.0.0-21746.noarch                                                                    1/2
  Verifying  : demo-core-3.0.0-19683.x86_64                                                                           2/2

Removed:
  demo-core.x86_64 0:3.0.0-19683    demo-application.noarch 0:3.0.0-21746

Complete!

7. yum groupremove command execution, for example, DEMO 3.0.0

[root@linux64-app-server ~]# yum groupupdate "DEMO 3.0.0"
Loaded plugins: security
Setting up Group Process
Package demo-core-3.0.0-19683.x86_64 already installed and latest version
Package demo-application-3.0.0-21746.noarch already installed and latest version
Warning: Group demo3.0.0 does not have any packages.
No packages in any requested group available to install or update

Saturday, July 6, 2013

Software Development: Forge puppet module with an automated processes




1. Developer commits changes about puppet module (for example: with Puppet Geppetto Editor) on VCS (Version Control System, for example: Subversion/Git) branches/trunk accordingly
2. Puppet Forge Automation, which has been enabled with Continue-Integration system (for example: Cruise Control/Jenkins), will be triggered periodically based upon VCS commits to execute "puppet module build" for a new revision of puppet module located under DEV repo (for example: http://pulp-server.local.lab/pulp/puppet/qxc_dev/system/releases/q/qxc)


    if [ -e ${puppet_forge_working_directory} ]; then
      # copy the VCS checkout into ${puppet_forge_modules_folder}
      cp -rf ${puppet_forge_working_directory}/${puppet_forge_author}/* ${puppet_forge_modules_folder}
      # make sure all text file in unix format
      find ${puppet_forge_modules_folder} -type f -exec dos2unix {} \;
      # execute puppet module build
      cd ${puppet_forge_modules_folder}
      for i in `ls`; do puppet module build $i; done
      # publish puppet module to dev repoid
      cd ${puppet_forge_modules_folder}
      for i in `ls`; do pulp-admin -u ${pulp_server_admin_name} -p ${pulp_server_admin_password} puppet repo uploads upload --repo-id ${puppet_forge_dev_repoid} --dir ${puppet_forge_modules_folder}/$i/pkg; done
      pulp-admin -u ${pulp_server_admin_name} -p ${pulp_server_admin_password}  puppet repo publish run --repo-id ${puppet_forge_dev_repoid}
    fi


3. Developer should update a new version for all of Modulefile ready for new changes
4. After puppet module verification successfully, Puppet Forge Automation will promote puppet module into PROD repo (for example: http://pulp-server.local.lab/pulp/puppet/qxc/system/releases/q/qxc) to release.


    # publish module from dev repo to prod repo
    for i in `echo "common thirdparty qxc"`
    do
       pulp-admin -u ${pulp_server_admin_name} -p ${pulp_server_admin_password} puppet repo copy --from-repo-id ${puppet_forge_dev_repoid} --to-repo-id ${puppet_forge_prod_repoid} --str-eq="name=$i" --str-eq="author=${puppet_forge_author}" --str-eq="version=${puppet_forge_version}"
    done
    pulp-admin -u ${pulp_server_admin_name} -p ${pulp_server_admin_password} puppet repo publish run --repo-id ${puppet_forge_prod_repoid}
    
    # create puppet modules tar gz
    if [ -d ${puppet_forge_modules_folder} ];
    then
      rm -rf ${puppet_forge_modules_folder}
    fi
    
    if [ -d /etc/puppet/modules ];
    then
      rm -rf /etc/puppet/modules
    fi
    
    mkdir -p ${puppet_forge_modules_folder}
    mkdir -p ${puppet_forge_modules_folder}/${my_puppet_module_name}/etc/puppet/modules
    cd ${puppet_forge_modules_folder}/${my_puppet_module_name}/etc/puppet/modules
    puppet module install --module_repository http://.:${puppet_forge_prod_repoid}@${pulp_server} ${puppet_forge_author}/${my_puppet_module_name} --version ${puppet_forge_version} -i .
    cd ${puppet_forge_modules_folder}/${my_puppet_module_name}
    tar -zPcvpf ${puppet_forge_tar_gz_folder}/${my_puppet_module_name}-${3_digit_rtm_info}-`date +"%Y%m%d"`.${ci_buildnumber}.tar.gz `find etc -type f`



Saturday, May 18, 2013

Enterprise Linux: Get RPM info built by RPM Maven Plugin

Install a RPM package built by RPM Maven Plugin

# get RPM info
[root@rpm-build-server ~]# rpm -qi qxc-rpm-demo
Name        : qxc-rpm-demo                 Relocations: /opt/qxc
Version     : 1.0                          Vendor: http://www.qxconsultant.com
Release     : 215708                       Build Date: Thu Nov 22 2012 22:47:14 UTC
Install Date: Thu Nov 22 2012 22:56:16 UTC Build Host: rpm-build-server
Group       : qxc/build                    Source RPM: qxc-rpm-demo-1.0-215708.src.rpm
Size        : 48                           License: Academic Free License
Signature   : (none)
Packager    : info@qxconsutlant.com
URL         : http://www.qxconsultant.com
Summary     : qxc-rpm-demo
Description :
This is a sample RPM generated by RPM Maven Plugin

# get RPM package content list info
[root@rpm-build-server ~]# rpm -ql qxc-rpm-demo
/opt/qxc/qxc-rpm-demo/conf
/opt/qxc/qxc-rpm-demo/conf/configuration.properties
/opt/qxc/qxc-rpm-demo/scripts/demo.sh

# get RPM scriptlets info
[root@rpm-build-server ~]# rpm -q --scripts qxc-rpm-demo
preinstall scriptlet (using /bin/sh):
#!/bin/sh
#
# RPM pre Scriptlet Section
#

# do something if necessary

exit 0
postinstall scriptlet (using /bin/sh):
#!/bin/sh
#
# RPM post Scriptlet Section
#
# ----- Initialization ----- #

PACKAGE_NAME=qxc-rpm-demo
BASEDIR=$RPM_INSTALL_PREFIX/$PACKAGE_NAME
SETUP_SH=$BASEDIR/SETUP.sh
SETUP_CSH=$BASEDIR/SETUP.csh
PROFILED_SETUP_SH=/etc/profile.d/SETUP-${PACKAGE_NAME}.sh
PROFILED_SETUP_CSH=/etc/profile.d/SETUP-${PACKAGE_NAME}.csh
# ----- SETUP_SH ----- #
cat <<EOF > $SETUP_SH
#!/bin/sh

export QXCHOME=$BASEDIR
export JAVA_HOME=\`/bin/rpm -q --queryformat '%{INSTPREFIXES}' jdk\`/latest

EOF
# ----- SETUP_CSH ----- #
cat <<EOF > $SETUP_CSH
#!/bin/csh

setenv QXCHOME $BASEDIR
setenv JAVA_HOME  \`/bin/rpm -q --queryformat '%{INSTPREFIXES}' jdk\`/latest

EOF

# make SETUP scripts executable
/bin/chmod a+x $SETUP_SH
/bin/chmod a+x $SETUP_CSH

# Create symbolic link to SETUP scripts
if [ -d /etc/profile.d ]; then
    /bin/ln -sf $SETUP_SH $PROFILED_SETUP_SH
    /bin/ln -sf $SETUP_CSH $PROFILED_SETUP_CSH
fi
preuninstall scriptlet (using /bin/sh):
#!/bin/sh
#
# RPM preun Scriptlet Section
#
# ----- Initialization ----- #
PACKAGE_NAME=qxc-rpm-demo
BASEDIR=$RPM_INSTALL_PREFIX/$PACKAGE_NAME
SETUP_SH=$BASEDIR/SETUP.sh
SETUP_CSH=$BASEDIR/SETUP.csh
PROFILED_SETUP_SH=/etc/profile.d/SETUP-${PACKAGE_NAME}.sh
PROFILED_SETUP_CSH=/etc/profile.d/SETUP-${PACKAGE_NAME}.csh

if [ $1 -lt 1 ]; then
   #
   # Stop the watcher daemon if it is running
   #
   if ! /usr/bin/test `/bin/ps -e | /bin/grep watcher-daemon|wc -l` = 0
   then
      /bin/sh /etc/rc.d/init.d/nuance-wd stop
   fi

   # Remove SETUP* symbolic links
   /bin/rm -f $PROFILED_SETUP_SH
   /bin/rm -f $PROFILED_SETUP_CSH

   # Remove SETUP scripts
   /bin/rm -f $SETUP_SH
   /bin/rm -f $SETUP_CSH
   /bin/rm -rf $BASEDIR
fi

# get RPM changelog info 
[root@rpm-build-server ~]# rpm -q --changelog qxc-rpm-demo
* Thu Nov 22 2012 RPM Builder <info@qxconsutlant.com>
- Initial Spec File

# get installed RPM content list info 
[root@rpm-build-server ~]# find /opt/qxc
/opt/qxc
/opt/qxc/qxc-rpm-demo
/opt/qxc/qxc-rpm-demo/SETUP.sh
/opt/qxc/qxc-rpm-demo/SETUP.csh
/opt/qxc/qxc-rpm-demo/scripts
/opt/qxc/qxc-rpm-demo/scripts/demo.sh
/opt/qxc/qxc-rpm-demo/conf
/opt/qxc/qxc-rpm-demo/conf/configuration.properties

# get symbolic link setup scripts info
[root@rpm-build-server ~]# ls -al /etc/profile.d/SETUP-qxc-rpm-demo*
lrwxrwxrwx   1 root root    31 Nov 22 22:56 SETUP-qxc-rpm-demo.csh -> /opt/qxc/qxc-rpm-demo/SETUP.csh
lrwxrwxrwx   1 root root    30 Nov 22 22:56 SETUP-qxc-rpm-demo.sh -> /opt/qxc/qxc-rpm-demo/SETUP.sh

# uninstall RPM 
[root@rpm-build-server ~]# rpm -e qxc-rpm-demo

# nothing should be left over after uninstalled RPM
[root@rpm-build-server ~]# ls -al /opt/qxc/
total 8
drwxr-xr-x  2 root root 4096 Nov 22 23:07 .
drwxr-xr-x. 6 root root 4096 Nov 22 21:49 ..
[root@rpm-build-server ~]# ls -al /etc/profile.d/SETUP-qxc-rpm-demo*


ls: cannot access /etc/profile.d/SETUP-qxc-rpm-demo*: No such file or directory

Saturday, April 20, 2013

Enterprise Linux: Build a RPM package via RPM Maven Plugin

Based upon RPM Maven pom.xml

[rpmbuilder@rpm-build-server ~]$ find /home/rpmbuilder/wworkspace
/home/rpmbuilder/wworkspace/
/home/rpmbuilder/wworkspace/pom.xml
/home/rpmbuilder/wworkspace/src
/home/rpmbuilder/wworkspace/src/main
/home/rpmbuilder/wworkspace/src/main/scriptlets
/home/rpmbuilder/wworkspace/src/main/scriptlets/post.sh
/home/rpmbuilder/wworkspace/src/main/scriptlets/preun.sh
/home/rpmbuilder/wworkspace/src/main/scriptlets/pre.sh
/home/rpmbuilder/wworkspace/src/main/scripts
/home/rpmbuilder/wworkspace/src/main/scripts/demo.sh
/home/rpmbuilder/wworkspace/src/main/conf
/home/rpmbuilder/wworkspace/src/main/conf/configuration.properties
/home/rpmbuilder/wworkspace/src/changelog

[rpmbuilder@rpm-build-server ~]$ mvn -version
Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: /usr/local/apache-maven-3.0.4
Java version: 1.6.0_35, vendor: Sun Microsystems Inc.
Java home: /usr/java/jdk1.6.0_35/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: " 2.6.18-194.el5.x86_64", arch: "amd64", family: "unix"

[rpmbuilder@rpm-build-server workspace]$ mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building qxc-rpm-demo 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ qxc-rpm-demo ---
[INFO] Deleting /home/rpmbuilder/workspace/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:copy-resources (copy-resources) @ qxc-rpm-demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ qxc-rpm-demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/rpmbuilder/workspace/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ qxc-rpm-demo---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ qxc-rpm-demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/rpmbuilder/workspace/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ qxc-rpm-demo ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ qxc-rpm-demo ---
[INFO] No tests to run.
[INFO] Surefire report directory: /home/rpmbuilder/workspace/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ qxc-rpm-demo ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /home/rpmbuilder/workspace/target/qxc-rpm-demo-1.0.jar
[INFO]
[INFO] --- rpm-maven-plugin:2.1-alpha-4:rpm (default) @ qxc-rpm-demo ---
[INFO] Creating directory /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo
[INFO] Creating directory /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/BUILD
[INFO] Creating directory /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/RPMS
[INFO] Creating directory /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/SOURCES
[INFO] Creating directory /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/SPECS
[INFO] Creating directory /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/SRPMS
[INFO] Creating directory /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/tmp-buildroot
[INFO] Creating directory /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/buildroot
[INFO] Copying files to /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/tmp-buildroot/opt/qxc/qxc-rpm-demo
[INFO] Copying files to /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/tmp-buildroot/opt/qxc/qxc-rpm-demo/conf
[INFO] Creating spec file /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/SPECS/qxc-rpm-demo.spec
[INFO] Building target platforms: noarch-unknown-linux
[INFO] Building for target noarch-unknown-linux
[INFO] Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.j6kVsi
[WARNING] + umask 022
[WARNING] + cd /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/BUILD
[WARNING] + '[' -d /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/buildroot ']'
[WARNING] + mv /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/tmp-buildroot/opt /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/buildroot
[WARNING] + /usr/lib/rpm/brp-compress
[WARNING] + /usr/lib/rpm/brp-strip
[WARNING] + /usr/lib/rpm/brp-strip-static-archive
[WARNING] + /usr/lib/rpm/brp-strip-comment-note
[INFO] Processing files: qxc-rpm-demo-1.0-215708.noarch
[INFO] Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/buildroot
[INFO] Wrote: /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/RPMS/noarch/qxc-rpm-demo-1.0-215708.noarch.rpm
[INFO] Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.roUQR2
[WARNING] + umask 022
[WARNING] + cd /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/BUILD
[WARNING] + /bin/rm -rf /home/rpmbuilder/workspace/target/rpm/qxc-rpm-demo/buildroot
[WARNING] + exit 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.398s
[INFO] Finished at: Thu Nov 22 22:19:52 UTC 2012
[INFO] Final Memory: 6M/16M

[INFO] ------------------------------------------------------------------------

Saturday, March 9, 2013

Enterprise Linux: RPM Maven pom.xml example

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
   <groupId>com.qxc.rpm.demo</groupId>
   <artifactId>qxc-rpm-demo</artifactId>
   <modelVersion>4.0.0</modelVersion>
   <version>1.0</version>
   <packaging>jar</packaging>

   <!-- global definition -->
   <organization>
      <name>http://www.qxconsultant.com</name>
      <url>http://www.qxconsultant.com</url>
   </organization>

   <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <project.temp.build.dir>${basedir}/target/temp</project.temp.build.dir>
      <maven.build.timestamp.format>HHmmss</maven.build.timestamp.format>
      <rpm.group>qxc/applications</rpm.group>
      <rpm.packager>info@qxconsutlant.com</rpm.packager>
      <rpm.prefix>/opt/qxc</rpm.prefix>
      <rpm.release>${maven.build.timestamp}</rpm.release>
      <rpm.version>${project.version}</rpm.version>
      <rpm.license>Academic Free License</rpm.license>
      <rpm.scriptlets.path>src/main/scriptlets</rpm.scriptlets.path>
      <rpm.changelog.path>src</rpm.changelog.path>
      <install.path>${rpm.prefix}/${project.artifactId}</install.path>
      <install.user>root</install.user>
      <install.group>root</install.group>
      <!-- local definition -->
      <local.filemode>644</local.filemode>
      <local.executable.filemode>755</local.executable.filemode>
   </properties>

   <!-- local definition -->
   <description>This is a sample RPM generated by RPM Maven Plugin</description>

   <build>
      <plugins>
         <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
            <executions>
               <execution>
                  <id>copy-resources</id>
                  <phase>validate</phase>
                  <goals>
                     <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                     <outputDirectory>${project.temp.build.dir}</outputDirectory>
                     <resources>
                        <resource>
                           <directory>src/main</directory>
                           <filtering>true</filtering>
                        </resource>
                     </resources>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>rpm-maven-plugin</artifactId>
            <version>2.1-alpha-4</version>
            <extensions>true</extensions>
            <configuration>
               <license>${rpm.license}</license>
               <group>${rpm.group}</group>
               <packager>${rpm.packager}</packager>
               <prefix>${rpm.prefix}</prefix>
               <changelogFile>${rpm.changelog.path}/changelog</changelogFile>
               <autoProvides>false</autoProvides>
               <autoRequires>false</autoRequires>
               <requires combine.children="append">
               </requires>
               <conflicts>
               </conflicts>
               <preinstallScriptlet>
                  <scriptFile>${rpm.scriptlets.path}/pre.sh</scriptFile>
               </preinstallScriptlet>
               <postinstallScriptlet>
                  <scriptFile>${rpm.scriptlets.path}/post.sh</scriptFile>
               </postinstallScriptlet>
               <preremoveScriptlet>
                  <scriptFile>${rpm.scriptlets.path}/preun.sh</scriptFile>
               </preremoveScriptlet>
               <mappings>
                  <mapping>
                     <directory>${install.path}</directory>
                     <username>${install.user}</username>
                     <groupname>${install.group}</groupname>
                     <filemode>${local.executable.filemode}</filemode>
                     <sources>
                        <source>
                           <location>${project.temp.build.dir}</location>
                           <excludes>
                              <exclude>scriptlets/</exclude>
                              <exclude>changelog</exclude>
                           </excludes>
                           <includes>
                              <include>scripts/</include>
                           </includes>
                        </source>
                     </sources>
                  </mapping>
                  <mapping>
                     <directory>${install.path}/conf</directory>
                     <username>${install.user}</username>
                     <groupname>${install.group}</groupname>
                     <configuration>true</configuration>
                     <filemode>${local.filemode}</filemode>
                     <sources>
                        <source>
                           <location>${project.temp.build.dir}/conf</location>
                        </source>
                     </sources>
                  </mapping>
               </mappings>
            </configuration>
            <executions>
               <execution>
                  <goals>
                     <goal>rpm</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
</project>