From 2e9b92e1c176b9f2d51c5d650b2a52c0abdb433b Mon Sep 17 00:00:00 2001 From: lguohan Date: Wed, 12 Apr 2017 11:23:48 -0700 Subject: [PATCH] [build]: allow to customize USERNAME and PASSWORD in command line (#492) * [build]: allow to customize USERNAME and PASSWORD in command line * use default password and username if not specified in the command line --- Makefile | 2 ++ rules/config | 8 ++++---- slave.mk | 8 ++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 38e90f2bfa..3e2480891b 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,8 @@ DOCKER_BUILD = docker build --no-cache \ PLATFORM=$(PLATFORM) \ BUILD_NUMBER=$(BUILD_NUMBER) \ ENABLE_DHCP_GRAPH_SERVICE=$(ENABLE_DHCP_GRAPH_SERVICE) \ + PASSWORD=$(PASSWORD) \ + USERNAME=$(USERNAME) \ $@ sonic-slave-build : diff --git a/rules/config b/rules/config index dcfa40c745..ca0de68e73 100644 --- a/rules/config +++ b/rules/config @@ -26,11 +26,11 @@ SONIC_CONFIG_LOG_TO_FILES = y # Comment next line to disable: # SONIC_CONFIG_ENABLE_COLORS = y -# USERNAME - username for installer build -USERNAME = admin +# DEFAULT_USERNAME - default username for installer build +DEFAULT_USERNAME = admin -# PASSWORD - password for installer build -PASSWORD = YourPaSsWoRd +# DEFAULT_PASSWORD - default password for installer build +DEFAULT_PASSWORD = YourPaSsWoRd # ENABLE_DHCP_GRAPH_SERVICE - specify the source of minigraph to generate configuration file. # If set to y SONiC will get the minigraph from graph service. Graph service URL need to be diff --git a/slave.mk b/slave.mk index 4f3761aa22..fbfa9f28fa 100644 --- a/slave.mk +++ b/slave.mk @@ -59,6 +59,14 @@ ifneq ($(CONFIGURED_PLATFORM), undefined) include $(PLATFORM_PATH)/rules.mk endif +ifeq ($(USERNAME),) +override USERNAME := $(DEFAULT_USERNAME) +endif + +ifeq ($(PASSWORD),) +override PASSWORD := $(DEFAULT_PASSWORD) +endif + MAKEFLAGS += -j $(SONIC_CONFIG_BUILD_JOBS) ###############################################################################