From 41d37bcd3091f3d968912299b5906d9c8a7b8046 Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Thu, 3 Oct 2019 13:58:20 +0900 Subject: [PATCH] mcstop+release: argument for rmmod path specification Change-Id: I80e4e7136a90bc65050ab8f7d39615581c47f317 --- scripts/mcstop+release-smp.sh.in | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/mcstop+release-smp.sh.in b/scripts/mcstop+release-smp.sh.in index 03f0b6e4..a6230069 100644 --- a/scripts/mcstop+release-smp.sh.in +++ b/scripts/mcstop+release-smp.sh.in @@ -19,9 +19,13 @@ mem="" cpus="" kill_in_use="" -while getopts k OPT +RMMOD_PATH=/sbin/rmmod +while getopts r:k OPT do case ${OPT} in + r) + RMMOD_PATH=${OPTARG} + ;; k) kill_in_use=1 ;; @@ -35,6 +39,11 @@ if [[ "$#" -ge "$OPTIND" ]]; then exit 1 fi +if [ ! -f ${RMMOD_PATH} ]; then + echo "error: ${RMMOD_PATH} doesn't exist, please specify by -r " + exit 1 +fi + # No SMP module? Exit. if ! grep ihk_smp_@ARCH@ /proc/modules &>/dev/null; then exit 0; fi @@ -109,7 +118,7 @@ fi # Remove delegator if loaded if grep mcctrl /proc/modules &>/dev/null; then - if ! sudo rmmod mcctrl 2>/dev/null; then + if ! sudo ${RMMOD_PATH} mcctrl 2>/dev/null; then echo "error: removing mcctrl" >&2 exit 1 fi @@ -117,7 +126,7 @@ fi # Remove SMP module if grep ihk_smp_@ARCH@ /proc/modules &>/dev/null; then - if ! sudo rmmod ihk_smp_@ARCH@ 2>/dev/null; then + if ! sudo ${RMMOD_PATH} ihk_smp_@ARCH@ 2>/dev/null; then echo "error: removing ihk_smp_@ARCH@" >&2 exit 1 fi @@ -125,7 +134,7 @@ fi # Remove core module if grep -E 'ihk\s' /proc/modules &>/dev/null; then - if ! sudo rmmod ihk 2>/dev/null; then + if ! sudo ${RMMOD_PATH} ihk 2>/dev/null; then echo "error: removing ihk" >&2 exit 1 fi