Skip to content

Commit

Permalink
update sudo commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jeonghanlee committed Oct 10, 2024
1 parent 8ffdd04 commit e094663
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions configure/CONFIG_SRC
Original file line number Diff line number Diff line change
Expand Up @@ -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

#
Expand Down

0 comments on commit e094663

Please sign in to comment.