Merge "Do not trigger distribution-merge by controller"
[releng/builder.git] / jjb / packaging / uninstall-rpm.sh
index 1d62ede1b41f44d732f99c064259b13e03ad359b..0b339a86f2224707bece5ef501198f3ee1e61590 100644 (file)
@@ -6,14 +6,31 @@
 #   -o pipefail: Fail on errors in scripts this calls, give stacktrace
 set -ex -o pipefail
 
-# Uninstall ODL
-sudo yum remove -y opendaylight
+if [ -f /usr/bin/yum ]; then
+  # Uninstall ODL
+  sudo yum remove -y opendaylight
 
-# Verify ODL not installed
-if yum list installed opendaylight; then
-  # Fail if exit code 0, ie ODL is still installed
-  echo "OpenDaylight unexpectedly still installed"
-  exit 1
+  # Verify ODL not installed
+  if yum list installed opendaylight; then
+    # Fail if exit code 0, ie ODL is still installed
+    echo "OpenDaylight unexpectedly still installed"
+    exit 1
+  else
+    echo "OpenDaylight not installed, as expected"
+  fi
+elif [ -f /usr/bin/zypper ]; then
+  # Uninstall ODL
+  sudo zypper -n remove opendaylight
+
+  # Verify ODL not installed
+  if zypper search --installed-only opendaylight; then
+    # Fail if exit code 0, ie ODL is still installed
+    echo "OpenDaylight unexpectedly still installed"
+    exit 1
+  else
+    echo "OpenDaylight not installed, as expected"
+  fi
 else
-  echo "OpenDaylight not installed, as expected"
+  echo "The package manager is not supported (not yum or zypper)"
+  exit 1
 fi