# -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