Thursday, May 16, 2013

Edit a script inside a RPM package


I'm unable to install this RPM package, because I didn't pass through package preinstallation script(let) which detects the size of SWAP space:
NOTE: rpmrebuild is in EPEL repo for Fedora/RedHat

tomas@suse123:~/TEMP/Disk1> sudo rpm -ivh ./oracle-xe-11.2.0-1.0.x86_64.rpm
Preparing...                          ################################# [100%]
This system does not meet the minimum requirements for swap space.  Based on
the amount of physical memory available on the system, Oracle Database 11g
Express Edition requires 2048 MB of swap space. This system has 818 MB
of swap space.
 Configure more swap space on the system and retry the
installation.
error: %pre(oracle-xe-11.2.0-1.0.x86_64) scriptlet failed, exit status 1
error: oracle-xe-11.2.0-1.0.x86_64: install failed
tomas@suse123:~/TEMP/Disk1> 

Here is the script which is not passing:
tomas@suse123:~/TEMP/Disk1> rpm -qp --scripts ./oracle-xe-11.2.0-1.0.x86_64.rpm|grep "^requiredswapspace="
requiredswapspace=`min 2047 $reqswapspace`
tomas@suse123:~/TEMP/Disk1>

Let's modify it with rpmrebuild (not rpmbuild) tool.
(To install it use: zypper or yum install rpmrebuild)
tomas@suse123:~/TEMP/Disk1> rpmrebuild --edit-pre -p ./oracle-xe-11.2.0-1.0.x86_64.rpm

--edit-pre
             to edit rpm preinstallation scriptlets
-p, --package
              to use with rpm package file, not with installed rpm (this option is like rpm's -p option)


vi editor will appear. Edit the script:
#requiredswapspace=`min 2047 $reqswapspace`
requiredswapspace=`min 247 $reqswapspace`

and save it. New RPM is created in:
$HOME/rpmbuild/RPMS/x86_64

No comments:

Post a Comment