CLOUDSTACK-248: Fix rpm build for cloud-scripts Make rpm correctly handle new installs, upgrades and uninstalls.
Signed-off-by: Rohit Yadav <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/c6d92f7f Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/c6d92f7f Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/c6d92f7f Branch: refs/heads/javelin Commit: c6d92f7f9084f29ed26e23b7d0809a71d8b0feee Parents: 5cd7fb8 Author: Rohit Yadav <[email protected]> Authored: Thu Oct 4 13:28:05 2012 +0530 Committer: Edison Su <[email protected]> Committed: Fri Oct 5 12:01:35 2012 -0700 ---------------------------------------------------------------------- cloud.spec | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c6d92f7f/cloud.spec ---------------------------------------------------------------------- diff --git a/cloud.spec b/cloud.spec index fe2e757..3c6bf0e 100644 --- a/cloud.spec +++ b/cloud.spec @@ -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
