Commit 18c02887 authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

setup.sh: exit from the script if not supported platform is detected



Also, store kernel name in the separate var and use it throughout the
entire script.

Change-Id: Iaa1c4c4aa52fb4aa708fb476478a81e9c6067b58
Signed-off-by: default avatarMichal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2340


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 5a436f0c
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -2,11 +2,18 @@

set -e

os=$(uname -s)

if [[ $os != Linux && $os != FreeBSD ]]; then
	echo "Not supported platform ($os), aborting"
	exit 1
fi

rootdir=$(readlink -f $(dirname $0))/..
source "$rootdir/scripts/common.sh"

function usage() {
	if [ $(uname) = Linux ]; then
	if [[ $os == Linux ]]; then
		options="[config|reset|status|cleanup|help]"
	else
		options="[config|reset|help]"
@@ -24,13 +31,13 @@ function usage() {
	echo
	echo "$options - as following:"
	echo "config            Default mode. Allocate hugepages and bind PCI devices."
	if [ $(uname) = Linux ]; then
	if [[ $os == Linux ]]; then
		echo "cleanup            Remove any orphaned files that can be left in the system after SPDK application exit"
	fi
	echo "reset             Rebind PCI devices back to their original drivers."
	echo "                  Also cleanup any leftover spdk files/resources."
	echo "                  Hugepage memory size will remain unchanged."
	if [ $(uname) = Linux ]; then
	if [[ $os == Linux ]]; then
		echo "status            Print status of all SPDK-compatible devices on the system."
	fi
	echo "help              Print this help message."
@@ -772,7 +779,7 @@ if [ -z "$TARGET_USER" ]; then
	fi
fi

if [ $(uname) = Linux ]; then
if [[ $os == Linux ]]; then
	HUGEPGSZ=$(($(grep Hugepagesize /proc/meminfo | cut -d : -f 2 | tr -dc '0-9')))
	HUGEPGSZ_MB=$((HUGEPGSZ / 1024))
	: ${NRHUGE=$(((HUGEMEM + HUGEPGSZ_MB - 1) / HUGEPGSZ_MB))}
@@ -796,9 +803,9 @@ else
	elif [ "$mode" == "reset" ]; then
		reset_freebsd
	elif [ "$mode" == "cleanup" ]; then
		echo "setup.sh cleanup function not yet supported on $(uname)"
		echo "setup.sh cleanup function not yet supported on $os"
	elif [ "$mode" == "status" ]; then
		echo "setup.sh status function not yet supported on $(uname)"
		echo "setup.sh status function not yet supported on $os"
	elif [ "$mode" == "help" ]; then
		usage $0
	else