From 87a88bec90a3b3d6f193518dffcd7011c00369fc Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Mon, 27 Sep 2021 16:13:39 +0800 Subject: [PATCH] change for edge computinig --- build.py | 3 +- script/common_function.sh | 1 + script/make_version.sh | 2 +- script/step/make_edge_iso.sh | 81 ++++++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 script/step/make_edge_iso.sh diff --git a/build.py b/build.py index 036c017..623dc4a 100644 --- a/build.py +++ b/build.py @@ -18,7 +18,7 @@ PARAMS = ['all', 'set_release_dir', 'update_release_info', 'build_and_wait', 'ma 'make_compile_env_storage', 'make_euleros_certdb', 'make_vm_qcow2', 'make_compile_tools', 'make_images_slim', 'make_tools_lib_storage', 'make_container_tools', 'make_tools_debug_tools', 'make_upgrade_patch', 'make_tools_dockertools', 'make_other_tools', 'upload_to_cmc', 'make_upload_cmc_image', 'make_iso_everything', - 'make_iso_everysrc', 'make_debug_everything', 'push_lts_dir', 'make_netinst_iso', 'get_epol_rpms'] + 'make_iso_everysrc', 'make_debug_everything', 'push_lts_dir', 'make_netinst_iso', 'get_epol_rpms', 'make_edge_iso'] class Build(object): @@ -141,6 +141,7 @@ def usage(): print("* make_tar *") print("* make_hmi *") print("* make_iso *") + print("* make_edge_iso *") print("* make_livecd *") print("* build_and_wait *") print("* make_iso_debug *") diff --git a/script/common_function.sh b/script/common_function.sh index c6dca1f..dd7c2c1 100644 --- a/script/common_function.sh +++ b/script/common_function.sh @@ -109,6 +109,7 @@ source "${BUILD_SCRIPT_DIR}"/step/make_iso.sh source "${BUILD_SCRIPT_DIR}"/step/get_epol_rpms.sh source "${BUILD_SCRIPT_DIR}"/step/make_iso_debug.sh source "${BUILD_SCRIPT_DIR}"/step/make_netinst_iso.sh +source "${BUILD_SCRIPT_DIR}"/step/make_edge_iso.sh source "${BUILD_SCRIPT_DIR}"/step/make_iso_everything.sh source "${BUILD_SCRIPT_DIR}"/step/make_debug_everything.sh source "${BUILD_SCRIPT_DIR}"/step/make_iso_everysrc.sh diff --git a/script/make_version.sh b/script/make_version.sh index 3e34615..32ebc75 100644 --- a/script/make_version.sh +++ b/script/make_version.sh @@ -49,7 +49,7 @@ function usage() echo "$(basename $0) [script_name|all]" } -export ALL_SCRIPT=('build_and_wait' 'update_release_info' 'make_tar' 'make_hmi' 'make_iso' 'make_iso_debug' 'make_iso_singleoss' 'make_livecd' 'make_compile_env' 'make_docker_image' 'make_raspi_image' 'make_microvm_image' 'make_euleros_certdb' 'make_tools_lib_storage' 'make_container_tools' 'make_tools_debug_tools' 'make_upgrade_patch' 'make_iso_everything' 'make_iso_everysrc' 'make_debug_everything' 'push_lts_dir' 'make_netinst_iso' 'get_epol_rpms') +export ALL_SCRIPT=('build_and_wait' 'update_release_info' 'make_tar' 'make_hmi' 'make_iso' 'make_iso_debug' 'make_iso_singleoss' 'make_livecd' 'make_compile_env' 'make_docker_image' 'make_raspi_image' 'make_microvm_image' 'make_euleros_certdb' 'make_tools_lib_storage' 'make_container_tools' 'make_tools_debug_tools' 'make_upgrade_patch' 'make_iso_everything' 'make_iso_everysrc' 'make_debug_everything' 'push_lts_dir' 'make_netinst_iso' 'get_epol_rpms' 'make_edge_iso') [[ "${DEBUG}" -eq 1 ]] && set -x #check_env diff --git a/script/step/make_edge_iso.sh b/script/step/make_edge_iso.sh new file mode 100644 index 0000000..cb456ac --- /dev/null +++ b/script/step/make_edge_iso.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# Author: zhengxuye +# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved. +set -e + +###################### +# 构建iso镜像 +# Globals: +# Arguments: +# Returns: +###################### +function make_edge_iso() +{ + chroot_run "cd /home; bash make_version.sh make_edge_iso_inchroot" +} +###################### +# 在chroot中构建iso镜像 +# Globals: +# Arguments: +# Returns: +###################### +function make_edge_iso_inchroot() +{ + get_version + release_dir=$(get_release_dir) + TIME_DIR="${release_dir#${HTTP_DIR}}" + TIME=${TIME_DIR##*/} + TIME=${TIME#"${version}"-} + yum_conf="${BUILD_SCRIPT_DIR}/config/repo_conf/obs-repo.conf" + yum clean all -c "${yum_conf}" + if rpm -q oemaker &> /dev/null; then + yum remove oemaker -y + fi + if rpm -q lorax &> /dev/null; then + yum remove lorax -y + fi + yum install oemaker lorax linux-firmware -y -c "${yum_conf}" + cd /opt/oemaker + REPOS=`echo "${OBS_STANDARD_REPO_URL} ${OBS_EPOL_REPO_URL} ${OBS_STANDARD_THIRD_REPO_URL}" | sed 's/[ \t]*$//g'` + set +e + num=0 + set +u + while [ "${num}" -lt 3 ] + do + bash -x oemaker -t edge -p ${PRODUCTS} -v "${OS_VERSION}" -r "" -s "${REPOS}" + if [ $? -eq 0 ];then + break + elif [ $? -eq 133 ]; then + sleep 60 + ((num=num+1)) + continue + else + log_error "make_iso fail" + break + fi + done + if [ "${num}" -ge 3 ]; then + log_error "retry make_iso fail" + fi + set -e + cd "/result" + + TGZ_NAME=$(ls *"${ARCH}"-dvd.iso) + if [ x"${TGZ_NAME}" == x'' ]; then log_error "can not find iso";fi + create_checksum "${TGZ_NAME}" + #log_info "${HTTP_DIR}/${TIME_DIR}" > "${WORK_DIR}"releasedir_info + iso_rpmlist="${OS_NAME}-${OS_VERSION}-edge-${ARCH}.rpmlist" + mkdir temp && mount *"${ARCH}"-dvd.iso temp + cd temp/Packages + ls *.rpm > "../../${iso_rpmlist}" + cd ../.. + umount temp + [ -n temp ] && rm -rf temp + CUSTOM_DIR="${TIME_DIR}" + RELEASE_DIR="${release_dir}/edge_img/$ARCH" + SSH_CMD="mkdir -p ${RELEASE_DIR}" + sshcmd "${SSH_CMD}" + sshscp "${TGZ_NAME} ${TGZ_NAME}${SHA256SUM} ${iso_rpmlist}" "${RELEASE_DIR}" + [ -n "${iso_rpmlist}" ] && rm -rf "${iso_rpmlist}" + return 0 +} -- Gitee