summaryrefslogtreecommitdiffstats
path: root/build-gluster-org/scripts
diff options
context:
space:
mode:
authorNigel Babu <nigelb@redhat.com>2018-11-09 12:11:19 +0530
committerNigel Babu <nigelb@redhat.com>2018-11-09 11:15:03 +0000
commit4020c9a4ac2f067ba9297b606d699e0bbcf21339 (patch)
tree50d2d2d50e43f36ced4d91667ba498432a0e0e17 /build-gluster-org/scripts
parentae9b1ece95d4b2f8a5fe38c79c259ad616099a5b (diff)
Add cleanup when a mock build is aborted
Change-Id: Id77dd90936a1cc5994899e29ce9f5733964a40dd Signed-off-by: Nigel Babu <nigelb@redhat.com>
Diffstat (limited to 'build-gluster-org/scripts')
-rw-r--r--build-gluster-org/scripts/rpm-cleanup.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/build-gluster-org/scripts/rpm-cleanup.sh b/build-gluster-org/scripts/rpm-cleanup.sh
new file mode 100644
index 0000000..bd300c7
--- /dev/null
+++ b/build-gluster-org/scripts/rpm-cleanup.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+pkill mock || true
+SLEEP=0
+while [ $SLEEP -lt 30 ]
+do
+ echo "Waiting for mock to exit cleanly. Attempt #: $SLEEP"
+ sleep 1
+ pgrep -x mock
+ if [ $? -eq 1 ]
+ then
+ exit 0
+ fi
+ SLEEP=$((SLEEP+1))
+done
+echo "Force-killing mock"
+pkill -9 mock