Skip to content

Commit

Permalink
Remove unnecessary sudo authority in build Makefile (#6237)
Browse files Browse the repository at this point in the history
- Why I did it
In some build machine, it may be not able to run as root during the build, only has root authority in docker containers.

- How I did it
Remove the sudo in Makefile

- How to verify it
cd src/sonic-build-hooks
make all
  • Loading branch information
xumia authored Dec 19, 2020
1 parent ea5f204 commit 07b4aaf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sonic-build-hooks/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ DPKGTOOL = $(shell which dpkg-deb)

# If the depk-deb not installed, use the docker container to make the debian package
ifeq ($(shell which dpkg-deb),)
BUILD_COMMAND=docker run --rm -v $(shell pwd):/build debian:buster bash -c "cd build; dpkg-deb --build $(TMP_DIR)/$(SONIC_BUILD_HOOKS) $(SONIC_BUILD_HOOKS_TARGET)"
BUILD_COMMAND=docker run --user $(shell id -u):$(shell id -g) --rm -v $(shell pwd):/build debian:buster bash -c 'cd /build; dpkg-deb --build $(TMP_DIR)/$(SONIC_BUILD_HOOKS) $(SONIC_BUILD_HOOKS_TARGET)'
else
BUILD_COMMAND=dpkg-deb --build $(TMP_DIR)/$(SONIC_BUILD_HOOKS) $(SONIC_BUILD_HOOKS_TARGET)
endif

DEPENDS := $(shell find scripts hooks debian -type f)
$(SONIC_BUILD_HOOKS_TARGET): $(DEPENDS)
@rm -rf $(BUILDINFO_DIR)/$(SONIC_BUILD_HOOKS) $(TMP_DIR)
@mkdir -p $(DEBIAN_DIR) $(SCRIPTS_PATH) $(HOOKS_PATH) $(SYMBOL_LINK_PATH) $(TRUSTED_GPG_PATH)
@mkdir -p $(DEBIAN_DIR) $(SCRIPTS_PATH) $(HOOKS_PATH) $(SYMBOL_LINK_PATH) $(TRUSTED_GPG_PATH) $(BUILDINFO_DIR)
@chmod 0775 $(DEBIAN_DIR)
@cp debian/* $(DEBIAN_DIR)/
@cp scripts/* $(SCRIPTS_PATH)/
@cp hooks/* $(HOOKS_PATH)/
@for url in $$(echo $(TRUSTED_GPG_URLS) | sed 's/[,;]/ /g'); do wget -q "$$url" -P "$(TRUSTED_GPG_PATH)/"; done
@for f in $(SYMBOL_LINKS); do ln -s $(SYMBOL_LINKS_SRC_DIR)/$$f $(SYMBOL_LINK_PATH)/$$f; done
@$(BUILD_COMMAND)
@sudo chmod a+rw $(SONIC_BUILD_HOOKS_TARGET)

all: $(SONIC_BUILD_HOOKS_TARGET)

0 comments on commit 07b4aaf

Please sign in to comment.