Framework to plugin Organization specific scripts during ONIE Image build (#951)
* Framework to plugin Organization specific scripts * Framework to plugin Organization specific scripts * Framework to plugin Organization specific scripts * add getopt option to organization script
This commit is contained in:
parent
9139c7fe64
commit
458093fee5
@ -322,6 +322,14 @@ if [ -f sonic_debian_extension.sh ]; then
|
||||
./sonic_debian_extension.sh $FILESYSTEM_ROOT $PLATFORM_DIR
|
||||
fi
|
||||
|
||||
## Organization specific extensions such as Configuration & Scripts for features like AAA, ZTP...
|
||||
if [ "${enable_organization_extensions}" = "y" ]; then
|
||||
if [ -f files/build_templates/organization_extensions.sh ]; then
|
||||
sudo chmod 755 files/build_templates/organization_extensions.sh
|
||||
./files/build_templates/organization_extensions.sh -f $FILESYSTEM_ROOT -h $HOSTNAME
|
||||
fi
|
||||
fi
|
||||
|
||||
## Clean up apt
|
||||
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoremove
|
||||
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get autoclean
|
||||
|
52
files/build_templates/organization_extensions.sh
Executable file
52
files/build_templates/organization_extensions.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
#########################################################################
|
||||
## This script is to automate Orignaization specific extensions #
|
||||
## such as Configuration & Scripts for features like AAA, ZTP, etc. #
|
||||
## to include in ONIE installer image #
|
||||
## #
|
||||
## USAGE: #
|
||||
## ./organization_extensions.sh -f<filesystem_root> -n<hostname> #
|
||||
## ./organization_extensions.sh \ #
|
||||
## --fsroot <filesystem_root> \ #
|
||||
## --hostname <hostname> #
|
||||
## PARAMETERS: #
|
||||
## -f FILESYSTEM_ROOT #
|
||||
## The location of the root file system #
|
||||
## -h HOSTNAME #
|
||||
## The hostname of the target system #
|
||||
#########################################################################
|
||||
|
||||
## Initialize the arguments to default values.
|
||||
## The values get updated to user provided value, if supplied
|
||||
FILESYSTEM_ROOT=./fsroot
|
||||
HOSTNAME=sonic
|
||||
|
||||
# read the options
|
||||
TEMP=`getopt -o f:h: --long fsroot:,hostname: -- "$@"`
|
||||
eval set -- "$TEMP"
|
||||
|
||||
# extract options and their arguments into variables.
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-f|--fsroot)
|
||||
case "$2" in
|
||||
"") shift 2 ;;
|
||||
*) FILESYSTEM_ROOT=$2 ; shift 2 ;;
|
||||
esac ;;
|
||||
-h|--hostname)
|
||||
case "$2" in
|
||||
"") shift 2 ;;
|
||||
*) HOSTNAME=$2 ; shift 2 ;;
|
||||
esac ;;
|
||||
--) shift ; break ;;
|
||||
*) echo "Internal error!" ; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "Executing SONIC Organization Extensions"
|
||||
|
||||
## Place your Organization specific code / scipts here ...
|
||||
|
||||
|
||||
echo "SONIC Organization Extensions - Done"
|
||||
|
@ -48,3 +48,6 @@ SONIC_ROUTING_STACK = quagga
|
||||
# ENABLE_SYNCD_RPC - build docker-syncd with rpc packages for testing purposes.
|
||||
# Uncomment to enable:
|
||||
# ENABLE_SYNCD_RPC = y
|
||||
|
||||
# Enable Origanization Extensions - Specific to the deployment scenarios of the Organization
|
||||
ENABLE_ORGANIZATION_EXTENSIONS = y
|
||||
|
2
slave.mk
2
slave.mk
@ -99,6 +99,7 @@ $(info "SHUTDOWN_BGP_ON_START" : "$(SHUTDOWN_BGP_ON_START)")
|
||||
$(info "SONIC_CONFIG_DEBUG" : "$(SONIC_CONFIG_DEBUG)")
|
||||
$(info "ROUTING_STACK" : "$(SONIC_ROUTING_STACK)")
|
||||
$(info "ENABLE_SYNCD_RPC" : "$(ENABLE_SYNCD_RPC)")
|
||||
$(info "ENABLE_ORGANIZATION_EXTENSIONS" : "$(ENABLE_ORGANIZATION_EXTENSIONS)")
|
||||
$(info )
|
||||
|
||||
###############################################################################
|
||||
@ -388,6 +389,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : .platform
|
||||
export image_type="$($*_IMAGE_TYPE)"
|
||||
export sonicadmin_user="$(USERNAME)"
|
||||
export sonic_asic_platform="$(CONFIGURED_PLATFORM)"
|
||||
export enable_organization_extensions="$(ENABLE_ORGANIZATION_EXTENSIONS)"
|
||||
export enable_dhcp_graph_service="$(ENABLE_DHCP_GRAPH_SERVICE)"
|
||||
export shutdown_bgp_on_start="$(SHUTDOWN_BGP_ON_START)"
|
||||
export installer_debs="$(addprefix $(DEBS_PATH)/,$($*_DEPENDS))"
|
||||
|
Loading…
Reference in New Issue
Block a user