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: Michal Berger <michalx.berger@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2340 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
5a436f0c61
commit
18c0288730
@ -2,11 +2,18 @@
|
|||||||
|
|
||||||
set -e
|
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))/..
|
rootdir=$(readlink -f $(dirname $0))/..
|
||||||
source "$rootdir/scripts/common.sh"
|
source "$rootdir/scripts/common.sh"
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
if [ $(uname) = Linux ]; then
|
if [[ $os == Linux ]]; then
|
||||||
options="[config|reset|status|cleanup|help]"
|
options="[config|reset|status|cleanup|help]"
|
||||||
else
|
else
|
||||||
options="[config|reset|help]"
|
options="[config|reset|help]"
|
||||||
@ -24,13 +31,13 @@ function usage() {
|
|||||||
echo
|
echo
|
||||||
echo "$options - as following:"
|
echo "$options - as following:"
|
||||||
echo "config Default mode. Allocate hugepages and bind PCI devices."
|
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"
|
echo "cleanup Remove any orphaned files that can be left in the system after SPDK application exit"
|
||||||
fi
|
fi
|
||||||
echo "reset Rebind PCI devices back to their original drivers."
|
echo "reset Rebind PCI devices back to their original drivers."
|
||||||
echo " Also cleanup any leftover spdk files/resources."
|
echo " Also cleanup any leftover spdk files/resources."
|
||||||
echo " Hugepage memory size will remain unchanged."
|
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."
|
echo "status Print status of all SPDK-compatible devices on the system."
|
||||||
fi
|
fi
|
||||||
echo "help Print this help message."
|
echo "help Print this help message."
|
||||||
@ -772,7 +779,7 @@ if [ -z "$TARGET_USER" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(uname) = Linux ]; then
|
if [[ $os == Linux ]]; then
|
||||||
HUGEPGSZ=$(($(grep Hugepagesize /proc/meminfo | cut -d : -f 2 | tr -dc '0-9')))
|
HUGEPGSZ=$(($(grep Hugepagesize /proc/meminfo | cut -d : -f 2 | tr -dc '0-9')))
|
||||||
HUGEPGSZ_MB=$((HUGEPGSZ / 1024))
|
HUGEPGSZ_MB=$((HUGEPGSZ / 1024))
|
||||||
: ${NRHUGE=$(((HUGEMEM + HUGEPGSZ_MB - 1) / HUGEPGSZ_MB))}
|
: ${NRHUGE=$(((HUGEMEM + HUGEPGSZ_MB - 1) / HUGEPGSZ_MB))}
|
||||||
@ -796,9 +803,9 @@ else
|
|||||||
elif [ "$mode" == "reset" ]; then
|
elif [ "$mode" == "reset" ]; then
|
||||||
reset_freebsd
|
reset_freebsd
|
||||||
elif [ "$mode" == "cleanup" ]; then
|
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
|
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
|
elif [ "$mode" == "help" ]; then
|
||||||
usage $0
|
usage $0
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user