setup.sh: replace username param with TARGET_USER env variable
Make it configurable the same way as other options. setup.sh will configure hugepages and vfio for the current user by default. To specify other user, set TARGET_USER variable. Change-Id: Ib98178a70a007bec761f7465689c2150e8844ffb Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/394806 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
4041ab04fb
commit
da7e3bb880
@ -39,8 +39,8 @@ function linux_bind_driver() {
|
||||
|
||||
iommu_group=$(basename $(readlink -f /sys/bus/pci/devices/$bdf/iommu_group))
|
||||
if [ -e "/dev/vfio/$iommu_group" ]; then
|
||||
if [ "$username" != "" ]; then
|
||||
chown "$username" "/dev/vfio/$iommu_group"
|
||||
if [ -z "$TARGET_USER" ]; then
|
||||
chown "$TARGET_USER" "/dev/vfio/$iommu_group"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -192,8 +192,8 @@ function configure_linux {
|
||||
fi
|
||||
|
||||
if [ "$driver_name" = "vfio-pci" ]; then
|
||||
if [ "$username" != "" ]; then
|
||||
chown "$username" "$hugetlbfs_mount"
|
||||
if [ -z "$TARGET_USER" ]; then
|
||||
chown "$TARGET_USER" "$hugetlbfs_mount"
|
||||
chmod g+w "$hugetlbfs_mount"
|
||||
fi
|
||||
|
||||
@ -371,30 +371,24 @@ function reset_freebsd {
|
||||
fi
|
||||
}
|
||||
|
||||
username=$1
|
||||
mode=$2
|
||||
mode=$1
|
||||
|
||||
if [ "$username" = "reset" -o "$username" = "config" -o "$username" = "status" ]; then
|
||||
mode="$username"
|
||||
username=""
|
||||
fi
|
||||
|
||||
if [ "$mode" == "" ]; then
|
||||
if [ -z "$mode" ]; then
|
||||
mode="config"
|
||||
fi
|
||||
|
||||
if [ "$username" = "" ]; then
|
||||
username="$SUDO_USER"
|
||||
if [ "$username" = "" ]; then
|
||||
username=`logname 2>/dev/null` || true
|
||||
fi
|
||||
fi
|
||||
|
||||
: ${HUGEMEM:=2048}
|
||||
: ${SKIP_PCI:=0}
|
||||
: ${NVME_WHITELIST:=""}
|
||||
declare -a NVME_WHITELIST=(${NVME_WHITELIST})
|
||||
|
||||
if [ -z "$TARGET_USER" ]; then
|
||||
TARGET_USER="$SUDO_USER"
|
||||
if [ -z "$TARGET_USER" ]; then
|
||||
TARGET_USER=`logname 2>/dev/null` || true
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ `uname` = Linux ]; then
|
||||
HUGEPGSZ=$(( `grep Hugepagesize /proc/meminfo | cut -d : -f 2 | tr -dc '0-9'` ))
|
||||
HUGEPGSZ_MB=$(( $HUGEPGSZ / 1024 ))
|
||||
|
Loading…
Reference in New Issue
Block a user