CLOUDSTACK-248: Fix rpm build for cloud-scripts

Make rpm correctly handle new installs, upgrades and uninstalls.

Signed-off-by: Rohit Yadav <rohit.yadav@citrix.com>
This commit is contained in:
Rohit Yadav 2012-10-04 13:28:05 +05:30 committed by Edison Su
parent 5cd7fb8408
commit c6d92f7f90

View File

@ -95,6 +95,7 @@ Requires: nfs-utils
Requires: wget
# there is a fsimage.so in the source code, which adds xen-libs as a dependence, needs to supress it, as rhel doesn't have this pacakge
AutoReqProv: no
Provides: cloud-agent-scripts = %{version}-%{release}
Obsoletes: cloud-agent-scripts < %{version}-%{release}
Group: System Environment/Libraries
%description scripts
@ -392,11 +393,19 @@ if [ -x /etc/sysconfig/modules/kvm.modules ] ; then
fi
%post scripts
rm -fr %{_libdir}/%{name}/agent
ln -f -s %{_libdir}/%{name}/common %{_libdir}/%{name}/agent
if [ -d %{_libdir}/%{name}/agent ]; then
rm -fr %{_libdir}/%{name}/agent
fi
# Symlink for backwards compatibility
if [ ! -h %{_libdir}/%{name}/agent ]; then
ln -s %{_libdir}/%{name}/common %{_libdir}/%{name}/agent
fi
%postun scripts
rm -fr %{_libdir}/%{name}/agent
# For uninstallation, remove symlink
if [ "$1" == "0" ]; then
rm -f %{_libdir}/%{name}/agent
fi
%post client
if [ "$1" == "1" ] ; then