# 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
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
No comments:
Post a Comment