From e09466395d5316d038ba6e0760cda2a37e0c89d5 Mon Sep 17 00:00:00 2001 From: "Lee, Jeong Han" Date: Wed, 9 Oct 2024 18:01:44 -0700 Subject: [PATCH] update sudo commands --- configure/CONFIG_SRC | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/configure/CONFIG_SRC b/configure/CONFIG_SRC index 06a579e..9d0708d 100644 --- a/configure/CONFIG_SRC +++ b/configure/CONFIG_SRC @@ -5,28 +5,24 @@ INSTALL_PROGRAM:=$(INSTALL) INSTALL_DATA:=$(INSTALL) -m 644 INSTALL_755:=$(INSTALL) -m 755 -# IF INSTALL_LOCATIOIN is not WRITABLE, SUDO and SUDOBASH should be used +# IF INSTALL_LOCATION_CHECK cannot be created, SUDO and SUDOBASH should be used # SUDO_INFO 1 : SUDO is needed (NOT writable) # SUDO_INFO 0 : SUDO is not needed -ifeq "$(INSTALL_LOCATION)" "${HOME}" -SUDO_INFO := $(shell test -w $(INSTALL_LOCATION) 1>&2 2> /dev/null; echo $$?) -else -SUDO_INFO := $(shell test -w $(INSTALL_LOCATION)/.. 1>&2 2> /dev/null; echo $$?) -endif - -SUDO_CMD:=$(shell which sudo) +# Can we create the final location? +# If yes, SUDO_INFO = 0 +# IF no, SUDO_INFO = 1 +SUDO_INFO := $(shell mkdir -p $(INSTALL_LOCATION_CHECK) 1>&2 2> /dev/null; echo $$?) +SUDO_CMD := $(shell which sudo) # For CentOS, devtoolset-{7,8} has -E option within sudo shell # So we have to remove -E option as well if we would like to use devtoolset # ifeq "$(SUDO_INFO)" "1" SUDO = $(SUDO_CMD) -else -ifeq ($(UNAME_S),Darwin) -SUDO = $(SUDO_CMD) +SUDOBASH := $(SUDO) -E bash -c else SUDO := -endif +SUDOBASH = bash -c endif #