diff --git a/scripts/build_debian_base_system.sh b/scripts/build_debian_base_system.sh index 7ea150ff5e..d4e4ab0593 100755 --- a/scripts/build_debian_base_system.sh +++ b/scripts/build_debian_base_system.sh @@ -1,6 +1,6 @@ #!/bin/bash -[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x CONFIGURED_ARCH=$1 IMAGE_DISTRO=$2 diff --git a/scripts/build_kvm_image.sh b/scripts/build_kvm_image.sh index f3936a5482..66fc4e4277 100755 --- a/scripts/build_kvm_image.sh +++ b/scripts/build_kvm_image.sh @@ -74,7 +74,7 @@ if [[ "$vs_build_prepare_mem" == "yes" ]]; then bash -c 'echo 1 > /proc/sys/vm/drop_caches' # Not all kernels support compact_memory if [[ -w '/proc/sys/vm/compact_memory' ]] - then + then bash -c 'echo 1 > /proc/sys/vm/compact_memory' fi free -m diff --git a/scripts/collect_build_version_files.sh b/scripts/collect_build_version_files.sh index 88e0bad8b2..6f8e29baa2 100755 --- a/scripts/collect_build_version_files.sh +++ b/scripts/collect_build_version_files.sh @@ -1,6 +1,6 @@ #!/bin/bash -[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x RET=$1 BLDENV=$2 diff --git a/scripts/collect_docker_version_files.sh b/scripts/collect_docker_version_files.sh index 2452a4fd09..a2fee669ea 100755 --- a/scripts/collect_docker_version_files.sh +++ b/scripts/collect_docker_version_files.sh @@ -1,14 +1,14 @@ #!/bin/bash - -[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x + +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x BUILDINFO_BASE=/usr/local/share/buildinfo SCRIPT_SRC_PATH=src/sonic-build-hooks if [ -e ${SCRIPT_SRC_PATH} ]; then - . ${SCRIPT_SRC_PATH}/scripts/utils.sh + . ${SCRIPT_SRC_PATH}/scripts/utils.sh else - . ${BUILDINFO_BASE}/scripts/utils.sh + . ${BUILDINFO_BASE}/scripts/utils.sh fi DOCKER_IMAGE=$1 @@ -85,15 +85,15 @@ if [[ ! -z ${SONIC_VERSION_CACHE} && -e ${CACHE_ENCODE_FILE} ]]; then GIT_FILE_STATUS=$(git status -s ${DEP_FILES}) - # If the cache file is not exists in the global cache for the given SHA, + # If the cache file is not exists in the global cache for the given SHA, # store the new cache file into version cache path. if [ -f ${LOCAL_CACHE_FILE} ]; then if [[ -z ${GIT_FILE_STATUS} && ! -e ${GLOBAL_CACHE_FILE} ]]; then mkdir -p ${GLOBAL_CACHE_DIR} chmod -f 777 ${GLOBAL_CACHE_DIR} FLOCK ${GLOBAL_CACHE_FILE} - cp ${LOCAL_CACHE_FILE} ${GLOBAL_CACHE_FILE} - chmod -f 777 ${LOCAL_CACHE_FILE} ${GLOBAL_CACHE_FILE} + cp ${LOCAL_CACHE_FILE} ${GLOBAL_CACHE_FILE} + chmod -f 777 ${LOCAL_CACHE_FILE} ${GLOBAL_CACHE_FILE} FUNLOCK ${GLOBAL_CACHE_FILE} fi fi diff --git a/scripts/collect_host_image_version_files.sh b/scripts/collect_host_image_version_files.sh index 24cb3a9941..baf555ac93 100755 --- a/scripts/collect_host_image_version_files.sh +++ b/scripts/collect_host_image_version_files.sh @@ -1,10 +1,10 @@ #!/bin/bash -[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x SCRIPT_SRC_PATH=src/sonic-build-hooks if [ -e ${SCRIPT_SRC_PATH} ]; then - . ${SCRIPT_SRC_PATH}/scripts/utils.sh + . ${SCRIPT_SRC_PATH}/scripts/utils.sh fi ARCH=$1 diff --git a/scripts/populate_file_web_server.py b/scripts/populate_file_web_server.py index 955ad9c8a7..abec22b0bb 100644 --- a/scripts/populate_file_web_server.py +++ b/scripts/populate_file_web_server.py @@ -92,9 +92,9 @@ def delete_file_if_exist(file): os.remove(file) except: print_msg(PRINT_LEVEL_WARN, "Cannot delete " + file) - + # Logic functions - + def generate_output_file(resources, dest_url_valid, dest_url, output_file_name): try: with open(output_file_name, 'w') as f: @@ -111,7 +111,7 @@ def generate_output_file(resources, dest_url_valid, dest_url, output_file_name): except: print_msg(PRINT_LEVEL_WARN, output_file_name + " cannot be created") return RET_CODE_CANNOT_CREATE_FILE - + return RET_CODE_SUCCESS def upload_resource_to_server(resource_path, resource_name, user, key, server_url): @@ -142,7 +142,7 @@ def upload_resource_to_server(resource_path, resource_name, user, key, server_ur if reported_md5 != None and reported_md5 != file_md5: print_msg(PRINT_LEVEL_WARN, f"Server reported file's chsum {reported_md5}, expected {file_md5}") - + return RET_CODE_SUCCESS def download_external_resouce(resource, cache_path): @@ -204,13 +204,13 @@ def parse_args(): parser.add_argument('-c', '--cache', default="." + os.sep + "tmp", help='Path to cache for storing content before uploading to server') - parser.add_argument('-p', '--print', default=PRINT_LEVEL_INFO, + parser.add_argument('-p', '--print', default=PRINT_LEVEL_INFO, choices=[PRINT_LEVEL_ERROR, PRINT_LEVEL_WARN, PRINT_LEVEL_INFO, PRINT_LEVEL_VERBOSE], help='Print level verbosity') - + parser.add_argument('-o', '--output', default=DEFAULT_INVALID_INPUT, - help='Output file name to hold the list of packages') - + help='Output file name to hold the list of packages') + parser.add_argument('-u', '--user', default=DEFAULT_INVALID_INPUT, help='User for server authentication') @@ -223,33 +223,33 @@ def parse_args(): return parser.parse_args() def main(): - global g_current_print_level + global g_current_print_level ret_val = RET_CODE_SUCCESS resource_counter = 0.0 resource_dict = dict() args = parse_args() - + g_current_print_level = args.print - + resource_files_list = get_resource_files_list(args.source) resource_list = get_resources_list(resource_files_list) - #remove duplications + #remove duplications for resource in resource_list: unique_name = resource.get_unique_name() if not unique_name in resource_dict.keys(): resource_dict[unique_name] = resource print_msg(PRINT_LEVEL_INFO, "Found " + str(len(resource_files_list)) + " version files and " + str(len(resource_dict.keys())) + " unique resources") - + if args.dest != DEFAULT_INVALID_INPUT: upload_files_to_server = True print_msg(PRINT_LEVEL_INFO, "Upload files to URL - " + args.dest) else: upload_files_to_server = False - print_msg(PRINT_LEVEL_INFO, "Skipping files upload to server") + print_msg(PRINT_LEVEL_INFO, "Skipping files upload to server") #create cache directory if not exist create_dir_if_not_exist(args.cache) @@ -265,29 +265,29 @@ def main(): #download content to cache file_in_cache = download_external_resouce(resource, args.cache) - + if "" == file_in_cache: return RET_CODE_CANNOT_WRITE_FILE - + if True == upload_files_to_server: #upload content to web server ret_val = upload_resource_to_server(file_in_cache, unique_name, args.user, args.key, args.dest) if ret_val != RET_CODE_SUCCESS: return ret_val - + if True == g_delete_resources_in_cache: delete_file_if_exist(file_in_cache) print_msg(PRINT_LEVEL_INFO, "Downloading Data. Progress " + str(int(100.0*resource_counter/len(resource_dict.keys()))) + "%", True) #print progress bar - + # generate version output file as needed if args.output != DEFAULT_INVALID_INPUT: ret_val = generate_output_file(resource_dict, upload_files_to_server, args.dest, args.output) print_msg(PRINT_LEVEL_INFO, "Generate output file " + args.output) - + return ret_val -# Entry function +# Entry function if __name__ == '__main__': ret_val = main() diff --git a/scripts/prepare_debian_image_buildinfo.sh b/scripts/prepare_debian_image_buildinfo.sh index 0617bdf37c..260f9d9bbd 100755 --- a/scripts/prepare_debian_image_buildinfo.sh +++ b/scripts/prepare_debian_image_buildinfo.sh @@ -1,6 +1,6 @@ #!/bin/bash -[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x ARCH=$1 diff --git a/scripts/prepare_docker_buildinfo.sh b/scripts/prepare_docker_buildinfo.sh index 8e8b461984..0ee79c201f 100755 --- a/scripts/prepare_docker_buildinfo.sh +++ b/scripts/prepare_docker_buildinfo.sh @@ -1,14 +1,14 @@ #!/bin/bash -[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x BUILDINFO_BASE=/usr/local/share/buildinfo SCRIPT_SRC_PATH=src/sonic-build-hooks if [ -e ${SCRIPT_SRC_PATH} ]; then - . ${SCRIPT_SRC_PATH}/scripts/utils.sh + . ${SCRIPT_SRC_PATH}/scripts/utils.sh else - . ${BUILDINFO_BASE}/scripts/utils.sh + . ${BUILDINFO_BASE}/scripts/utils.sh fi IMAGENAME=$1 @@ -89,7 +89,7 @@ if [[ "$SKIP_BUILD_HOOK" == y || ${ENABLE_VERSION_CONTROL_DOCKER} != y ]]; then exit 0 fi -# Version cache +# Version cache DOCKER_IMAGE_NAME=${IMAGENAME} IMAGE_DBGS_NAME=${DOCKER_IMAGE_NAME//-/_}_image_dbgs diff --git a/scripts/prepare_slave_container_buildinfo.sh b/scripts/prepare_slave_container_buildinfo.sh index 9632566b63..3e4de90cdf 100755 --- a/scripts/prepare_slave_container_buildinfo.sh +++ b/scripts/prepare_slave_container_buildinfo.sh @@ -1,6 +1,6 @@ #!/bin/bash -[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x +[[ ! -z "${DBGOPT}" && $0 =~ ${DBGOPT} ]] && set -x SLAVE_DIR=$1 ARCH=$2 diff --git a/scripts/secure_boot_signature_verification.sh b/scripts/secure_boot_signature_verification.sh index e704d8fabc..0ef64d0ee8 100755 --- a/scripts/secure_boot_signature_verification.sh +++ b/scripts/secure_boot_signature_verification.sh @@ -77,7 +77,7 @@ if [ -d "$KERNEL_MODULES_DIR" ]; then # Do sign for each found module kernel_modules_cnt=0 for mod in $modules_list - do + do # check Kernel module is signed. if ! grep -q "~Module signature appended~" "${mod}"; then echo "Error: Kernel module=${mod} have no signature appened." @@ -87,7 +87,7 @@ if [ -d "$KERNEL_MODULES_DIR" ]; then if [ $VERBOSE = 'true' ]; then echo "kernel module named=${mod} have signature appended." fi - + kernel_modules_cnt=$((kernel_modules_cnt+1)) done echo "Num of kernel modules signed: kernel_modules_cnt=$kernel_modules_cnt" diff --git a/scripts/signing_kernel_modules.sh b/scripts/signing_kernel_modules.sh index d6db8f8cd3..d669d40816 100755 --- a/scripts/signing_kernel_modules.sh +++ b/scripts/signing_kernel_modules.sh @@ -1,5 +1,5 @@ #!/bin/bash -# This script is signing kernel modules by using sign-file tool +# This script is signing kernel modules by using sign-file tool usage() { cat <