v3-6-ctdb: packaging/RHEL-CTDB: improve fix for debuginfo builds
authorMichael Adam <obnox@samba.org>
Fri, 3 Dec 2010 09:13:46 +0000 (02:13 -0700)
committerMichael Adam <obnox@samba.org>
Mon, 28 Feb 2011 17:02:15 +0000 (18:02 +0100)
packaging/RHEL-CTDB/makerpms.sh

index 0de95d2e479421caa3d5567dc2e083cb2d782fdd..6253bd3b0c4d16dced838f688c85e6dfc7d6fcd9 100755 (executable)
@@ -45,12 +45,31 @@ esac
 ## Delete the old debuginfo remnants
 ##
 
-echo "Deleting samba-debuginfo and /usr/src/redhat/BUILD/samba*"
-echo "Press Control-C if you want to quit"
-sleep 10
-echo "That was your chance... :-)"
-rpm -e samba-debuginfo
-rm -rf /usr/src/redhat/BUILD/samba*
+if rpm -qa | grep -q samba-debuginfo || test -n "$(echo /usr/src/redhat/BUILD/samba* | grep -v \*)" ; then
+       echo "Removing debuginfo remnants to fix debuginfo build:"
+       if rpm -qa | grep -q samba-debuginfo ; then
+               echo "Uninstalling the samba-debuginfo RPM"
+               echo -n "Press Control-C if you want to quit (you have 10 seconds)"
+               for count in $(seq 1 10) ; do
+                       echo -n "."
+                       sleep 1
+               done
+               echo
+               echo "That was your chance... :-)"
+               rpm -e samba-debuginfo
+       fi
+       if test -n "$(echo /usr/src/redhat/BUILD/samba* | grep -v \*)" ; then
+               echo "Deleting /usr/src/redhat/BUILD/samba*"
+               echo -n "Press Control-C if you want to quit (you have 10 seconds)"
+               for count in $(seq 1 10) ; do
+                       echo -n "."
+                       sleep 1
+               done
+               echo
+               echo "That was your chance... :-)"
+               rm -rf /usr/src/redhat/BUILD/samba*
+       fi
+fi
 
 ##
 ## determine the samba version and create the SPEC file