Creating custom RPMs is simple with EPM
The RedHat RPM format is a handy way to distribute software to RPM-based systems. The RPM format is quite feature rich and hence it can be quite complicated to create your own RPMs at times. Editing SPEC files, creating a cogent build tree, dependency hell.. these things can be frustrating. However, if you want the shortcut to creating your own RPMs (as well as quite a few other package formats), then use ESP Package Manager. I’ll give you the quick 2 minute overview on getting started…
1: Get a build system (you’ll need one for each architecture (intel i686, AMD64) and OS version you want to create binary packages for.
2: Download ESP from http://www.easysw.com/epm/
3: Install ESP onto your build system(s). If you are creating RPMs, then you dont need ESP installed on the systems you’ll be installing your RPM pkgs on.
./configure; make; make install
4: Create a Build and Source Tree on your BS (Build System)
Source Tree: mkdir /packages/build/source
Binary Tree: mkdir /packages/apps
5: Build and install the software you want to package onto the BS
6: Making an Apache Binary Tree (My Example)
Download Source: wget http://mirror.olnevhost.net/pub/apache/httpd/httpd-2.2.4.tar.gz
Build tree (and required options): ./configure \--prefix=/packages/apps/apache/2.2.4-v1 \--enable-ssl \--enable-deflate (etc etc)
Build and Install: make; make install
Edit /packages/apps/apache/2.2.4-v1 config files to your own requirements.
7. Creating an RPM of your Binary Tree is now done with ESP tools mkepmlist and epm
8: Create an epmlist file of all the files in the tree you just installed
cd /packages/apps/apache/2.2.4-v1
mkepmlist \--prefix /packages/apps/apache/2.2.4-v1 . &> /packages/apps/apache/2.2.4-v1/epm.list
9: Edit and add details to the epm.list file you just created above
Add package details similar to this to the very top of the epm.list file
Make sure the license and README files exist in the binary tree, add them if they don’t, then regenerate the epm.list as above file any time you add or change files in the binary tree:
%product My Apache Package
%copyright 1999-2006 by Apache Software Foundation
%vendor Me
%license /packages/apps/apache/2.2.4-v1/license/LICENSE
%readme /packages/apps/apache/2.2.4-v1/license/README
%description My Binary Apache Distro for fc5 Linux Intel
%version 2.2.4-1 400
Add a post-install script to the very end of the epmlist file
This is an optional step. But make sure the script file exists in the binary tree if you use a post-install script. If not add it, then regen your epm.list file again
%postinstallMy post-install.sh file does some dependency installation, directory creation and user/group adding
#!/bin/bash
# things to do before installing this package
yum install openssl openssl-devel zlib zlib-devel
if grep apache /etc/group
then
echo "yes: Group"
else
echo "Adding Group"
useradd -s /bin/false -u 5048 -g apache apache
fi
echo "Checking for Apache User"
if grep apache /etc/passwd
then
echo "yes: User"
else
echo "Adding Apache User"
useradd -s /bin/false -u 5048 -g apache apache
fi
echo "Creating Directories if needed"
if [ ! -d /var/www/html ]
then
echo “*** NO html dir”
mkdir -p /var/www/html
chown -R apache:apache /var/www/html
fi
if [ ! -d /var/www/cgi-bin ]
then
echo “*** NO cgi-bin dir”
mkdir -p /var/www/cgi-bin
chown -R apache:apache /var/www/cgi-bin
fi
echo “Creating Symlink”
ln -s /packages/apps/apache/2.2.4-v1 /packages/apps/apache/current
echo “Installing init script”
if [ -f /etc/init.d/httpd ]
then
echo “*** Previous init script exists”
mv /etc/init.d/httpd /etc/init.d/httpd.pre
fi
ln -s /packages/apps/apache/2.2.4-v1/etc/init.d/httpd /etc/init.d/httpd
h4. Build RPM package using EPM
epm -f rpm my-apache epm.listYou should now have a binary .rpm file in a new sub directory linux-architecture/package-name-version-arch.rpm
You can install that RPM anywhere with the same OS and Arch as the build system now.
EPM is a very well designed software package manager. You can read more here: http://www.easysw.com/epm/epm-book.html