/dev/null
+ fi
+ version=$(cat "${version_on_web}")
+ [ -z "${version}" ] && log_error "You must set version in config file or from CI web page"
+ log_info "version is ${version}"
+}
diff --git a/script/step/make_compile_env.sh b/script/step/make_compile_env.sh
new file mode 100644
index 0000000000000000000000000000000000000000..c011a9fd9084b9972ad6842e947110948faa24b7
--- /dev/null
+++ b/script/step/make_compile_env.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+# Author: yhon
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+
+source "${BUILD_SCRIPT_DIR}"/custom/custom_make_native_env.sh
+
+######################
+# 构建编译环境
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_compile_env()
+{
+ chroot_run_bep "cd /home; bash make_version.sh make_compile_env_inchroot standard"
+}
+
+######################
+# 构建编译环境
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_compile_env_storage()
+{
+ chroot_run_bep "cd /home; bash make_version.sh make_compile_env_inchroot storage"
+}
+
+######################
+# 使用chroot构建编译环境
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_compile_env_inchroot()
+{
+ local product_env="${1}"
+
+ 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}"
+ rm -f sys-custom-config-*.noarch.rpm
+ yumdownloader -y -c "${yum_conf}" --destdir ./ sys-custom-config.noarch
+ rpm2cpio sys-custom-config-*.noarch.rpm |cpio -dim
+ cd opt/sys-custom-config
+ if [ "${product_env}" = "standard" ];then
+ make_compile_env_native -v "${version}" -t "${TIME}"
+ else
+ make_compile_env_pangea -v "${version}" -t "${TIME}"
+ fi
+ if [ $? -ne 0 ]; then
+ result=1
+ log_error "Failed on $0"
+ else
+ result=0
+ log_info "Suessessful on $0"
+ fi
+
+ RELEASEDIR=$(get_release_dir)
+ RELEASE_DIR="${RELEASEDIR}CompileTools/"
+
+ create_checksum "${COMPILE_ENV}.tar.gz"
+ SSH_CMD="mkdir -p ${RELEASE_DIR}"
+ sshcmd "${SSH_CMD}"
+
+ sshscp "${COMPILE_ENV}.tar.gz ${COMPILE_ENV}.tar.gz${SHA256SUM}" "${RELEASE_DIR}"
+
+ if [ "${product_env}" = "standard" ];then
+ COMPILE_ENV_FOR_DOCKER="${COMPILE_ENV}_for_docker"
+ sshscp "${COMPILE_ENV_FOR_DOCKER}.tar.gz ${COMPILE_ENV_FOR_DOCKER}.tar.gz${SHA256SUM}" "${RELEASE_DIR}"
+ fi
+ rm -f "${COMPILE_ENV}.tar.gz" "${COMPILE_ENV}.tar.gz${SHA256SUM}"
+ chmod_http
+ if [ $? -ne 0 ]; then
+ result=1
+ log_error "Failed in chmod_http"
+ fi
+ log_info "Release ${COMPILE_ENV} to ${RELEASE_SERVER_IP}:${RELEASE_DIR}"
+ return "${result}"
+}
diff --git a/script/step/make_compile_tools.sh b/script/step/make_compile_tools.sh
new file mode 100644
index 0000000000000000000000000000000000000000..baca656580ff0a8a37b7e3fed36303a26387903e
--- /dev/null
+++ b/script/step/make_compile_tools.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# Author: yhon
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+
+set -e
+
+######################
+# make make_compile_tools chroot outside
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_compile_tools()
+{
+ [[ -d "${WORK_DIR}" ]] || mkdir -p "${WORK_DIR}"
+ REPO="${WORK_DIR}compile_tools"
+
+ [ -d "${REPO}" ] && rm -rf "${REPO}"
+ python "${BUILD_SCRIPT_DIR}"/tools/repo_maker.py -f "${BUILD_SCRIPT_DIR}"/config/compile_tools.xml -d "${REPO}" -p "${OBS_SERVER_IP}:82"
+ if [ $? -ne 0 ]; then
+ log_error "Failed on repo_make compile_tools.xml"
+ else
+ log_info "Suessessful on repo_make compile_tools.xml"
+ fi
+ cd "${WORK_DIR}"
+ TGZ_NAME=compile_tools
+ tar czf "${TGZ_NAME}.tar.gz" "${TGZ_NAME}"
+ create_checksum "${TGZ_NAME}".tar.gz
+ release_dir="$(get_release_dir)"
+ RELEASE_DIR="${release_dir}CompileTools/"
+ SSH_CMD="mkdir -p ${RELEASE_DIR}"
+ sshcmd "${SSH_CMD}"
+ sshscp "${TGZ_NAME}.tar.gz ${TGZ_NAME}.tar.gz${SHA256SUM}" "${RELEASE_DIR}"
+
+}
diff --git a/script/step/make_debug_everything.sh b/script/step/make_debug_everything.sh
new file mode 100644
index 0000000000000000000000000000000000000000..b9b5808517352869441e7123d5f087c76501c3fa
--- /dev/null
+++ b/script/step/make_debug_everything.sh
@@ -0,0 +1,132 @@
+#!/bin/bash
+# Author: dongjian
+
+set -e
+
+######################
+# make everything iso chroot outside
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_debug_everything()
+{
+ chroot_run "cd /home; bash make_version.sh make_debug_everything_inchroot"
+}
+
+######################
+# make everything iso in chroot
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_debug_everything_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 mkeuleros &> /dev/null; then
+ yum remove mkeuleros -y
+ fi
+ if rpm -q lorax &> /dev/null; then
+ yum remove lorax -y
+ fi
+
+ yum install mkeuleros lorax -y -c "${yum_conf}"
+ cd /opt/mkeuleros
+
+ if [ "${ARCH}" = "x86_64" ]; then
+ mkeuleros_conf="config/standard/standard.conf"
+ elif [ "${ARCH}" = "aarch64" ]; then
+ mkeuleros_conf="config/aarch64/standard.conf"
+ fi
+
+ set +e
+ num=0
+ while [ "${num}" -lt 3 ]
+ do
+ bash -x mkeuleros.sh -f "${mkeuleros_conf}" -n "${OS_NAME}" -v "${OS_VERSION}" -s "SP1" -a "${ARCH}" -r "${OBS_STANDARD_REPO_URL}" -i 1
+ if [ $? -eq 0 ];then
+ break
+ elif [ $? -eq 133 ]; then
+ sleep 60
+ ((num=num+1))
+ continue
+ else
+ log_error "make_debug_everything fail"
+ break
+ fi
+ done
+ if [ "${num}" -ge 3 ]; then
+ log_error "retry make_debug_everything fail"
+ fi
+ set -e
+
+ cd /result
+ TGZ_NAME=$(ls *-dvd.iso)
+ if [ x"${TGZ_NAME}" == x'' ]; then
+ log_error "can not find iso"
+ fi
+ create_checksum "${TGZ_NAME}"
+
+ #TIME_DIR="${PRE_VERSION}/${VERSION}/${version}-${TIME}"
+ #log_info "${HTTP_DIR}/${TIME_DIR}" > "${WORK_DIR}"releasedir_info
+ CUSTOM_DIR="${TIME_DIR}"
+ #RELEASE_DIR="${HTTP_DIR}/${CUSTOM_DIR}"
+ RELEASE_DIR="${release_dir}/ISO/$ARCH"
+ MOUNT_DIR="${release_dir}/debuginfo/$ARCH"
+ SSH_CMD="mkdir -p ${RELEASE_DIR} ${MOUNT_DIR}"
+ sshcmd "${SSH_CMD}"
+ sshscp "${TGZ_NAME} ${TGZ_NAME}${SHA256SUM}" "${RELEASE_DIR}"
+ set +e
+ SSH_CMD="losetup -a | grep ${TGZ_NAME} | grep ${OS_VERSION} | awk -F ':' '{print \$1}' | xargs umount"
+ sshcmd "${SSH_CMD}"
+ SSH_CMD="mount -t iso9660 -o loop ${RELEASE_DIR}/${TGZ_NAME} ${MOUNT_DIR}"
+ sshcmd "${SSH_CMD}"
+ set -e
+
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ log_info "Release iso to http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/"
+
+ release_file="release_debug_everything"
+ SSH_CMD="echo http://${RELEASE_SERVER_IP}/${RELEASE_DIR}/${TGZ_NAME} > ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}"
+ sshcmd "${SSH_CMD}"
+ log_info "echo http://${RELEASE_SERVER_IP}/${RELEASE_DIR}/${TGZ_NAME} > ${release_file}"
+
+ if [ "${ISCI}" -eq "0" ]; then
+ return 0
+ fi
+
+ mkdir -pv "${WORK_DIR}"output
+ html="${WORK_DIR}"output/release_debug_everything.html
+ cat /dev/null > "${html}"
+ echo "" >> "${html}"
+ echo '' >> "${html}"
+ echo "
The newest ${VERSION} Release
" >> "${html}"
+ echo "The release is created on $(date)" >> "${html}"
+ echo "
Download on windows: ${TGZ_NAME}
" >> "${html}"
+ echo "
Download on linux: run \"wget http://${RELEASE_SERVER_IP}/${RELEASE_DIR}/${TGZ_NAME}\"
" >> "${html}"
+ echo "
View the history version, please go to : http://${RELEASE_SERVER_IP}/${PRE_VERSION}/
" >> "${html}"
+ echo "
" >> "${html}"
+ echo "" >> "${html}"
+ set +e
+ sshscp "${html}" "${HTTP_DIR}/${PRE_VERSION}/${VERSION}"
+ SSH_CMD="chmod 755 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${html##*/}"
+ sshcmd "${SSH_CMD}"
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ set -e
+
+ return 0
+}
+
diff --git a/script/step/make_docker_image.sh b/script/step/make_docker_image.sh
new file mode 100644
index 0000000000000000000000000000000000000000..ec3ca8d857cf46fc71e726e12d97ffb57da7ce37
--- /dev/null
+++ b/script/step/make_docker_image.sh
@@ -0,0 +1,171 @@
+#!/bin/bash
+set -e
+yum_conf="${BUILD_SCRIPT_DIR}/config/repo_conf/obs-repo.conf"
+dogsheng_arch="$(uname -m)"
+function kiwi_init()
+{
+ if [ ! -f /usr/share/perl5/vendor_perl/Env.pm ]; then
+ cp "${BUILD_SCRIPT_DIR}/config/docker_image/Env.pm" /usr/share/perl5/vendor_perl/
+ fi
+
+ if which kiwi &> /dev/null; then
+ echo "kiwi has been ok"
+ else
+ if [ "$dogsheng_arch" == "x86_64" ]
+ then
+ wget http://172.16.1.95:88/mainline/standard_aarch64/rpmlist/xorriso.x86_64.rpm
+ wget http://172.16.1.95:88/mainline/standard_aarch64/rpmlist/umoci.x86_64.rpm
+ wget http://172.16.1.95:88/mainline/standard_aarch64/rpmlist/containers-common.x86_64.rpm
+ wget http://172.16.1.95:88/mainline/standard_aarch64/rpmlist/libisoburn.x86_64.rpm
+ wget http://172.16.1.95:88/mainline/standard_aarch64/rpmlist/libburn.x86_64.rpm
+ yum clean all -c "${yum_conf}"
+ yum install -y python3-setuptools python3-docopt -c "${yum_conf}"
+ yum install -y python3-future -c "${yum_conf}"
+ yum install -y libisofs -c "${yum_conf}"
+ # yum install -y libisoburn -c "${yum_conf}"
+ yum install -y libburn.x86_64.rpm
+ yum install -y libisoburn.x86_64.rpm
+ #yum install -y libburn -c. "${yum_conf}"
+ yum install -y kde-filesystem -c "${yum_conf}"
+ yum install -y ostree-libs -c "${yum_conf}"
+ yum install -y xorriso.x86_64.rpm
+ yum install -y kiwi -c "${yum_conf}"
+ yum install -y umoci.x86_64.rpm
+ yum install -y containers-common.x86_64.rpm
+ yum install -y skopeo -c "${yum_conf}"
+ else
+ wget http://172.16.1.95:88/mainline/standard_aarch64/rpmlist/xorriso.aarch64.rpm
+ wget http://172.16.1.95:88/mainline/standard_aarch64/rpmlist/libisoburn.aarch64.rpm
+ wget http://172.16.1.95:88/mainline/standard_aarch64/rpmlist/umoci.aarch64.rpm
+ wget http://172.16.1.95:88/mainline/standard_aarch64/rpmlist/containers-common.aarch64.rpm
+ yum clean all -c "${yum_conf}"
+ yum install -y python3-setuptools python3-docopt -c "${yum_conf}"
+ yum install -y python3-future -c "${yum_conf}"
+ yum install -y libisofs -c "${yum_conf}"
+ # yum install -y libisoburn -c "${yum_conf}"
+ yum install -y libburn -c "${yum_conf}"
+ yum install -y libisoburn.aarch64.rpm
+ yum install -y kde-filesystem -c "${yum_conf}"
+ yum install -y ostree-libs -c "${yum_conf}"
+
+ yum install -y xorriso.aarch64.rpm
+ yum install -y kiwi -c "${yum_conf}"
+ yum install -y umoci.aarch64.rpm
+ yum install -y containers-common.aarch64.rpm
+ # yum install -y ostree-libs.aarch64.rpm
+ # yum install -y skopeo.aarch64.rpm
+ yum install -y skopeo -c "${yum_conf}"
+ fi
+ fi
+ umask_value=$(umask)
+ if [ "x${umask_value}" != "x0022" ]; then
+ umask 0022
+ fi
+ if [ ! -d /var/run/screen/S-root ]; then
+ mkdir -p /var/run/screen/S-root
+ fi
+}
+
+######################
+# make docker image chroot outside
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_docker_image()
+{
+ chroot_run "cd /home; bash make_version.sh make_docker_image_inchroot"
+}
+
+######################
+# make docker image in chroot
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_docker_image_inchroot()
+{
+ #docker_init
+ kiwi_init
+ get_version
+ release_dir=$(get_release_dir)
+
+ version_time="${release_dir#${HTTP_DIR}}"
+ version_time=${version_time##*/}
+
+ repo_dir="${WORK_DIR}repository"
+ img_dir="${WORK_DIR}image"
+ cfg_dir="${WORK_DIR}config"
+
+ if [ -d "${img_dir}" ]; then
+ rm -rf "${img_dir}"
+ fi
+
+ mkdir -p "${img_dir}"
+
+ if [ -d "${repo_dir}" ]; then
+ rm -rf "${repo_dir}"
+ fi
+
+ mkdir -p "${repo_dir}"
+
+ if [ -d "${cfg_dir}" ]; then
+ rm -rf "${cfg_dir}"
+ fi
+
+ mkdir -p "${cfg_dir}"
+
+
+ RELEASE_DIR="${release_dir}/docker_img/$ARCH"
+
+ SSH_CMD="mkdir -p ${RELEASE_DIR}"
+ sshcmd "${SSH_CMD}"
+
+ # To workaround one kiwi problem, otherwise, kiwi will copy passwd and group file
+ # from host to baseimage's rootfs.
+ # Copy passwd(from setup package) file to /var/adm/fillup-templates/passwd.aaa_base
+ # Copy group(from setup package) file to /var/adm/fillup-templates/group.aaa_base
+ mkdir -p /var/adm/fillup-templates/
+ cp config/docker_image/passwd /var/adm/fillup-templates/passwd.aaa_base
+ cp config/docker_image/group /var/adm/fillup-templates/group.aaa_base
+
+ # build
+ sed -i "s#IMAGE_NAME#${version_time}#" "${BUILD_SCRIPT_DIR}"/config/docker_image/config.xml
+
+ MOUNT_DIR=$(echo "${release_dir}" | cut -d '/' -f 5-9)
+ mkdir -p /mnt/EulerOS
+ TMPDIR=$(mktemp '/mnt/EulerOS/docker-XXXX')-$(date +%F-%T)
+ mkdir -p "${TMPDIR}"
+
+ for repo_url in $(echo "${OBS_STANDARD_REPO_URL}" | xargs)
+ do
+ sed -i "/obs_repo_here/a " "${BUILD_SCRIPT_DIR}"/config/docker_image/config.xml
+ done
+ cp -a "${BUILD_SCRIPT_DIR}"/config/docker_image/config.xml "${cfg_dir}"/config.xml
+ cp "${BUILD_SCRIPT_DIR}"/config/docker_image/images.sh "${cfg_dir}"
+
+ chmod 700 /var/run/screen/S-root
+ #Removing yum repos in kiwi build
+ if [ -d /var/cache/kiwi/yum ];then
+ rm -rf /var/cache/kiwi/yum
+ fi
+ kiwi compat --build "${cfg_dir}" -d "${img_dir}"
+ if [ $? -ne 0 ];then
+ log_error "Failed on kiwi build docker image" &> /dev/null
+ fi
+
+ # upload image
+ docker_img_path_tmp=$(ls "${img_dir}"/*.tar.xz)
+ docker_img_path="${img_dir}/openEuler-docker.${ARCH}.tar.xz"
+ mv "${docker_img_path_tmp}" "${docker_img_path}"
+
+ cd "${img_dir}"
+ sha256sum "${docker_img_path##*/}" > "${docker_img_path##*/}""${SHA256SUM}"
+ cd - > /dev/null
+ sshscp "${docker_img_path} ${docker_img_path}${SHA256SUM}" "${RELEASE_DIR}"
+ if [ $? -ne 0 ]; then
+ log_error "Failed upload docker image"
+ fi
+
+ log_info "Release ${docker_img_path} to ${RELEASE_SERVER_IP}:${RELEASE_DIR}"
+}
diff --git a/script/step/make_gcov.sh b/script/step/make_gcov.sh
new file mode 100644
index 0000000000000000000000000000000000000000..cd1baa5484adcc8a7d36c22bcf4e6a57c82c8325
--- /dev/null
+++ b/script/step/make_gcov.sh
@@ -0,0 +1,102 @@
+#!/bin/bash
+# Author: yhon
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+
+######################
+# make gcov data publish
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_gcov_data_publish()
+{
+ release_dir=$(get_release_dir)
+ publish_dir="$release_dir/gcov"
+ gcov_repo_path='/repo/openeuler/dailybuild/gcov'
+
+ cd "${BUILD_SCRIPT_DIR}"
+ rm -rf gcov_data
+ mkdir gcov_data
+ for line in $(echo "EulerOS:V3R1:BuildToolsBep EulerOS:V3R1:COMMOM EulerOS:V3R1:CompileTools EulerOS:V3R1:GENERAL EulerOS:V3R1:GENERAL:Custom EulerOS:V3R1:GENERAL:Kernel EulerOS:V3R1:KIWI EulerOS:V3R1:PANGEA EulerOS:V3R1:PANGEA:Custom EulerOS:V3R1:PANGEA:Kernel EulerOS:V3R1:PANGEA:Storage EulerOS:V3R1:STANDARD EulerOS:V3R1:STANDARD:Docker EulerOS:V3R1:STANDARD:LibStorage")
+ do
+ sh "${TOOLS}"/safe_sshscp.sh -p "huawei" -s "${RELEASE_SERVER_IP}:${gcov_repo_path}/${line}" -d "${BUILD_SCRIPT_DIR}/gcov_data" -r
+ done
+
+ tar -czvf gcov_data.tar.gz gcov_data
+ create_checksum gcov_data.tar.gz
+ SSH_CMD="mkdir -p ${publish_dir}"
+ sshcmd "${SSH_CMD}"
+ sshscp "gcov_data.tar.gz gcov_data.tar.gz${SHA256SUM}" "${publish_dir}"
+ rm -rf gcov_data*
+}
+
+######################
+# update sys-custom-tool
+# Globals:
+# Arguments:
+# Returns:
+######################
+function update_sys_custom_tool()
+{
+ rm -rf sys-custom-tool
+ gerrit_url="${gerrit_base_url}/euleros/self_src/userspace/sys-custom-tool"
+expect <<-END1
+ set timeout -1
+ spawn git clone "${gerrit_url}"
+ expect {
+ "*Are you sure you want to continue connecting*" { send "yes\r"; exp_continue }
+ eof { catch wait result; exit [lindex \${result} 3] }
+ }
+ expect {
+ eof { catch wait result; exit [lindex \${result} 3] }
+ }
+END1
+ if [ $? -ne 0 ]; then
+ log_error "git clone ${gerrit_url} failed"
+ fi
+ pushd sys-custom-tool
+ git checkout next
+ flag_pri=5
+ middle_dir="./sys-custom-tool-1.0.0/local_script/make_tar_arm/yum.repos.d"
+ ls "${middle_dir}" | while read line
+ do
+ cp -a "${middle_dir}"/"${line}" "${middle_dir}"/gcov_"${line}"
+ name=$(echo "${middle_dir}"/"${line}" | awk -F '/' '{print $NF}' | awk -F '.' '{print $1}')
+ sed -i "s#$name#gcov_${name}#g" "${middle_dir}"/gcov_"${line}"
+ sed -i "s#priority=.*#priority=${flag_pri}#" "${middle_dir}"/gcov_"${line}"
+ let "flag_pri = $flag_pri +1"
+ done
+ modify_for_gcov './'
+ source_module=$(ls | grep -v *.spec)
+ tar -czf "${source_module}.tar.gz" "${source_module}" --remove-files
+ popd
+
+ rm -rf EulerOS:V3R1:GENERAL:Custom
+expect -c "
+ set timeout 300
+ spawn osc co EulerOS:V3R1:GENERAL:Custom sys-custom-tool
+ expect {
+ \"Enter choice*:\" {send \"2\r\"; exp_continue}
+ eof { catch wait result; exit [lindex \$result 3] }
+ }
+ expect {
+ eof { catch wait result; exit [lindex \$result 3] }
+ }
+"
+ if [ $? -ne 0 ]; then
+ log_error "osc co EulerOS:V3R1:GENERAL:Custom sys-custom-tool failed"
+ fi
+ pushd EulerOS:V3R1:GENERAL:Custom/sys-custom-tool
+ osc rm *
+ cp ../../sys-custom-tool/* .
+ osc add "${source_module}".tar.gz *.spec
+ newfiles=$(osc status | grep ? | awk '{print $2}')
+ if [ -n "${newfiles}" ]; then
+ osc add "${newfiles}"
+ fi
+ osc ci -m"update for v2r8_arm"
+ if [ $? -ne 0 ]; then
+ log_error "osc ci in EulerOS:V3R1:GENERAL:Custom/sys-custom-tool failed"
+ fi
+}
diff --git a/script/step/make_hmi.sh b/script/step/make_hmi.sh
new file mode 100644
index 0000000000000000000000000000000000000000..b245d8627ca1d81498248498c46f1401d11f67b0
--- /dev/null
+++ b/script/step/make_hmi.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+set -e
+
+function make_hmi()
+{
+ chroot_run "cd /home; bash make_version.sh make_hmi_inchroot"
+}
+
+function make_hmi_inchroot()
+{
+ local counter=0
+ version="openeuler"
+ RESULT_HMI="/usr1/mkeuleros/result_hmi"
+ [ -d "${RESULT_HMI}" ] && rm -rf "${RESULT_HMI}/*"
+ mkdir -p "${RESULT_HMI}"
+
+ HMI_REPOS=$(echo "${OBS_STANDARD_REPO_URL}")
+ #HMI_REPOS=$(echo "${OBS_STANDARD_REPO_URL}" | sed 's/ / -r /g')
+ yum -c "${BUILD_SCRIPT_DIR}"/config/repo_conf/obs-repo.conf clean all
+ if [ "${ARCH}" = "aarch64" ];then
+ yum install -y CreateImage sudo parted dosfstools e2fsprogs -c "${BUILD_SCRIPT_DIR}"/config/repo_conf/obs-repo.conf
+ else
+ yum install -y CreateImage sudo parted -c "${BUILD_SCRIPT_DIR}"/config/repo_conf/obs-repo.conf
+ fi
+ pushd "${RESULT_HMI}"
+ set +e
+ chmod 755 /usr/bin/create-image
+ create-image -r "${HMI_REPOS}"
+ mv system.img "${version}"-hmi.raw
+ qemu-img convert "${version}"-hmi.raw -O qcow2 "${VM_IMAGE_NAME}"
+ local ret_value=$?
+ while [ "${ret_value}" != 0 ]
+ do
+ qemu-img convert -f raw -O qcow2 "${version}-hmi.raw" "${VM_IMAGE_NAME}"
+ ret_value=$?
+ counter="$(expr $counter + 1)"
+ if [ "${counter}" -gt 3 ]; then
+ log_error "qemu-img convert failed"
+ fi
+ done
+ log_info "qemu-img convert success!"
+
+ xz -T 0 -9 --lzma2=dict=8MiB "${VM_IMAGE_NAME}"
+ wait 120
+ popd
+ cd "${RESULT_HMI}"
+
+ TGZ_QCOW2="$(ls *.qcow2.xz)"
+ create_checksum "${TGZ_QCOW2}"
+
+ release_dir="$(get_release_dir)"
+ RELEASE_DIR="${release_dir}/virtual_machine_img/$ARCH"
+ SSH_CMD="mkdir -p ${RELEASE_DIR}"
+ sshcmd "${SSH_CMD}"
+ sshscp "${TGZ_QCOW2} ${TGZ_QCOW2}${SHA256SUM}" "${RELEASE_DIR}"
+ set +e
+ chmod_http
+ set -ue
+ return 0
+}
diff --git a/script/step/make_images_slim.sh b/script/step/make_images_slim.sh
new file mode 100644
index 0000000000000000000000000000000000000000..9620fe84d5e3446950972b8f8a9dcfd0fb4aab65
--- /dev/null
+++ b/script/step/make_images_slim.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+# Author: yhon
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+
+######################
+# make images slim
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_images_slim()
+{
+ cd "${PROJECT_PATH}"/current/
+ IMAGES_SLIM=images-slim.tar.gz
+ if [ -f "${IMAGES_SLIM}" ]; then
+ rm -rf "${IMAGES_SLIM}"
+ fi
+ [ -n "IMAGES_SLIM${SHA256SUM}" ] && rm -rf "IMAGES_SLIM${SHA256SUM}"
+ # Change file permission mode to meet security needs
+ set +e
+ chmod 600 image-slim/Dockerfile
+ chmod 700 image-slim/image-slim.sh
+ chmod 600 image-slim/README
+ chmod 600 image-slim/slim.json
+ chmod 600 image-slim/slim.repo
+ chmod 700 image-slim/slim.sh
+ chmod 700 image-slim/tailor-post.sh
+ chmod 700 image-slim/tailor.py
+ set -e
+
+ # fix bep check
+ rm -rf image-slim/.git
+
+ tar czf "${IMAGES_SLIM}" image-slim
+ create_checksum "${IMAGES_SLIM}"
+ RELEASEDIR=$(get_release_dir)
+ RELEASE_DIR="${RELEASEDIR}DockerStack/"
+ SSH_CMD="mkdir -p ${RELEASE_DIR}"
+ sshcmd "${SSH_CMD}"
+ sshscp "${IMAGES_SLIM} ${IMAGES_SLIM}${SHA256SUM}" "${RELEASE_DIR}"
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ [ -f "${IMAGES_SLIM}" ] && rm -rf "${IMAGES_SLIM}"
+ [ -n "IMAGES_SLIM${SHA256SUM}" ] && rm -rf "IMAGES_SLIM${SHA256SUM}"
+
+}
diff --git a/script/step/make_iso.sh b/script/step/make_iso.sh
new file mode 100644
index 0000000000000000000000000000000000000000..99746c01729788679c07a93abc2ae39aafc3a769
--- /dev/null
+++ b/script/step/make_iso.sh
@@ -0,0 +1,121 @@
+#!/bin/bash
+# Author: zhengxuye
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+
+######################
+# 构建iso镜像
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_iso()
+{
+ chroot_run "cd /home; bash make_version.sh make_iso_inchroot"
+}
+######################
+# 在chroot中构建iso镜像
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_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 mkeuleros &> /dev/null; then
+ yum remove mkeuleros -y
+ fi
+ if rpm -q lorax &> /dev/null; then
+ yum remove lorax -y
+ fi
+
+ yum install mkeuleros lorax -y -c "${yum_conf}"
+ cd /opt/mkeuleros
+
+ if [ "${ARCH}" = "x86_64" ]; then
+ mkeuleros_conf="config/standard/standard.conf"
+ elif [ "${ARCH}" = "aarch64" ]; then
+ mkeuleros_conf="config/aarch64/standard.conf"
+ fi
+
+ set +e
+ num=0
+ while [ "${num}" -lt 3 ]
+ do
+ bash -x mkeuleros.sh -f "${mkeuleros_conf}" -n "${OS_NAME}" -v "${OS_VERSION}" -s "SP1" -a "${ARCH}" -r "${OBS_STANDARD_REPO_URL}"
+ 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}-${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}/ISO/$ARCH"
+ MOUNT_DIR="${release_dir}/OS/$ARCH"
+ SSH_CMD="mkdir -p ${RELEASE_DIR} ${MOUNT_DIR}"
+ sshcmd "${SSH_CMD}"
+ sshscp "${TGZ_NAME} ${TGZ_NAME}${SHA256SUM} ${iso_rpmlist}" "${RELEASE_DIR}"
+ set +e
+ SSH_CMD="losetup -a | grep ${TGZ_NAME} | grep ${OS_VERSION} | awk -F ':' '{print \$1}' | xargs umount"
+ sshcmd "${SSH_CMD}"
+ SSH_CMD="mount -t iso9660 -o loop ${RELEASE_DIR}/${TGZ_NAME} ${MOUNT_DIR}"
+ sshcmd "${SSH_CMD}"
+ set -e
+ [ -n "${iso_rpmlist}" ] && rm -rf "${iso_rpmlist}"
+
+ log_info "Release iso to http://${RELEASE_SERVER_IP}:82/${CUSTOM_DIR}/"
+ release_file="release_iso"
+ SSH_CMD="echo http://${RELEASE_SERVER_IP}:82/${RELEASE_DIR}/${TGZ_NAME} > ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}"
+ sshcmd "${SSH_CMD}"
+ log_info "echo http://${RELEASE_SERVER_IP}:82/${RELEASE_DIR}/${TGZ_NAME} > ${release_file}"
+ if [ "${ISCI}" -eq "0" ]; then
+ return 0
+ fi
+ mkdir -pv "${WORK_DIR}"output
+ html="${WORK_DIR}"output/release_iso.html
+ cat /dev/null > "${html}"
+ echo "" >> "${html}"
+ echo '' >> "${html}"
+ echo "
The newest ${VERSION} Release
" >> "${html}"
+ echo "The release is created on $(date)" >> "${html}"
+ echo "
Download on windows: ${TGZ_NAME}
" >> "${html}"
+ echo "
Download on linux: run \"wget http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/${TGZ_NAME}\"
" >> "${html}"
+ echo "
View the history version, please go to : http://${RELEASE_SERVER_IP}/${PRE_VERSION}/
" >> "${html}"
+ echo "
" >> "${html}"
+ echo "" >> "${html}"
+
+ set +e
+ sshscp "${html}" "${HTTP_DIR}/${PRE_VERSION}/${VERSION}"
+ SSH_CMD="chmod 755 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${html##*/}"
+ sshcmd "${SSH_CMD}"
+ set -e
+ return 0
+}
diff --git a/script/step/make_iso_debug.sh b/script/step/make_iso_debug.sh
new file mode 100644
index 0000000000000000000000000000000000000000..827b1cc2b8158d756daad8d5b4a3ab96bb8456f0
--- /dev/null
+++ b/script/step/make_iso_debug.sh
@@ -0,0 +1,124 @@
+#!/bin/bash
+# Author: zhengxuye
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+
+######################
+# make debug iso chroot outside
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_iso_debug()
+{
+ chroot_run "cd /home; bash make_version.sh make_iso_debug_inchroot"
+}
+
+######################
+# make debug iso in chroot
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_iso_debug_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 mkeuleros &> /dev/null; then
+ yum remove mkeuleros -y
+ fi
+ if rpm -q lorax &> /dev/null; then
+ yum remove lorax -y
+ fi
+
+ yum install mkeuleros lorax -y -c "${yum_conf}"
+ cd /opt/mkeuleros
+
+ if [ "repo" = "x86_64" ]; then
+ mkeuleros_conf="config/standard/standard.conf"
+ elif [ "repo" = "aarch64" ]; then
+ mkeuleros_conf="config/aarch64/standard.conf"
+ fi
+
+ set +e
+ num=0
+ while [ "${num}" -lt 3 ]
+ do
+ bash -x mkeuleros.sh -f "${mkeuleros_conf}" -n "${OS_NAME}" -v "${OS_VERSION}" -s "SP1" -a "repo" -r "${OBS_STANDARD_REPO_URL}" -d 1
+ if [ $? -eq 0 ];then
+ break
+ elif [ $? -eq 133 ]; then
+ sleep 60
+ ((num=num+1))
+ continue
+ else
+ log_error "make_iso_debug fail"
+ break
+ fi
+ done
+ if [ "${num}" -ge 3 ]; then
+ log_error "retry make_iso_debug fail"
+ fi
+ set -e
+
+ cd /result
+ TGZ_NAME=$(ls *-dvd.iso)
+ if [ x"${TGZ_NAME}" == x'' ]; then
+ log_error "can not find iso"
+ fi
+ create_checksum "${TGZ_NAME}"
+
+ #TIME_DIR="${PRE_VERSION}/${VERSION}/${version}-${TIME}"
+ #log_info "${HTTP_DIR}/${TIME_DIR}" > "${WORK_DIR}"releasedir_info
+ CUSTOM_DIR="${TIME_DIR}"
+ RELEASE_DIR="${HTTP_DIR}/${CUSTOM_DIR}"
+ SSH_CMD="mkdir -p ${RELEASE_DIR}"
+ sshcmd "${SSH_CMD}"
+ sshscp "${TGZ_NAME} ${TGZ_NAME}${SHA256SUM}" "${RELEASE_DIR}"
+
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ log_info "Release iso to http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/"
+
+ release_file="release_debug"
+ SSH_CMD="echo http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/${TGZ_NAME} > ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}"
+ sshcmd "${SSH_CMD}"
+ log_info "echo http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/${TGZ_NAME} > ${release_file}"
+
+ if [ "${ISCI}" -eq "0" ]; then
+ return 0
+ fi
+
+ mkdir -pv "${WORK_DIR}"output
+ html="${WORK_DIR}"output/release_iso_debug.html
+ cat /dev/null > "${html}"
+ echo "" >> "${html}"
+ echo '' >> "${html}"
+ echo "
The newest ${VERSION} Release
" >> "${html}"
+ echo "The release is created on $(date)" >> "${html}"
+ echo "
Download on windows: ${TGZ_NAME}
" >> "${html}"
+ echo "
Download on linux: run \"wget http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/${TGZ_NAME}\"
" >> "${html}"
+ echo "
View the history version, please go to : http://${RELEASE_SERVER_IP}/${PRE_VERSION}/${VERSION}/
" >> "${html}"
+ echo "
" >> "${html}"
+ echo "" >> "${html}"
+ set +e
+ sshscp "${html}" "${HTTP_DIR}/${PRE_VERSION}/${VERSION}"
+ SSH_CMD="chmod 755 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${html##*/}"
+ sshcmd "${SSH_CMD}"
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ set -e
+
+ return 0
+}
+
diff --git a/script/step/make_iso_everysrc.sh b/script/step/make_iso_everysrc.sh
new file mode 100644
index 0000000000000000000000000000000000000000..34a31936db5d362b9bcd930da264e130daa526b2
--- /dev/null
+++ b/script/step/make_iso_everysrc.sh
@@ -0,0 +1,129 @@
+#!/bin/bash
+set -e
+
+######################
+# make debug iso chroot outside
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_iso_everysrc()
+{
+ chroot_run "cd /home; bash make_version.sh make_iso_everysrc_inchroot"
+}
+
+######################
+# make debug iso in chroot
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_iso_everysrc_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 mkeuleros &> /dev/null; then
+ yum remove mkeuleros -y
+ fi
+ if rpm -q lorax &> /dev/null; then
+ yum remove lorax -y
+ fi
+
+ yum install mkeuleros lorax -y -c "${yum_conf}"
+ cd /opt/mkeuleros
+
+ if [ "${ARCH}" = "x86_64" ]; then
+ mkeuleros_conf="config/standard/standard.conf"
+ elif [ "${ARCH}" = "aarch64" ]; then
+ mkeuleros_conf="config/aarch64/standard.conf"
+ fi
+
+ set +e
+ num=0
+ while [ "${num}" -lt 3 ]
+ do
+ bash -x mkeuleros.sh -f "${mkeuleros_conf}" -n "${OS_NAME}" -v "${OS_VERSION}" -s "SP1" -a "${ARCH}" -r "${OBS_STANDARD_REPO_URL}" -h 1
+ if [ $? -eq 0 ];then
+ break
+ elif [ $? -eq 133 ]; then
+ sleep 60
+ ((num=num+1))
+ continue
+ else
+ log_error "make_iso_debug fail"
+ break
+ fi
+ done
+ if [ "${num}" -ge 3 ]; then
+ log_error "retry make_iso_debug fail"
+ fi
+ set -e
+
+ cd /result
+ TGZ_NAME=$(ls *-dvd.iso)
+ if [ x"${TGZ_NAME}" == x'' ]; then
+ log_error "can not find iso"
+ fi
+ create_checksum "${TGZ_NAME}"
+
+ #TIME_DIR="${PRE_VERSION}/${VERSION}/${version}-${TIME}"
+ #log_info "${HTTP_DIR}/${TIME_DIR}" > "${WORK_DIR}"releasedir_info
+ CUSTOM_DIR="${TIME_DIR}"
+ RELEASE_DIR="${release_dir}/ISO/source"
+ MOUNT_DIR="${release_dir}/source"
+ SSH_CMD="mkdir -p ${RELEASE_DIR} ${MOUNT_DIR}"
+ sshcmd "${SSH_CMD}"
+ sshscp "${TGZ_NAME} ${TGZ_NAME}${SHA256SUM}" "${RELEASE_DIR}"
+ set +e
+ SSH_CMD="losetup -a | grep ${TGZ_NAME} | grep ${OS_VERSION} | awk -F ':' '{print \$1}' | xargs umount"
+ sshcmd "${SSH_CMD}"
+ SSH_CMD="mount -t iso9660 -o loop ${RELEASE_DIR}/${TGZ_NAME} ${MOUNT_DIR}"
+ sshcmd "${SSH_CMD}"
+ set -e
+
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ log_info "Release iso to http://${RELEASE_SERVER_IP}/${RELEASE_DIR}/"
+
+ release_file="release_source"
+ SSH_CMD="echo http://${RELEASE_SERVER_IP}/${RELEASE_DIR}/${TGZ_NAME} > ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}"
+ sshcmd "${SSH_CMD}"
+ log_info "echo http://${RELEASE_SERVER_IP}/${RELEASE_DIR}/${TGZ_NAME} > ${release_file}"
+
+ if [ "${ISCI}" -eq "0" ]; then
+ return 0
+ fi
+ sed +e
+ mkdir -pv "${WORK_DIR}"output
+ html="${WORK_DIR}"output/release_iso_source.html
+ cat /dev/null > "${html}"
+ echo "" >> "${html}"
+ echo '' >> "${html}"
+ echo "
The newest ${VERSION} Release
" >> "${html}"
+ echo "The release is created on $(date)" >> "${html}"
+ echo "
Download on windows: ${TGZ_NAME}
" >> "${html}"
+ echo "
Download on linux: run \"wget http://${RELEASE_SERVER_IP}/${RELEASE_DIR}/${TGZ_NAME}\"
" >> "${html}"
+ echo "
View the history version, please go to : http://${RELEASE_SERVER_IP}/${PRE_VERSION}/
" >> "${html}"
+ echo "
" >> "${html}"
+ echo "" >> "${html}"
+ set +e
+ sshscp "${html}" "${HTTP_DIR}/${PRE_VERSION}/${VERSION}"
+ SSH_CMD="chmod 755 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${html##*/}"
+ sshcmd "${SSH_CMD}"
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ set -e
+
+ return 0
+}
+
diff --git a/script/step/make_iso_everything.sh b/script/step/make_iso_everything.sh
new file mode 100644
index 0000000000000000000000000000000000000000..d0a0e553382b0e7393ab7db7336a7a5ba647c2a9
--- /dev/null
+++ b/script/step/make_iso_everything.sh
@@ -0,0 +1,131 @@
+#!/bin/bash
+# Author: dongjian
+
+set -e
+
+######################
+# make everything iso chroot outside
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_iso_everything()
+{
+ chroot_run "cd /home; bash make_version.sh make_iso_everything_inchroot"
+}
+
+######################
+# make everything iso in chroot
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_iso_everything_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 mkeuleros &> /dev/null; then
+ yum remove mkeuleros -y
+ fi
+ if rpm -q lorax &> /dev/null; then
+ yum remove lorax -y
+ fi
+
+ yum install mkeuleros lorax -y -c "${yum_conf}"
+ cd /opt/mkeuleros
+
+ if [ "${ARCH}" = "x86_64" ]; then
+ mkeuleros_conf="config/standard/standard.conf"
+ elif [ "${ARCH}" = "aarch64" ]; then
+ mkeuleros_conf="config/aarch64/standard.conf"
+ fi
+
+ set +e
+ num=0
+ while [ "${num}" -lt 3 ]
+ do
+ bash -x mkeuleros.sh -f "${mkeuleros_conf}" -n "${OS_NAME}" -v "${OS_VERSION}" -s "SP1" -a "${ARCH}" -r "${OBS_STANDARD_REPO_URL}" -g 1
+ if [ $? -eq 0 ];then
+ break
+ elif [ $? -eq 133 ]; then
+ sleep 60
+ ((num=num+1))
+ continue
+ else
+ log_error "make_iso_everything fail"
+ break
+ fi
+ done
+ if [ "${num}" -ge 3 ]; then
+ log_error "retry make_iso_everything fail"
+ fi
+ set -e
+
+ cd /result
+ TGZ_NAME=$(ls *-dvd.iso)
+ if [ x"${TGZ_NAME}" == x'' ]; then
+ log_error "can not find iso"
+ fi
+ create_checksum "${TGZ_NAME}"
+
+ #TIME_DIR="${PRE_VERSION}/${VERSION}/${version}-${TIME}"
+ #log_info "${HTTP_DIR}/${TIME_DIR}" > "${WORK_DIR}"releasedir_info
+ CUSTOM_DIR="${TIME_DIR}"
+ #RELEASE_DIR="${HTTP_DIR}/${CUSTOM_DIR}"
+ RELEASE_DIR="${release_dir}/ISO/$ARCH"
+ MOUNT_DIR="${release_dir}/everything/$ARCH"
+ SSH_CMD="mkdir -p ${RELEASE_DIR} ${MOUNT_DIR}"
+ sshcmd "${SSH_CMD}"
+ sshscp "${TGZ_NAME} ${TGZ_NAME}${SHA256SUM}" "${RELEASE_DIR}"
+ set +e
+ SSH_CMD="losetup -a | grep ${TGZ_NAME} | grep ${OS_VERSION} | awk -F ':' '{print \$1}' | xargs umount"
+ sshcmd "${SSH_CMD}"
+ SSH_CMD="mount -t iso9660 -o loop ${RELEASE_DIR}/${TGZ_NAME} ${MOUNT_DIR}"
+ sshcmd "${SSH_CMD}"
+ set -e
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ log_info "Release iso to http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/"
+
+ release_file="release_everything"
+ SSH_CMD="echo http://${RELEASE_SERVER_IP}/${RELEASE_DIR}/${TGZ_NAME} > ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}"
+ sshcmd "${SSH_CMD}"
+ log_info "echo http://${RELEASE_SERVER_IP}/${RELEASE_DIR}/${TGZ_NAME} > ${release_file}"
+
+ if [ "${ISCI}" -eq "0" ]; then
+ return 0
+ fi
+
+ mkdir -pv "${WORK_DIR}"output
+ html="${WORK_DIR}"output/release_iso_everything.html
+ cat /dev/null > "${html}"
+ echo "" >> "${html}"
+ echo '' >> "${html}"
+ echo "
The newest ${VERSION} Release
" >> "${html}"
+ echo "The release is created on $(date)" >> "${html}"
+ echo "
Download on windows: ${TGZ_NAME}
" >> "${html}"
+ echo "
Download on linux: run \"wget http://${RELEASE_SERVER_IP}/${RELEASE_DIR}/${TGZ_NAME}\"
" >> "${html}"
+ echo "
View the history version, please go to : http://${RELEASE_SERVER_IP}/${PRE_VERSION}/
" >> "${html}"
+ echo "
" >> "${html}"
+ echo "" >> "${html}"
+ set +e
+ sshscp "${html}" "${HTTP_DIR}/${PRE_VERSION}/${VERSION}"
+ SSH_CMD="chmod 755 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${html##*/}"
+ sshcmd "${SSH_CMD}"
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ set -e
+
+ return 0
+}
+
diff --git a/script/step/make_livecd.sh b/script/step/make_livecd.sh
new file mode 100644
index 0000000000000000000000000000000000000000..44a6008a92b29897d0cbabd047dcb0bb237c89ed
--- /dev/null
+++ b/script/step/make_livecd.sh
@@ -0,0 +1,103 @@
+#!/bin/bash
+# Author: zhengxuye
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+
+######################
+# make livecd chroot outside
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_livecd()
+{
+ chroot_run "cd /home; bash make_version.sh make_livecd_inchroot"
+}
+
+######################
+# make livecd in chroot
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_livecd_inchroot()
+{
+ set -ex
+ rm -rf /etc/yum.repos.d/* || true
+ if [ ! -d /etc/yum.repos.d/ ]; then
+ mkdir -p /etc/yum.repos.d
+ fi
+ cat config/repo_conf/obs-"${ARCH}".conf > /etc/yum.repos.d/EnCloudOS.repo
+
+ yum clean all
+ yum install -y lorax anaconda yum-langpacks libselinux-utils
+
+ createrepo_euleros_all
+ rm -rf /etc/yum.repos.d/EnCloudOS.repo || true
+
+ set +e
+ setenforce 0
+ set -e
+
+ sed -i "s/PRODUCT_NAME/${OS_NAME}-${OS_VERSION}/" "${BUILD_SCRIPT_DIR}/config/livecd/euleros-livecd_${ARCH}.ks"
+ rm -rf /usr/share/lorax/templates.d/99-generic/live && cp -r config/livecd/live /usr/share/lorax/templates.d/99-generic/
+ mkdir -p $(pwd)/tmp
+ livemedia-creator --make-iso --ks=$(pwd)/config/livecd/euleros-livecd_"${ARCH}".ks --nomacboot --no-virt --project "${OS_NAME}" --releasever "${OS_VERSION}" --tmp $(pwd)/tmp --anaconda-arg="--nosave=all_ks" --dracut-arg="--xz" --dracut-arg="--add livenet dmsquash-live convertfs pollcdrom qemu qemu-net" --dracut-arg="--omit" --dracut-arg="plymouth" --dracut-arg="--no-hostonly" --dracut-arg="--debug" --dracut-arg="--no-early-microcode" --dracut-arg="--nostrip"
+ #Release ISO to 158
+ get_version
+ release_dir=$(get_release_dir)
+ TIME_DIR="${release_dir#${HTTP_DIR}}"
+
+ cd tmp/*/images
+ LIVECD_NAME="openEuler_minios_livecd.iso"
+ LIVECD_TAR=$(ls *.iso)
+ mv "${LIVECD_TAR}" "${LIVECD_NAME}"
+
+ create_checksum "${LIVECD_NAME}"
+ CUSTOM_DIR="${TIME_DIR}"
+ RELEASE_DIR="${HTTP_DIR}/${CUSTOM_DIR}"
+ SSH_CMD="mkdir -p ${RELEASE_DIR}"
+ sshcmd "${SSH_CMD}"
+ sshscp "${LIVECD_NAME} ${LIVECD_NAME}${SHA256SUM}" "${RELEASE_DIR}"
+
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ log_info "Release iso to http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/"
+
+ cd -
+ rm -rf *.log
+ [ -n anaconda ] && rm -rf anaconda
+ [ -n tmp ] && rm -rf tmp
+
+ release_file="release_livecd"
+ SSH_CMD="echo http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/${LIVECD_NAME} > ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}"
+ sshcmd "${SSH_CMD}"
+ log_info "echo http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/${LIVECD_NAME} > ${release_file}"
+
+ mkdir -pv "${WORK_DIR}"output
+ html="${WORK_DIR}"output/release_livecd.html
+ cat /dev/null > "${html}"
+ echo "" >> "${html}"
+ echo '' >> "${html}"
+ echo "
The newest ${VERSION} Release
" >> "${html}"
+ echo "The release is created on $(date)" >> "${html}"
+ echo "
Download on windows: ${LIVECD_NAME}
" >> "${html}"
+ echo "
Download on linux: run \"wget http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/${LIVECD_NAME}\"
" >> "${html}"
+ echo "
View the history version, please go to : http://${RELEASE_SERVER_IP}/${PRE_VERSION}/${VERSION}/
" >> "${html}"
+ echo "
" >> "${html}"
+ echo "" >> "${html}"
+
+ set +e
+ sshscp "${html}" "${HTTP_DIR}/${PRE_VERSION}/${VERSION}"
+ SSH_CMD="chmod 755 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${html##*/}"
+ sshcmd "${SSH_CMD}"
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ set -e
+ return 0
+}
+
diff --git a/script/step/make_livecd_bep.sh b/script/step/make_livecd_bep.sh
new file mode 100644
index 0000000000000000000000000000000000000000..a9841bb46d82190b6b52cf826d2b7e7a41ac800f
--- /dev/null
+++ b/script/step/make_livecd_bep.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# Author: liusirui
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+#******************************
+# bep_clean_files
+#******************************
+function bep_clean_files()
+{
+ cat bep_clean.conf | while read files;do
+ [ -n "$files" ] && echo > "$files"
+ done
+}
+
+#******************************
+# bep_remove_files
+#******************************
+function bep_remove_files()
+{
+ set +e
+ cat bep_remove.conf | while read files;do
+ wildcard="$(echo "$files" | grep "*")"
+ if [ -n "$wildcard" ];then
+ tmp_file="$(echo "$files" | sed 's/*//g')"
+ [ -n "$tmp_file" ] && rm -rf "$tmp_file"*
+ else
+ [ -n "$files" ] && rm -rf "$files"
+ fi
+ done
+ set -e
+}
+
+bep_remove_files
+bep_clean_files
+exit 0
diff --git a/script/step/make_livecd_bep_entry.sh b/script/step/make_livecd_bep_entry.sh
new file mode 100644
index 0000000000000000000000000000000000000000..91d704358e2dc153024b4336e0f9189ca83ae10a
--- /dev/null
+++ b/script/step/make_livecd_bep_entry.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# Author: liusirui
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+
+cd "$(dirname "$0")"
+mkdir -p tmp_fs
+mkdir -p old_fs new_fs
+mount LiveOS/squashfs.img old_fs
+cp old_fs/* new_fs/ -rf
+mount new_fs/LiveOS/rootfs.img tmp_fs
+cp ./make_livecd_bep.sh ./tmp_fs/
+cp ./bep_clean.conf ./tmp_fs/
+cp ./bep_remove.conf ./tmp_fs/
+chroot tmp_fs /make_livecd_bep.sh
+rm -f ./tmp_fs/make_livecd_bep.sh
+rm -f ./tmp_fs/bep_clean.conf
+rm -f ./tmp_fs/bep_remove.conf
+umount tmp_fs
+mksquashfs new_fs/ squashfs.img -comp xz
+umount old_fs
+mv -f squashfs.img LiveOS/squashfs.img
+rm -rf old_fs new_fs tmp_fs
diff --git a/script/step/make_netinst_iso.sh b/script/step/make_netinst_iso.sh
new file mode 100644
index 0000000000000000000000000000000000000000..6c9a58d79db8db4f4d7e9b64223a38e939868bc2
--- /dev/null
+++ b/script/step/make_netinst_iso.sh
@@ -0,0 +1,123 @@
+#!/bin/bash
+# Author: xiaqirong
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+
+######################
+# make netinst iso chroot outside
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_netinst_iso()
+{
+ chroot_run "cd /home; bash make_version.sh make_netinst_iso_inchroot"
+}
+
+######################
+# make netinst iso in chroot
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_netinst_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 mkeuleros &> /dev/null; then
+ yum remove mkeuleros -y
+ fi
+ if rpm -q lorax &> /dev/null; then
+ yum remove lorax -y
+ fi
+
+ yum install mkeuleros lorax -y -c "${yum_conf}"
+ cd /opt/mkeuleros
+
+ if [ "${ARCH}" = "x86_64" ]; then
+ mkeuleros_conf="config/standard/standard.conf"
+ elif [ "${ARCH}" = "aarch64" ]; then
+ mkeuleros_conf="config/aarch64/standard.conf"
+ fi
+
+ set +e
+ num=0
+ while [ "${num}" -lt 3 ]
+ do
+ bash -x mkeuleros.sh -f "${mkeuleros_conf}" -n "${OS_NAME}" -N "TRUE" -v "${OS_VERSION}" -s "SP1" -a "${ARCH}" -r "${OBS_STANDARD_REPO_URL}"
+ if [ $? -eq 0 ];then
+ break
+ elif [ $? -eq 133 ]; then
+ sleep 60
+ ((num=num+1))
+ continue
+ else
+ log_error "make_netinst_iso fail"
+ break
+ fi
+ done
+ if [ "${num}" -ge 3 ]; then
+ log_error "retry make_netinst_iso fail"
+ fi
+ set -e
+
+ cd /result
+ TGZ_NAME=$(ls *netinst-"${ARCH}"-dvd.iso)
+ if [ x"${TGZ_NAME}" == x'' ]; then
+ log_error "can not find iso"
+ fi
+ create_checksum "${TGZ_NAME}"
+
+ CUSTOM_DIR="${TIME_DIR}"
+ #RELEASE_DIR="${HTTP_DIR}/${CUSTOM_DIR}"
+ RELEASE_DIR="${release_dir}/ISO/$ARCH"
+ SSH_CMD="mkdir -p ${RELEASE_DIR}"
+ sshcmd "${SSH_CMD}"
+ sshscp "${TGZ_NAME} ${TGZ_NAME}${SHA256SUM}" "${RELEASE_DIR}"
+
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ log_info "Release iso to http://${RELEASE_SERVER_IP}:82/${CUSTOM_DIR}/"
+
+ release_file="release_netinst"
+ SSH_CMD="echo http://${RELEASE_SERVER_IP}:82/${CUSTOM_DIR}/${TGZ_NAME} > ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}"
+ sshcmd "${SSH_CMD}"
+ log_info "echo http://${RELEASE_SERVER_IP}:82/${CUSTOM_DIR}/${TGZ_NAME} > ${release_file}"
+
+ if [ "${ISCI}" -eq "0" ]; then
+ return 0
+ fi
+
+ mkdir -pv "${WORK_DIR}"output
+ html="${WORK_DIR}"output/release_netinst_iso.html
+ cat /dev/null > "${html}"
+ echo "" >> "${html}"
+ echo '' >> "${html}"
+ echo "
The newest ${VERSION} Release
" >> "${html}"
+ echo "The release is created on $(date)" >> "${html}"
+ echo "
Download on windows: ${TGZ_NAME}
" >> "${html}"
+ echo "
Download on linux: run \"wget http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/${TGZ_NAME}\"
" >> "${html}"
+ echo "
View the history version, please go to : http://${RELEASE_SERVER_IP}/${PRE_VERSION}/${VERSION}/
" >> "${html}"
+ echo "
" >> "${html}"
+ echo "" >> "${html}"
+ set +e
+ sshscp "${html}" "${HTTP_DIR}/${PRE_VERSION}/${VERSION}"
+ SSH_CMD="chmod 755 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${html##*/}"
+ sshcmd "${SSH_CMD}"
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ set -e
+
+ return 0
+}
+
diff --git a/script/step/make_raspi_image.sh b/script/step/make_raspi_image.sh
new file mode 100644
index 0000000000000000000000000000000000000000..5ce153a5056e1a02c70f57044532365ff1b7eae7
--- /dev/null
+++ b/script/step/make_raspi_image.sh
@@ -0,0 +1,293 @@
+#!/bin/bash
+
+set -e
+yum_conf="${BUILD_SCRIPT_DIR}/config/repo_conf/obs-repo.conf"
+dogsheng_arch="$(uname -m)"
+
+ERROR(){
+ echo `date` - ERROR, $* | tee -a ${log_dir}/${builddate}.log
+}
+
+LOG(){
+ echo `date` - INFO, $* | tee -a ${log_dir}/${builddate}.log
+}
+
+UMOUNT_ALL(){
+ set +e
+ if grep -q "${rootfs_dir}/dev " /proc/mounts ; then
+ umount -l ${rootfs_dir}/dev
+ fi
+ if grep -q "${rootfs_dir}/proc " /proc/mounts ; then
+ umount -l ${rootfs_dir}/proc
+ fi
+ if grep -q "${rootfs_dir}/sys " /proc/mounts ; then
+ umount -l ${rootfs_dir}/sys
+ fi
+ set -e
+}
+
+LOSETUP_D_IMG(){
+ set +e
+ if [ -d ${root_mnt} ]; then
+ if grep -q "${root_mnt} " /proc/mounts ; then
+ umount ${root_mnt}
+ fi
+ fi
+ if [ -d ${boot_mnt} ]; then
+ if grep -q "${boot_mnt} " /proc/mounts ; then
+ umount ${boot_mnt}
+ fi
+ fi
+ if [ "x$device" != "x" ]; then
+ kpartx -d ${device}
+ losetup -d ${device}
+ device=""
+ fi
+ if [ -d ${root_mnt} ]; then
+ rm -rf ${root_mnt}
+ fi
+ if [ -d ${boot_mnt} ]; then
+ rm -rf ${boot_mnt}
+ fi
+ set -e
+}
+
+INSTALL_PACKAGES(){
+ for item in $(cat $1)
+ do
+ # dnf --installroot=${rootfs_dir}/ install -y $item
+ yum --installroot=${rootfs_dir}/ install -y $item -c "${yum_conf}"
+ if [ $? == 0 ]; then
+ LOG install $item.
+ else
+ ERROR can not install $item.
+ fi
+ done
+}
+
+prepare(){
+ if [ ! -f /usr/share/perl5/vendor_perl/Env.pm ]; then
+ cp "${BUILD_SCRIPT_DIR}/config/docker_image/Env.pm" /usr/share/perl5/vendor_perl/
+ fi
+
+ if [ ! -d ${tmp_dir} ]; then
+ mkdir -p ${tmp_dir}
+ else
+ rm -rf ${tmp_dir}/*
+ fi
+
+ img_file=${img_dir}/${RASPI_IMAGE_NAME}
+
+ if [ ! -d ${log_dir} ]; then
+ mkdir -p ${log_dir}
+ fi
+ LOG "prepare begin..."
+ yum clean all -c "${yum_conf}"
+ yum makecache -c "${yum_conf}"
+
+ if [ -d ${rootfs_dir} ]; then
+ rm -rf ${rootfs_dir}
+ fi
+ if [ ! -d ${img_dir} ]; then
+ mkdir -p ${img_dir}
+ fi
+
+ set +e
+ os_release_name=${OS_NAME}-release
+ set -e
+ LOG "prepare end."
+}
+
+make_rootfs(){
+ LOG "make rootfs for ${yum_conf} begin..."
+ if [[ -d ${rootfs_dir} ]]; then
+ UMOUNT_ALL
+ rm -rf ${rootfs_dir}
+ fi
+ mkdir -p ${rootfs_dir}
+ mkdir -p ${rootfs_dir}/var/lib/rpm
+ rpm --root ${rootfs_dir} --initdb
+ #rpm -ivh --nodeps --root ${rootfs_dir}/ ${os_release_name}
+ mkdir -p ${rootfs_dir}/etc/rpm
+ chmod a+rX ${rootfs_dir}/etc/rpm
+ echo "%_install_langs en_US" > ${rootfs_dir}/etc/rpm/macros.image-language-conf
+ if [[ ! -d ${rootfs_dir}/etc/yum.repos.d ]]; then
+ mkdir -p ${rootfs_dir}/etc/yum.repos.d
+ fi
+ # cp ${yum_conf} ${rootfs_dir}/etc/yum.repos.d/tmp.repo
+ # dnf --installroot=${rootfs_dir}/ install dnf --nogpgcheck -y # --repofrompath=tmp,${rootfs_dir}/etc/yum.repos.d/tmp.repo --disablerepo="*"
+ #dnf --installroot=${rootfs_dir}/ makecache
+ #yum --installroot=${rootfs_dir}/ install makecache -y -c "${yum_conf}"
+ yum --installroot=${OPENEULER_CHROOT_PATH}/ install parted -y -c "${yum_conf}"
+ yum --installroot=${rootfs_dir}/ install ${os_release_name} -y -c "${yum_conf}"
+ # dnf --installroot=${rootfs_dir}/ install -y alsa-utils wpa_supplicant vim net-tools iproute iputils NetworkManager openssh-server passwd hostname ntp bluez pulseaudio-module-bluetooth
+ # dnf --installroot=${rootfs_dir}/ install -y raspberrypi-kernel raspberrypi-firmware openEuler-repos
+ set +e
+ INSTALL_PACKAGES $CONFIG_RPM_LIST
+ cat ${rootfs_dir}/etc/systemd/timesyncd.conf | grep "^NTP*"
+ if [ $? -ne 0 ]; then
+ sed -i 's/#NTP=/NTP=0.cn.pool.ntp.org/g' ${rootfs_dir}/etc/systemd/timesyncd.conf
+ sed -i 's/#FallbackNTP=/FallbackNTP=1.asia.pool.ntp.org 2.asia.pool.ntp.org/g' ${rootfs_dir}/etc/systemd/timesyncd.conf
+ fi
+ set -e
+ #cp ${euler_dir}/hosts ${rootfs_dir}/etc/hosts
+ #if [ ! -d $rootfs_dir/etc/sysconfig/network-scripts ]; then
+ # mkdir -p $rootfs_dir/etc/sysconfig/network-scripts
+ #fi
+ cp ${euler_dir}/ifup-eth0 $rootfs_dir/etc/sysconfig/network-scripts/ifup-eth0
+ mkdir -p ${rootfs_dir}/usr/bin ${rootfs_dir}/lib/udev/rules.d ${rootfs_dir}/lib/systemd/system
+ if [ -d ${rootfs_dir}/usr/share/licenses/raspi ]; then
+ mkdir -p ${rootfs_dir}/usr/share/licenses/raspi
+ fi
+ cp ${euler_dir}/*.rules ${rootfs_dir}/lib/udev/rules.d/
+ cp ${euler_dir}/LICENCE.* ${rootfs_dir}/usr/share/licenses/raspi/
+ cp ${euler_dir}/chroot.sh ${rootfs_dir}/chroot.sh
+ chmod +x ${rootfs_dir}/chroot.sh
+ mount --bind /dev ${rootfs_dir}/dev
+ mount -t proc /proc ${rootfs_dir}/proc
+ mount -t sysfs /sys ${rootfs_dir}/sys
+ chroot ${rootfs_dir} /bin/bash -c "echo 'Y' | /chroot.sh"
+ UMOUNT_ALL
+ # rm ${rootfs_dir}/etc/yum.repos.d/tmp.repo
+ rm ${rootfs_dir}/chroot.sh
+ LOG "make rootfs for ${yum_conf} end."
+}
+
+make_img(){
+ LOG "make ${img_file} begin..."
+ device=""
+ LOSETUP_D_IMG
+ size=`du -sh --block-size=1MiB ${rootfs_dir} | cut -f 1 | xargs`
+ size=$(($size+1100))
+ losetup -D
+ pwd
+ yum install dosfstools parted -y -c "${yum_conf}"
+ dd if=/dev/zero of=${img_file} bs=1MiB count=$size && sync
+ parted ${img_file} mklabel msdos mkpart primary fat32 8192s 593919s
+ parted ${img_file} -s set 1 boot
+ parted ${img_file} mkpart primary linux-swap 593920s 1593343s
+ parted ${img_file} mkpart primary ext4 1593344s 100%
+ device=`losetup -f --show -P ${img_file}`
+ LOG "after losetup: ${device}"
+ trap 'LOSETUP_D_IMG' EXIT
+ LOG "image ${img_file} created and mounted as ${device}"
+ # loopX=`kpartx -va ${device} | sed -E 's/.*(loop[0-9])p.*/\1/g' | head -1`
+ # LOG "after kpartx: ${loopX}"
+ kpartx -va ${device}
+ loopX=${device##*\/}
+ partprobe ${device}
+ bootp=/dev/mapper/${loopX}p1
+ swapp=/dev/mapper/${loopX}p2
+ rootp=/dev/mapper/${loopX}p3
+ LOG "bootp: " ${bootp} "rootp: " ${rootp}
+ mkfs.vfat -n boot ${bootp}
+ mkswap ${swapp}
+ mkfs.ext4 ${rootp}
+ mkdir -p ${root_mnt} ${boot_mnt}
+ mount -t vfat -o uid=root,gid=root,umask=0000 ${bootp} ${boot_mnt}
+ mount -t ext4 ${rootp} ${root_mnt}
+ fstab_array=("" "" "" "")
+ for line in `blkid | grep /dev/mapper/${loopX}p`
+ do
+ uuid=${line#*UUID=\"}
+ fstab_array[${line:18:1}]=${uuid%%\"*}
+ done
+ echo "UUID=${fstab_array[3]} / ext4 defaults,noatime 0 0" > ${rootfs_dir}/etc/fstab
+ echo "UUID=${fstab_array[1]} /boot vfat defaults,noatime 0 0" >> ${rootfs_dir}/etc/fstab
+ echo "UUID=${fstab_array[2]} swap swap defaults,noatime 0 0" >> ${rootfs_dir}/etc/fstab
+
+ cp -a ${rootfs_dir}/boot/* ${boot_mnt}/
+ cp ${euler_dir}/config.txt ${boot_mnt}/
+ echo "console=serial0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 elevator=deadline rootwait" > ${boot_mnt}/cmdline.txt
+
+ if [ -f ${tmp_dir}/rootfs.tar ]; then
+ rm ${tmp_dir}/rootfs.tar
+ fi
+ pushd ${rootfs_dir}
+ rm -rf boot
+ tar cpf ${tmp_dir}/rootfs.tar .
+ popd
+ pushd ${root_mnt}
+ tar xpf ${tmp_dir}/rootfs.tar -C .
+ popd
+ sync
+ sleep 10
+ LOSETUP_D_IMG
+ rm ${tmp_dir}/rootfs.tar
+ rm -rf ${rootfs_dir}
+ losetup -D
+ pushd ${img_dir}
+ if [ -f ${img_file} ]; then
+ sha256sum $(basename ${img_file}) > ${img_file}.sha256sum
+ xz -T 20 -z -c ${img_file} > ${img_file}.xz
+ sha256sum $(basename ${img_file}.xz) > ${img_file}.xz.sha256sum
+ LOG "made sum files for ${img_file}"
+ fi
+ popd
+ LOG "write ${img_file} done."
+ LOG "make ${img_file} end."
+ sshscp "${img_file} ${img_file}.sha256sum ${img_file}.xz ${img_file}.xz.sha256sum " "${RELEASE_DIR}"
+}
+
+function make_raspi_image()
+{
+ chroot_run "cd /home; bash -x make_version.sh make_raspi_image_inchroot"
+ #make_raspi_image_inchroot #make_raspi_image_inchroot
+}
+
+function make_raspi_image_inchroot()
+{
+ echo 'make raspi image'
+ if [ "$EUID" -ne 0 ]; then
+ echo `date` - ERROR, Please run as root!
+ exit
+ fi
+
+ OS_NAME=openEuler
+
+ workdir=$(cd $(dirname $0);pwd)
+ if [ "x${workdir}" == "x/" ]; then
+ workdir=/raspi_output
+ else
+ workdir=${workdir}/raspi_output
+ fi
+
+ tmp_dir=${workdir}/tmp
+ log_dir=${workdir}/log
+ rootfs_dir=${workdir}/rootfs
+ root_mnt=${workdir}/root
+ boot_mnt=${workdir}/boot
+ euler_dir=${BUILD_SCRIPT_DIR}/config/raspi_image
+ CONFIG_RPM_LIST=${euler_dir}/rpmlist
+
+ builddate=$(date +%Y%m%d)
+ get_version
+ release_dir=$(get_release_dir)
+ version_time="${release_dir#${HTTP_DIR}}"
+ version_time=${version_time##*/}
+ repo_dir="${WORK_DIR}repository"
+ img_dir="${WORK_DIR}image"
+ cfg_dir="${WORK_DIR}config"
+ if [ -d "${img_dir}" ]; then
+ rm -rf "${img_dir}"
+ fi
+ mkdir -p "${img_dir}"
+ if [ -d "${repo_dir}" ]; then
+ rm -rf "${repo_dir}"
+ fi
+ mkdir -p "${repo_dir}"
+ if [ -d "${cfg_dir}" ]; then
+ rm -rf "${cfg_dir}"
+ fi
+ mkdir -p "${cfg_dir}"
+ RELEASE_DIR="${release_dir}/raspi_img/"
+ SSH_CMD="mkdir -p ${RELEASE_DIR}"
+ sshcmd "${SSH_CMD}"
+
+ trap 'UMOUNT_ALL' EXIT
+ UMOUNT_ALL
+ prepare
+ IFS=$'\n'
+ make_rootfs
+ make_img
+}
diff --git a/script/step/make_tar.sh b/script/step/make_tar.sh
new file mode 100644
index 0000000000000000000000000000000000000000..0006620b3732f9ab4121adab67650709e023226c
--- /dev/null
+++ b/script/step/make_tar.sh
@@ -0,0 +1,92 @@
+#!/bin/bash
+# Author: zhengxuye
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+source "${BUILD_SCRIPT_DIR}"/custom/custom_make_tar.sh
+
+######################
+# make tar chroot outside
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_tar()
+{
+ chroot_run_bep "cd /home; bash make_version.sh make_tar_inchroot"
+}
+
+######################
+# make tar in chroot
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_tar_inchroot()
+{
+ set +u
+ 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}"
+ rm -f sys-custom-config-*.noarch.rpm
+ yumdownloader -y -c "${yum_conf}" --destdir ./ sys-custom-config.noarch
+ rpm2cpio sys-custom-config-*.noarch.rpm |cpio -dim
+ cd opt/sys-custom-config
+ make_tar_native -v "${version}" -t "${TIME}"
+ cd -
+ TGZ_NAME=$(ls "${WORK_DIR}"/*.tar.gz)
+ if [ $? -ne 0 ]; then
+ log_error "Tar ${KIWITOOL_DIR} into ${version}.tar.gz failed"
+ fi
+ create_checksum "${TGZ_NAME}"
+ CUSTOM_DIR="${TIME_DIR}"
+ RELEASE_DIR="${HTTP_DIR}/${CUSTOM_DIR}"
+ SSH_CMD="mkdir -p ${RELEASE_DIR}"
+ sshcmd "${SSH_CMD}"
+ sshscp "${TGZ_NAME} ${TGZ_NAME}${SHA256SUM}" "${RELEASE_DIR}"
+
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ log_info "Release iso to http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/"
+
+ release_file="release"
+ SSH_CMD="echo http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/${TGZ_NAME##*/} > ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_file}"
+ sshcmd "${SSH_CMD}"
+ log_info "echo http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/${TGZ_NAME} > ${release_file}"
+
+ if [ "${ISCI}" -eq "0" ]; then
+ return 0
+ fi
+ mkdir -pv "${WORK_DIR}"output
+ html="${WORK_DIR}"output/release_tar-"repo.html"
+ cat /dev/null > "${html}"
+ echo "" >> "${html}"
+ echo '' >> "${html}"
+ echo "
The newest ${VERSION} Release
" >> "${html}"
+ echo "The release is created on $(date)" >> "${html}"
+ echo "
Download on windows: ${TGZ_NAME##*/}
" >> "${html}"
+ echo "
Download on linux: run \"wget http://${RELEASE_SERVER_IP}/${CUSTOM_DIR}/${TGZ_NAME##*/}\"
" >> "${html}"
+ echo "
View the history version, please go to : http://${RELEASE_SERVER_IP}/${PRE_VERSION}/${VERSION}/
" >> "${html}"
+ echo "
" >> "${html}"
+ echo "" >> "${html}"
+
+ set +e
+ sshscp "${html}" "${HTTP_DIR}/${PRE_VERSION}/${VERSION}"
+ SSH_CMD="chmod 755 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${html##*/}"
+ sshcmd "${SSH_CMD}"
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ set -ue
+
+ return 0
+}
+
diff --git a/script/step/make_vm_qcow2.sh b/script/step/make_vm_qcow2.sh
new file mode 100644
index 0000000000000000000000000000000000000000..12f554f88adce5d67cf3757a77be59c19c6b1224
--- /dev/null
+++ b/script/step/make_vm_qcow2.sh
@@ -0,0 +1,148 @@
+#!/bin/bash
+# Author: yhon
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+
+set -e
+
+######################
+# make vm qcow2 chroot outside
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_vm_qcow2()
+{
+ chroot_run_bep "cd /home; bash make_version.sh make_vm_qcow2_inchroot"
+}
+
+######################
+# make vm qcow2 in chroot
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_vm_qcow2_inchroot()
+{
+ remoteip=10.175.112.72
+ remoteroot=root
+ remotepwd=EulerLinux
+ qcow2_image_dir=qcow2_image
+ basedir=/home/V3R1/arm64_make_qcow2/arm64_standard
+ remote_img_dir="${basedir}/qcow2_image"
+
+ # remote build
+ sh ./tools/sshcmd.sh -c "rm -rf ${basedir};mkdir -p ${basedir}" -m "${remoteip}" -u "${remoteroot}" -p "${remotepwd}"
+
+ # mount iso for repo
+ release_dir="$(get_release_dir)"
+ set +e
+
+ sh ./tools/sshscp.sh -d "${remoteip}":"${basedir}"/ -s $(pwd) -p "${remotepwd}" -r
+ sh ./tools/sshcmd.sh -c "cd ${basedir}/local_script; sed -i \"0,/STARTTIME/ s/STARTTIME/#STARTTIME/\" make_version.sh; \
+ sed -i \"0,/exec/ s/exec/#exec/\" make_version.sh;bash make_version.sh make_vm_qcow2_main" \
+ -m "${remoteip}" -u "${remoteroot}" -p "${remotepwd}"
+ set -e
+
+ # upload
+ [ -n "${qcow2_image_dir}" ] && rm -rf "${qcow2_image_dir}"
+ mkdir "${qcow2_image_dir}"
+ RELEASE_DIR="${release_dir}/virtual_machine_img/$ARCH"
+ SSH_CMD="mkdir -p ${RELEASE_DIR}"
+ sshcmd "${SSH_CMD}"
+
+ sh "${TOOLS}"/safe_sshscp.sh -p "${remotepwd}" -s "${remoteip}:${remote_img_dir}/*.qcow2" -d "${qcow2_image_dir}" -r
+ sh "${TOOLS}"/safe_sshscp.sh -p "${remotepwd}" -s "${remoteip}:${remote_img_dir}/*.qcow2${SHA256SUM}" -d "${qcow2_image_dir}" -r
+ cd "${qcow2_image_dir}"
+ qcow2_img="$(ls *.qcow2)"
+ qcow2_sha256=$(ls *.qcow2"${SHA256SUM}")
+
+ sshscp "${qcow2_img} ${qcow2_sha256}" "${RELEASE_DIR}"
+ if [ $? -ne 0 ]; then log_error "Failed upload qcow2";fi;
+ chmod_http
+ if [ $? -ne 0 ]; then log_error "Failed in chmod_http";fi;
+
+ log_info "Release ${qcow2_img} ${qcow2_sha256} to ${RELEASE_SERVER_IP}:${RELEASE_DIR}"
+}
+
+######################
+# make vm qcow2 main function
+# Globals:
+# Arguments:
+# Returns:
+######################
+function make_vm_qcow2_main()
+{
+ get_version
+ release_dir="$(get_release_dir)"
+ version_time=${release_dir#/repo/openeuler/dailybuild/}
+ version_time=${version_time##*/}
+
+ IMG_DIR="../qcow2_image"
+
+ set +e
+ if [ ! -d "${IMG_DIR}" ]; then mkdir -p "${IMG_DIR}";fi;
+
+ if [ -f config/ks/euleros-ks.cfg ]; then
+ rm /var/www/html/ks/euleros-ks.cfg
+ cp -f config/ks/euleros-ks.cfg /var/www/html/ks/euleros-ks.cfg
+ chmod -R 755 /var/www/html/ks
+ fi
+
+ cp -f config/vm-install.xml "${IMG_DIR}"/
+ cp -f config/grub.cfg /var/lib/tftpboot/
+ pushd "${IMG_DIR}"
+
+ rm -f vm*.log
+ if [ ! -d euleros-iso ];then mkdir euleros-iso; else umount euleros-iso;fi
+
+ if [ -f "${DVD_NAME}" ]; then rm "${DVD_NAME}";fi;
+
+ MOUNT_DIR=$(echo "${release_dir}" | cut -d '/' -f 5-9)
+ wget -q http://euleros_test:euleros_test@"${RELEASE_SERVER_IP}/${MOUNT_DIR}${DVD_NAME}"
+ mount "${DVD_NAME}" euleros-iso
+
+ if [ ! -f /var/lib/tftpboot/grubaa64.efi ]; then cp euleros-iso/EFI/BOOT/grubaa64.efi /var/lib/tftpboot/;fi;
+ cp -f euleros-iso/images/pxeboot/vmlinuz /var/lib/tftpboot/
+ cp -f euleros-iso/images/pxeboot/initrd.img /var/lib/tftpboot/
+ umount euleros-iso
+ chmod -R 755 /var/lib/tftpboot/
+
+ img_name="${OS_NAME}-${OS_VERSION}.${ARCH}.qcow2"
+ if [ -f "${img_name}" ]; then rm "${img_name}";fi;
+
+ UUID="$(cat /proc/sys/kernel/random/uuid)"
+ VM=vm"${UUID}"
+ sed -i "s/VM_NAME/${VM}/g" vm-install.xml
+ sed -i "s:VM_PATH:${PWD}:g" vm-install.xml
+ DATE=$(date +%Y-%m-%d)
+ sed -i "s:LOG_PATH:${PWD}/${VM}_${DATE}_install.log:g" vm-install.xml
+ virsh define vm-install.xml
+ qemu-img create -f qcow2 "${img_name}" 100G
+ DATE="$(date +%Y-%m-%d)"
+ virsh start "${VM}"
+ VM_STATUS="running"
+ INSTALL_TIME=0
+ while [ "${VM_STATUS}" = "running" ] && [ "${INSTALL_TIME}" -le 1800 ]; do
+ sleep 30
+ INSTALL_TIME="$(expr ${INSTALL_TIME} + 30)"
+ VM_STATUS=$(virsh domstate "${VM}")
+ done
+
+ grep -nr "Power down" "${VM}"_"${DATE}"_install.log
+ if [ $? -eq 0 ]; then
+ virsh undefine "${VM}"
+ log_info "vm install successful"
+ else
+ cat "${VM}_${DATE}_install.log"
+ log_info "vm status is ${VM_STATUS} "
+ virsh destroy "${VM}"
+ virsh undefine "${VM}"
+ rm "${img_name}"
+ log_error "install vm failed"
+ fi
+
+ set -e
+ sha256sum "${img_name}" > "${img_name}${SHA256SUM}"
+ popd
+}
+
diff --git a/script/step/merge_release_html.sh b/script/step/merge_release_html.sh
new file mode 100644
index 0000000000000000000000000000000000000000..2ef741ada351cd7e1dc12833c89af5a3bc1c6233
--- /dev/null
+++ b/script/step/merge_release_html.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+# Author: zhengxuye
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+
+######################
+# merge release html
+# Globals:
+# Arguments:
+# Returns:
+######################
+function merge_release_html()
+{
+ set +e
+ sshscp_from "${HTTP_DIR}/${PRE_VERSION}/${VERSION}/\*\.html" "./"
+ set -e
+
+ dst_html=dst.html
+ if ! $(ls release_*.html &> /dev/null);then
+ rm -f *.html
+ echo "No html is avaliable !" > "${dst_html}"
+ else
+ cat $(ls release_*.html | head -n 1) > "${dst_html}"
+ win_line=$(grep -n "Download on windows" "${dst_html}" | awk -F ':' '{print $1}')
+ linux_line=$(grep -n "Download on linux" "${dst_html}" | awk -F ':' '{print $1}')
+ ((linux_line="${linux_line}"+1))
+ for file in $(ls release_*.html)
+ do
+ #skip the empty file
+ contents=$(cat "${file}")
+ if [ "x${contents}" == "x" ];then
+ continue
+ fi
+ #exclude double link
+ link=$(cat "${file}" | grep "Download on windows" | awk -F '"' '{print $2}')
+ tar_name=${link##*/}
+ if cat "${dst_html}" | grep "${tar_name}" &> /dev/null;then
+ continue
+ fi
+ link=$(cat "${file}" | grep "Download on linux" | awk -F '"' '{print $2}')
+ tar_name=${link##*/}
+ if cat "${dst_html}" | grep "${tar_name}" &> /dev/null;then
+ continue
+ fi
+
+ #insert new link
+ win_link=$(cat "${file}" | grep "Download on windows")
+ linux_lik=$(cat "${file}" | grep "Download on linux")
+ sed -i "${win_line} a${win_link}" "${dst_html}"
+ sed -i "${linux_line} a${linux_lik}" "${dst_html}"
+ ((win_line="${win_line}"+1))
+ ((linux_line="${linux_line}"+2))
+ done
+ fi
+ CMD="rm -f ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/release_*.html"
+ sshcmd "${CMD}"
+
+ cat "${dst_html}" > release.html
+ sshscp release.html "${HTTP_DIR}/${PRE_VERSION}/${VERSION}/"
+ set +e
+ CMD="chmod 755 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/release.html"
+ sshcmd "${CMD}"
+ set -e
+ chmod_http
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ rm -f *.html
+}
diff --git a/script/step/mkdliso_hyperstackos.sh b/script/step/mkdliso_hyperstackos.sh
new file mode 100644
index 0000000000000000000000000000000000000000..da9502196e78c5f0235dba9183c479c55ea79fb1
--- /dev/null
+++ b/script/step/mkdliso_hyperstackos.sh
@@ -0,0 +1,95 @@
+#!/bin/bash
+# Author: yhon
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+
+set -e
+
+######################
+# make HyperStackOS chroot outside
+# Globals:
+# Arguments:
+# Returns:
+######################
+function mkdliso_hyperstackos()
+{
+ chroot_run_bep "cd /home; bash make_version.sh mkdliso_hyperstackos_inchroot"
+}
+
+######################
+# make HyperStackOS in chroot
+# Globals:
+# Arguments:
+# Returns:
+######################
+function mkdliso_hyperstackos_inchroot()
+{
+ MKISO_PATH=/home/mkiso_ARM64
+ basedir=/usr1/EulerOS__ARM64
+ PRODUCT="$1"
+ CFG="custom/cfg_"$(echo "${PRODUCT}" | tr '[A-Z]' '[a-z]')""
+ ISO="${DVD_NAME}"
+ ISOILP32=EulerOS-V3.0SP1-aarch64-ilp32-dvd.iso
+
+ rm -f ./release_tmp ./release *.tar.gz
+ cd "${basedir}"
+ sshscp_from "/repo/openeuler/dailybuild/${PRE_VERSION}/${VERSION}/release" .
+ TAR_NAME="$(cat release |awk -F / '{print $NF}')"
+ TAR=${TAR_NAME%.tar.gz}
+
+ thread_list="$(ps -ef | grep mkdliso | grep -v grep | awk '{print $2}')"
+ for id in $(cat thread_list)
+ do
+ log_info "There has been several threads about mkdliso ,already. Killing..."
+ kill 9 "${id}"
+ done
+
+ [ -n "${TAR}" ] && rm -rf "${TAR}"
+ [ -n "${TAR_NAME}" ] && rm -rf "${TAR_NAME}"
+ wget -q $(cat release) &> /dev/null
+ if [ $? -ne 0 ];then
+ log_error "wget ${TAR_NAME} failed!"
+ fi
+ log_info "wget ${TAR_NAME} success!"
+
+ tar xzf "${TAR_NAME}"
+ if [ $? -ne 0 ]
+ then
+ log_error "${TAR_NAME} unzip failed!"
+ fi
+ log_info "${TAR_NAME} unzip success!"
+ rm -rf "${TAR_NAME}"
+
+ cd "${basedir}/${TAR}"
+ mv repos/kernel repos/Update/
+ mv repos/glibc-pkgs repos/Update/
+ find repos/ -name *.rpm > repos/iso_package.list
+
+ ./mkdliso -p "${PRODUCT}" -c "${CFG}"
+ if [ $? -ne 0 ];then
+ log_error "kiwi_iso failed!"
+ fi
+ log_info "kiwi iso success!"
+
+ sshscp_from "/repo/openeuler/dailybuild/${PRE_VERSION}/${VERSION}/release_tmp" .
+ if [ $? -ne 0 ];then
+ log_error "wget release_tmp failed!"
+ fi
+ log_info "wget release_tmp success!"
+
+ RELEASEDIR="$(cat release_tmp)"
+ RELEASE_DIR="${RELEASEDIR}/ISO"
+ SSH_CMD="mkdir -p ${RELEASE_DIR}"
+ sshcmd "${SSH_CMD}"
+
+ cd result/20*
+ create_checksum "${ISO}"
+ sshscp "${ISO} ${ISO}${SHA256SUM}" "${RELEASE_DIR}"
+
+ chmod_http 'openeuler_${ARCH}'
+ if [ $? -ne 0 ]; then
+ log_error "Failed in chmod_http"
+ fi
+ log_info "Release ${ISO} to ${RELEASE_SERVER_IP}:${RELEASE_DIR}"
+
+ return 0
+}
diff --git a/script/step/release_dir.sh b/script/step/release_dir.sh
new file mode 100644
index 0000000000000000000000000000000000000000..838e78d66f95855676ecdc780f2f229eb05dd47f
--- /dev/null
+++ b/script/step/release_dir.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+# set and get release_version directories
+set -e
+# setting up the daily build directory
+# The default version is openeuler, can receive parameters passed by jenkins.
+function set_release_dir()
+{
+ version="openeuler"
+ [ -z "${version}" ] && log_error "You must set version in config file or from CI web page"
+ log_info "------------the version is ${version}-----------"
+ SSH_CMD="mkdir -p ${HTTP_DIR}/${PRE_VERSION}/${version}_ARM64; echo ${version} > ${HTTP_DIR}/${PRE_VERSION}/${version}_ARM64/version; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${version}_ARM64/version"
+ sshcmd "${SSH_CMD}"
+ SSH_CMD="mkdir -p ${HTTP_DIR}/${PRE_VERSION}/${version}_X86; echo ${version} > ${HTTP_DIR}/${PRE_VERSION}/${version}_X86/version; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${version}_X86/version"
+ sshcmd "${SSH_CMD}"
+
+ if [ -f "${WORK_DIR}DEBUG" ]
+ then
+ debug='debug'
+ else
+ debug='nodebug'
+ fi
+
+ SSH_CMD="echo ${debug} > ${HTTP_DIR}/${PRE_VERSION}/${version}_ARM64/log_level; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${version}_ARM64/log_level"
+ sshcmd "${SSH_CMD}"
+ SSH_CMD="echo ${debug} > ${HTTP_DIR}/${PRE_VERSION}/${version}_X86/log_level; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${version}_X86/log_level"
+ sshcmd "${SSH_CMD}"
+
+ release_tmp='release_tmp'
+ TIME=$(date +%Y-%m-%d-%H-%M-%S)
+ TIME_DIR="${PRE_VERSION}/${version}-${TIME}"
+ SSH_CMD="echo ${HTTP_DIR}/${TIME_DIR} > ${HTTP_DIR}/${PRE_VERSION}/${version}_ARM64/${release_tmp}; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${version}_ARM64/${release_tmp}"
+ sshcmd "${SSH_CMD}"
+ SSH_CMD="echo ${HTTP_DIR}/${TIME_DIR} > ${HTTP_DIR}/${PRE_VERSION}/${version}_X86/${release_tmp}; chmod 644 ${HTTP_DIR}/${PRE_VERSION}/${version}_X86/${release_tmp}"
+ sshcmd "${SSH_CMD}"
+}
+
+# get release dir
+# huo qu mei ri gou jian mu lu
+function get_release_dir()
+{
+ release_tmp='release_tmp'
+ rm -f ./"${release_tmp}"
+ sshscp_from "${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_tmp}" "./" &> /dev/null
+ if [ $? -ne 0 ]; then
+ log_error "Failed on sshscp_from ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${release_tmp} ./"
+ fi
+ echo $(cat "${release_tmp}")
+}
diff --git a/script/step/to_lts.sh b/script/step/to_lts.sh
new file mode 100644
index 0000000000000000000000000000000000000000..c54ff25aa01a76ed7b3e2441bc8db975f3ee93b3
--- /dev/null
+++ b/script/step/to_lts.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+echo "start to lts dir"
+release_dir=$(cat /mnt/release/my_release_dir)
+password=$(cat /mnt/dogshengpwd81)
+#sshpass -p "$password" scp -o StrictHostKeyChecking=no -r root@121.36.84.172:${release_dir} /mnt/release/ARM64/
+#rm -rf *.sh
diff --git a/script/step/update_release_info.sh b/script/step/update_release_info.sh
new file mode 100644
index 0000000000000000000000000000000000000000..92345a481f762baaaf7cf64d297bf70c65647fd7
--- /dev/null
+++ b/script/step/update_release_info.sh
@@ -0,0 +1,120 @@
+#!/bin/bash
+set -e
+
+function update_release_info()
+{
+ #if [ "${ISCI}" -eq 0 ]; then
+ # return 0
+ #fi
+
+ temp_dir="code_merge_dir"
+ pkg="openEuler-latest-release"
+ obs_pro="${OBS_STANDARD_PROJECT}"
+
+ [ -n "${temp_dir}" ] && rm -rf "${temp_dir}"
+ mkdir "${temp_dir}"
+ cd "${temp_dir}"
+
+ #init_osc
+ osc co "${obs_pro}" "${pkg}"
+ osc up "${obs_pro}/${pkg}"
+ set +u
+
+ #update sdf file
+ get_version
+ release_dir=$(get_release_dir)
+ TIME_DIR=${release_dir#/repo/openeuler/dailybuild/}
+
+ TIME=${TIME_DIR##*/}
+ TIME=${TIME#"${version}"-}
+ version="openEuler"
+ echo "${version}" > version
+ rm -rf kernel*.rpm java-1.8.0-openjdk*.rpm gcc*.rpm
+ #yumdownloader kernel
+ wget -q -r -l1 -nd -A kernel-[0-9]*.${ARCH}.rpm ${OBS_STANDARD_REPO_URL}/${ARCH}/
+ wget -q -r -l1 -nd -A java-1.8.0-openjdk-[0-9]*.${ARCH}.rpm ${OBS_STANDARD_REPO_URL}/${ARCH}/
+ wget -q -r -l1 -nd -A gcc-[0-9]*.${ARCH}.rpm ${OBS_STANDARD_REPO_URL}/${ARCH}/
+ mv kernel*.rpm kernel.rpm
+ mv java-1.8.0-openjdk*.rpm java-1.8.0-openjdk.rpm
+ mv gcc*.rpm gcc.rpm
+ kver=$(rpm -qp --qf "%{Version}-%{Release}\n" kernel.rpm)
+ dogshengopenjdk=$(rpm -qp --qf "%{Version}-%{Release}\n" java-1.8.0-openjdk.rpm)
+ dogshenggcc=$(rpm -qp --qf "%{Version}-%{Release}\n" gcc.rpm)
+
+ namer="${kver}"
+ dailyversion="${OS_NAME}-${OS_VERSION}"
+
+ set +e
+ sdf_file="${obs_pro}/${pkg}/isopackage.sdf"
+ echo "openeulerversion=${dailyversion}" > "${sdf_file}"
+ echo "compiletime=${TIME}" >> "${sdf_file}"
+ echo "gccversion=${dogshenggcc}" >> "${sdf_file}"
+ echo "kernelversion=${namer}" >> "${sdf_file}"
+ echo "openjdkversion=${dogshengopenjdk}" >> "${sdf_file}"
+ sdf_file="${obs_pro}/${pkg}/isopackage_arm64.sdf"
+ echo "openeulerversion=${dailyversion}" > "${sdf_file}"
+ echo "compiletime=${TIME}" >> "${sdf_file}"
+ echo "gccversion=${dogshenggcc}" >> "${sdf_file}"
+ echo "kernelversion=${namer}" >> "${sdf_file}"
+ echo "openjdkversion=${dogshengopenjdk}" >> "${sdf_file}"
+ set -e
+ #update end
+ timestr=`date +%s --utc -d "$(grep "compiletime" ${sdf_file} | cut -d '=' -f2 | sed 's/-/ /3' | sed 's/-/:/3' | sed 's/-/:/3')"`
+ root_url=$(echo ${OBS_STANDARD_REPO_URL%/*})
+ arm_flag=0
+ x86_flag=0
+ wget -q -r -l1 -nd -A openEuler-latest-release-*.aarch64.rpm ${root_url}/standard_aarch64/aarch64/
+ pkginfo=`ls | grep $pkg`
+ if [[ "$pkginfo" =~ "$timestr" ]];then
+ arm_flag=1
+ rm -rf ${pkg}*
+ fi
+ wget -q -r -l1 -nd -A openEuler-latest-release-*.x86_64.rpm ${root_url}/standard_x86_64/x86_64/
+ pkginfo=`ls | grep $pkg`
+ if [[ "$pkginfo" =~ "$timestr" ]];then
+ x86_flag=1
+ rm -rf ${pkg}*
+ fi
+ if [[ ${arm_flag} -eq 1 ]] && [[ ${x86_flag} -eq 1 ]];then
+ echo "nothing to do"
+ else
+ #code commit
+ rm -rf ${pkg}*
+ cd "${obs_pro}/${pkg}"
+ osc up
+ osc add isopackage.sdf
+ osc ci -m "update isopackage.sdf"
+ osc up
+ osc add isopackage_arm64.sdf
+ osc ci -m "update isopackage_arm64.sdf"
+ waitime=6000
+ while [ $waitime -gt 0 ]
+ do
+ set +e
+ if [ ${arm_flag} -eq 0 ];then
+ wget -q -r -l1 -nd -A openEuler-latest-release-*.aarch64.rpm ${root_url}/standard_aarch64/aarch64/
+ pkginfo=`ls | grep $pkg`
+ if [[ "$pkginfo" =~ "$timestr" ]];then
+ arm_flag=1
+ fi
+ rm -rf ${pkg}*
+ fi
+ if [ ${x86_flag} -eq 0 ];then
+ wget -q -r -l1 -nd -A openEuler-latest-release-*.x86_64.rpm ${root_url}/standard_x86_64/x86_64/
+ pkginfo=`ls | grep $pkg`
+ if [[ "$pkginfo" =~ "$timestr" ]];then
+ x86_flag=1
+ fi
+ rm -rf ${pkg}*
+ fi
+ if [[ ${arm_flag} -eq 1 ]] && [[ ${x86_flag} -eq 1 ]];then
+ break
+ fi
+ let waitime=$waitime-5
+ sleep 5
+ set -e
+ done
+ cd "${BUILD_SCRIPT_DIR}"
+ [ -n "${temp_dir}" ] && rm -rf "${temp_dir}"
+ fi
+}
diff --git a/script/tools/chroot.sh b/script/tools/chroot.sh
new file mode 100644
index 0000000000000000000000000000000000000000..5cbc14dc52a813541a32b2ca453a41e7075a30d6
--- /dev/null
+++ b/script/tools/chroot.sh
@@ -0,0 +1,78 @@
+#!/bin/bash
+set -e
+
+function chroot_addbep()
+{
+ # add bep-env in /usr1/openeuler
+ wget -P "${OPENEULER_CHROOT_PATH}" -q -r -l1 -nd -A 'bep-env-*.rpm' "${OBS_EXTRAS_REPO_URL}/${ARCH}/" &> /dev/null
+ chroot "${OPENEULER_CHROOT_PATH}" /bin/bash --login -c "rpm -ivh bep-env-*.rpm --nodeps --force &> /dev/null"
+ chroot "${OPENEULER_CHROOT_PATH}" /bin/bash --login -c "sed -i '/BEP_GTDLIST/s/\"$/ createrepo lorax livemedia-creator\"/ ' /etc/profile"
+ chroot "${OPENEULER_CHROOT_PATH}" /bin/bash --login -c "sed -i '/BEP_BLACKLIST/s/\"$/ createrepo lorax livemedia-creator\"/ ' /etc/profile"
+ chroot "${OPENEULER_CHROOT_PATH}" /bin/bash --login -c "sed -i '/BEP_RANDOMLIST/s/\"$/ createrepo lorax livemedia-creator\"/ ' /etc/profile"
+}
+
+function chroot_init()
+{
+ chroot_clean
+ rm -f openEuler_chroot-*.noarch.rpm
+ wget -q -r -l1 -nd -A 'openEuler_chroot-*.noarch.rpm' "${OBS_EXTRAS_REPO_URL}/noarch/" &> /dev/null
+ rpm -ivh openEuler_chroot-*.noarch.rpm
+ rm -f openEuler_chroot-*.noarch.rpm
+ cp -a "${BUILD_SCRIPT_DIR}"/* "${OPENEULER_CHROOT_PATH}/home"
+ mkdir -p "${OPENEULER_CHROOT_PATH}/root/.ssh/"
+ cp ~/.ssh/super_publish_rsa "${OPENEULER_CHROOT_PATH}/root/.ssh/"
+ if echo "${BUILD_SCRIPT_DIR}" | grep 'gcov-'; then
+ sed -i '/VERSION=/ iexport CI_PROJECT="openeuler_ARM64_gcov"' "${OPENEULER_CHROOT_PATH}"/home/internal.sh
+ fi
+ chroot "${OPENEULER_CHROOT_PATH}" /bin/bash -c "echo ${OBS_SERVER_IP} openeuler-obs-repo.huawei.com >> /etc/hosts"
+}
+
+function chroot_clean()
+{
+ pwd
+ ls /
+ set +e
+ rpm -e openEuler_chroot
+ if [ -d "${OPENEULER_CHROOT_PATH}" ]; then
+ lsof | grep openeuler
+ for openeuler_pid in $(lsof | grep '/usr1/openeuler/' | awk '{print $2}')
+ do
+ kill -9 "${openeuler_pid}"
+ done
+ umount "${OPENEULER_CHROOT_PATH}/proc"
+ umount "${OPENEULER_CHROOT_PATH}/sys"
+ umount "${OPENEULER_CHROOT_PATH}/dev/pts"
+ umount "${OPENEULER_CHROOT_PATH}/dev"
+ rm -rf "${OPENEULER_CHROOT_PATH}"
+ fi
+ if [ -d "${OPENEULER_CHROOT_PATH}" ]; then
+ log_error "delete ${OPENEULER_CHROOT_PATH} failed"
+ fi
+ set -e
+}
+
+######################
+# 在chroot环境中运行
+# Globals:
+# Arguments:需要运行的shell命令
+# Returns:
+######################
+function chroot_run()
+{
+ chroot_init
+ chroot "${OPENEULER_CHROOT_PATH}" /bin/bash --login -c "$@"
+ chroot_clean
+}
+######################
+# 在bep chroot环境中运行
+# Globals:
+# Arguments:需要运行的shell命令
+# Returns:
+######################
+function chroot_run_bep()
+{
+ chroot_init
+ chroot_addbep
+ chroot "${OPENEULER_CHROOT_PATH}" /bin/bash --login -c "$@"
+ chroot_clean
+}
diff --git a/script/tools/common.sh b/script/tools/common.sh
new file mode 100644
index 0000000000000000000000000000000000000000..2305b93b40e5b6aa6e3a277ab3cf3d0748113340
--- /dev/null
+++ b/script/tools/common.sh
@@ -0,0 +1,92 @@
+#!/bin/bash
+# Author: xudengfeng
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+
+######################
+# modify config for gcov
+# Globals:
+# Arguments:
+# Returns:
+######################
+function modify_for_gcov()
+{
+ root_path="$1"
+ for prj in $(echo "${GCOV_OBS_STANDARD_REPO_URL}")
+ do
+ prj=$(echo "${prj}" | sed 's/EulerOS_T/EulerOS/g')
+ old_prj=$(echo "${prj}" | sed 's/GCOV_EulerOS/EulerOS/g')
+ old_repo=$(echo "${old_prj}" | sed 's/:/:\//g')
+ repo=$(echo "${prj}" | sed 's/:/:\//g')
+ files=$(find "${root_path}" -type f | grep -v "gcov_.*repo" | xargs egrep "$old_prj" | awk -F':' '{print $1}' | sort | uniq)
+ if [ -n "${files}" ]; then
+ sed -i "s#${old_prj}#${prj}#g" $(echo "${files}")
+ fi
+ files=$(find "${root_path}" -type f | grep -v "gcov_.*repo" | xargs egrep "${old_repo}" | awk -F':' '{print $1}' | sort | uniq)
+ if [ -n "${files}" ]; then
+ sed -i "s#${old_repo}#${repo}#g" $(echo "${files}")
+ fi
+ done
+ grep "GCOV_GCOV_" "${root_path}" -lR | grep -v "tools/common.sh" | while read line
+ do
+ sed -i 's#GCOV_GCOV_#GCOV_#g' $(echo "${line}")
+ done
+}
+
+######################
+# set log level
+# Globals:
+# Arguments:
+# Returns:
+######################
+function set_log_level()
+{
+ log_level='log_level'
+ rm -f "./${log_level}"
+ set +e
+ sshscp_from "${HTTP_DIR}/${PRE_VERSION}/${VERSION/}${log_level}" "./" &> /dev/null
+ if [ "$?" -ne "0" ]; then
+ DEBUG=0
+ else
+ level=$(cat "${log_level}")
+ if [ "${level}" == "debug" ]; then
+ DEBUG=1
+ fi
+ fi
+ set -e
+}
+
+######################
+# chmod http
+# Globals:
+# Arguments:
+# Returns:
+######################
+function chmod_http()
+{
+ release_dir=$(get_release_dir)
+ SSH_CMD="chmod -R 755 ${release_dir}/ISO"
+ sshcmd "${SSH_CMD}"
+}
+
+######################
+# trigger jenkins project
+# Globals:
+# Arguments:
+# Returns:
+######################
+function trigger_jenkins_project()
+{
+ jenkins_prj="$1"
+ product="$2"
+ set +u
+ if [ "x${team_from_jenkins}" != "x" ]; then
+ return 0
+ fi
+ if [ "x${product}" == "x" ]; then
+ CMD="curl http://10.175.100.200:8080/jenkins/job//${jenkins_prj}/build?token=xdf"
+ else
+ CMD="curl http://10.175.100.200:8080/jenkins/job/${jenkins_prj}/buildWithParameters?token=xdf -d CONFIG_URL=http://${RELEASE_SERVER_IP}/${PRE_VERSION}/${VERSION}/config_${product}"
+ fi
+ eval "${CMD}"
+}
diff --git a/script/tools/safe_sshcmd.sh b/script/tools/safe_sshcmd.sh
new file mode 100644
index 0000000000000000000000000000000000000000..7aea68e1f9345c8d8179e5193a43e26597db071d
--- /dev/null
+++ b/script/tools/safe_sshcmd.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Author: xudengfeng
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+execcmd=""
+machineip=""
+loginuser=root
+loginpassword=huawei
+timeout=120
+retry_cnt=3
+
+######################
+# display usage
+# Globals:
+# Arguments:
+# Returns:
+######################
+function usage()
+{
+ echo "Usage: sshcmd.sh -c "command" -m "machinetip" [-u login_user] [-p login_password] [-t ping_timeout] [-n ssh_retry_time]"
+}
+
+while getopts "c:m:p:u:t:n:h" OPTIONS
+do
+ case "${OPTIONS}" in
+ c) execcmd="${OPTARG}";;
+ m) machineip="${OPTARG}";;
+ u) loginuser="${OPTARG}";;
+ p) loginpassword="${OPTARG}";;
+ t) timeout="${OPTARG}";;
+ n) retry_cnt="${OPTARG}";;
+ \?) echo "ERROR - Invalid parameter"; echo "ERROR - Invalid parameter" >&2;usage;exit 1;;
+ *) echo "ERROR - Invalid parameter"; echo "ERROR - Invalid parameter" >&2; usage;exit 1;;
+ esac
+done
+
+
+if [ "x${execcmd}" = "x" -o "x${machineip}" = "x" ];then
+ usage
+ exit 1
+fi
+
+for((i=0;i /dev/null
+ if [ $? -ne 0 ]; then
+ if [ "${sleeptime}" -ge "${timeout}" ]; then
+ echo "ERROR: ping ${RELEASE_SERVER_IP} Failed"
+ exit 1
+ else
+ sleep 15
+ ((sleeptime = "${sleeptime}" + 15))
+ fi
+ else
+ break
+ fi
+ done
+ else
+ break
+ fi
+done
diff --git a/script/tools/safe_sshscp.sh b/script/tools/safe_sshscp.sh
new file mode 100644
index 0000000000000000000000000000000000000000..07bc82f203bb5a3caf443e2ad348aa041f45aab0
--- /dev/null
+++ b/script/tools/safe_sshscp.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+# Author: xielaili
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+src=""
+des=""
+loginuser="root"
+loginpassword="kong"
+r_option=0
+timeout=120
+retry_cnt=3
+
+######################
+# 使用说明
+# Globals:
+# Arguments:
+# Returns:
+######################
+function usage()
+{
+ echo "Usage: sshscp.sh -s src -d destination [-p login_password] [-t ping_timeout] [-n ssh_retry_time] -r"
+ echo " r: scp directory"
+}
+
+
+while getopts "p:s:d:t:n:hr" OPTIONS
+do
+ case "${OPTIONS}" in
+ p) loginpassword="${OPTARG}";;
+ s) src="${OPTARG}";;
+ d) des="${OPTARG}";;
+ t) timeout="${OPTARG}";;
+ n) retry_cnt="${OPTARG}";;
+ r) r_option=1;;
+ h) usage; exit 1
+ ;;
+ \?) echo "ERROR - Invalid parameter"; echo "ERROR - Invalid parameter" >&2;usage;exit 1;;
+ *) echo "ERROR - Invalid parameter"; echo "ERROR - Invalid parameter" >&2; usage;exit 1;;
+ esac
+done
+
+
+if [ "x${src}" = "x" -o "x${des}" = "x" ];then
+ usage
+ exit 1
+fi
+
+if echo "${src}" | grep ':'; then
+ machineip=$(echo "${src}" | awk -F':' '{print $1}')
+elif echo "${des}" | grep ':'; then
+ machineip=$(echo "${des}" | awk -F':' '{print $1}')
+else
+ usage
+ exit 1
+fi
+
+for((i=0;i /dev/null
+ if [ $? -ne 0 ]; then
+ if [ "${sleeptime}" -ge "${timeout}" ]; then
+ echo "ERROR: ping ${RELEASE_SERVER_IP} Failed"
+ exit 1
+ else
+ sleep 15
+ ((sleeptime = "${sleeptime}" + 15))
+ fi
+ else
+ break
+ fi
+ done
+ else
+ break
+ fi
+done
diff --git a/script/tools/sshcmd.sh b/script/tools/sshcmd.sh
new file mode 100644
index 0000000000000000000000000000000000000000..0cf14c83d494065782ce1c0e085d59ad449bd28e
--- /dev/null
+++ b/script/tools/sshcmd.sh
@@ -0,0 +1,152 @@
+#!/bin/bash
+# Author: xielaili
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+execcmd=""
+machineip=""
+loginuser=root
+loginpassword=huawei
+
+
+######################
+# funcntion description: sshcmd cmd testmathineip [password] [user]
+# Globals:
+# Arguments:user:root password:default huawei
+# Returns:13: it means can not connect the mathine or password is wrong
+# 0: command execute successfully
+# others: command execute wrongly
+######################
+function sshcmd_comm()
+{
+ cmd="$1"
+ testip="$2"
+ password=${3}
+ echo ${password}
+ user=${4-root}
+ timeout=180
+
+ if [ "$1x" = "x" ]; then
+ echo "ssh_password cmd targetip [password] [user]"
+ return 1
+ fi
+
+ if [ "x${testip}" = "x" ]; then
+ testip="${testmachine}"
+ fi
+
+ cmd=${cmd//\"/\\\"}
+ cmd=${cmd//\$/\\\$}
+
+ if [ "x${testip}" = "x" -o "x${cmd}" = "x" ];then
+ echo "isup time testmathine [password] [user]"
+ exit 1
+ fi
+ expect <<-END1
+ ## set infinite timeout, because some commands maybe execute long time.
+ set timeout -1
+
+ ## remotly exectue command
+ spawn ssh -o "ConnectTimeout ${timeout}" -i ~/.ssh/super_publish_rsa "${user}@${testip}" "${cmd}"
+
+ expect {
+
+ #first connect, no public key in ~/.ssh/known_hosts
+
+ #"Are you sure you want to continue connecting (yes/no)?"
+ "*yes/no*" {
+
+ send "yes\r"
+
+ }
+ ## already has public key in ~/.ssh/known_hots
+ -re "\[P|p]assword:" {
+ send "${password}\r"
+ }
+
+ ## connect target mathine time out
+ timeout {
+ send_user "connection to ${targetip} timed out: \$expect_out(buffer)\n"
+ exit 13
+ }
+
+ ## Do not need input password. Becauese of ssh
+ eof {
+ catch wait result
+ #send_user [lindex \${result} 3]
+ exit [lindex \${result} 3]
+ }
+ }
+
+ ### We have input password,and the command may have been execute,except password is wrong or connctione is broken.
+ expect {
+ ## check exit status of the proccess of ssh
+ eof {
+ catch wait result
+ exit [lindex \${result} 3]
+ }
+
+ ## Password is wrong!
+ -re "\[P|p]assword:" {
+ send_user "invalid password or account. \$expect_out(buffer)\n"
+ exit 13
+ }
+
+ ## timeout again
+ timeout {
+ send_user "connection to ${targetip} timed out : \$expect_out(buffer)\n"
+ exit 13
+ }
+
+ }
+
+ END1
+
+ return $?
+}
+
+
+while getopts "c:m:p:u:h" OPTIONS
+do
+ case "${OPTIONS}" in
+ c) execcmd="${OPTARG}";;
+ m) machineip="${OPTARG}";;
+ u) loginuser="${OPTARG}";;
+ p) loginpassword="${OPTARG}";;
+ \?) echo "ERROR - Invalid parameter"; echo "ERROR - Invalid parameter" >&2;usage;exit 1;;
+ *) echo "ERROR - Invalid parameter"; echo "ERROR - Invalid parameter" >&2; usage;exit 1;;
+ esac
+done
+
+######################
+# delet known hosts
+# Globals:
+# Arguments:
+# Returns:
+######################
+function delete_known_hosts()
+{
+ [ ! -d /root/.ssh ] && mkdir -p /root/.ssh
+ known_hosts=/root/.ssh/known_hosts
+ > "${known_hosts}"
+}
+
+######################
+# display uasge
+# Globals:
+# Arguments:
+# Returns:
+######################
+function usage()
+{
+ echo "Usage: sshcmd.sh -c "command" -m "machinetip" [-u login_user] [-p login_password]"
+}
+
+if [ "x${execcmd}" = "x" -o "x${machineip}" = "x" ];then
+ usage
+ exit 1
+fi
+
+delete_known_hosts
+sshcmd_comm "${execcmd}" "${machineip}" "${loginpassword}" "${loginuser}"
+
+exit $?
diff --git a/script/tools/sshscp.sh b/script/tools/sshscp.sh
new file mode 100644
index 0000000000000000000000000000000000000000..5fd21068fb8891b1ddbc8ae36f8e673d7f65a99b
--- /dev/null
+++ b/script/tools/sshscp.sh
@@ -0,0 +1,161 @@
+#!/bin/bash
+# Author: yhon
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+exelocal=1
+
+######################
+# function descriptionsshcmd cmd testmathineip [password] [user]
+# Globals:
+# Arguments:user:root password:default huawei
+# Returns:13: it means can not connect the mathine or password is wrong
+# 0: command execute successfully
+# others: command execute wrongly
+######################
+function sshcmd_comm()
+{
+
+ srccommand="$1"
+ descommand="$2"
+ password=${3-huawei}
+ local r_option="$4"
+ timeout=180
+ if [ "$1x" = "x" ]; then
+ echo "ssh_password cmd targetip [password] [user]"
+ return 1
+ fi
+
+ if [ "x${srccommand}" = "x" -o "x${descommand}" = "x" ];then
+ echo "wrong "
+ exit 1
+ fi
+
+ if [ "${r_option}" = "1" ]; then
+ r_option="-r"
+ else
+ r_option=""
+ fi
+
+ expect <<-END1
+ ## set infinite timeout, because some commands maybe execute long time.
+ set timeout -1
+
+ ## remotly exectue command
+ spawn scp -i ~/.ssh/super_publish_rsa -o "ConnectTimeout ${timeout}" "${r_option}" "${srccommand}" "${descommand}"
+
+ expect {
+
+ #first connect, no public key in ~/.ssh/known_hosts
+
+ #"Are you sure you want to continue connecting (yes/no)?"
+ "*yes/no*" {
+
+ send "yes\r"
+
+ }
+
+ ## already has public key in ~/.ssh/known_hosts
+ -re "\[P|p]assword:" {
+
+ send "${password}\r"
+ }
+
+ ## connect target mathine time out
+ timeout {
+ send_user "connection to ${targetip} timed out: \$expect_out(buffer)\n"
+ exit 13
+ }
+
+ ## Do not need input password. Becauese of ssh
+ eof {
+ catch wait result
+ #send_user [lindex \${result} 3]
+ exit [lindex \${result} 3]
+ }
+ }
+
+ ### We have input password,and the command may have been execute,except password is wrong or connctione is broken.
+ expect {
+ ## check exit status of the proccess of ssh
+ eof {
+ catch wait result
+ exit [lindex \${result} 3]
+ }
+
+ ## Password is wrong!
+ -re "\[P|p]assword:" {
+ send_user "invalid password or account. \$expect_out(buffer)\n"
+ exit 13
+ }
+
+ ## timeout again
+ timeout {
+ send_user "connection to ${targetip} timed out : \$expect_out(buffer)\n"
+ exit 13
+ }
+
+ }
+
+ END1
+
+ return $?
+}
+
+
+######################
+# 清空/root/.ssh/known_hosts 文件
+# Globals:
+# Arguments:
+# Returns:
+######################
+function delete_known_hosts()
+{
+ [ ! -d /root/.ssh ] && mkdir -p /root/.ssh
+ known_hosts=/root/.ssh/known_hosts
+ > "${known_hosts}"
+}
+
+######################
+# 使用说明
+# Globals:
+# Arguments:
+# Returns:
+######################
+function usage()
+{
+ echo "Usage: sshscp.sh -s src -d destination [-p login_password] -r"
+ echo " r: scp directory"
+}
+
+
+src=""
+des=""
+loginuser="root"
+loginpassword="huawei"
+
+while getopts "p:s:d:hr" OPTIONS
+do
+ case "${OPTIONS}" in
+ p) loginpassword="${OPTARG}";;
+ s) src="${OPTARG}";;
+ d) des="${OPTARG}";;
+ r) r_option_value=1;;
+ h) usage; exit 1
+ ;;
+ \?) echo "ERROR - Invalid parameter"; echo "ERROR - Invalid parameter" >&2;usage;exit 1;;
+ *) echo "ERROR - Invalid parameter"; echo "ERROR - Invalid parameter" >&2; usage;exit 1;;
+ esac
+done
+
+
+if [ "x${src}" = "x" -o "x${des}" = "x" ];then
+ usage
+ exit 1
+fi
+
+delete_known_hosts
+for src_item in $(echo "${src}")
+ do
+ sshcmd_comm "${src_item}" "${des}" "${loginpassword}" "${r_option_value}"
+ done
+exit $?
diff --git a/script/tools/util.sh b/script/tools/util.sh
new file mode 100644
index 0000000000000000000000000000000000000000..ea57520b1fd7533889a950a203493ae9888fc65f
--- /dev/null
+++ b/script/tools/util.sh
@@ -0,0 +1,141 @@
+#!/bin/bash
+# Author: yhon
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+set -e
+
+######################
+# 输出info等级的日志
+# Globals:
+# Arguments:需要打印的信息
+# Returns:
+######################
+function log_info()
+{
+ echo "[INFO] $@"
+}
+
+######################
+# 输出warning等级的日志
+# Globals:
+# Arguments:需要打印的信息
+# Returns:
+######################
+function log_warn()
+{
+ echo "[WARNING] $@"
+}
+
+######################
+# 输出error等级的日志,并结束任务执行
+# Globals:
+# Arguments:需要打印的信息
+# Returns:
+######################
+function log_error()
+{
+ echo "[ERROR] $@"
+ exit 1
+}
+
+######################
+# 输出debug等级的日志
+# Globals:
+# Arguments:需要打印的信息
+# Returns:
+######################
+function log_debug()
+{
+ echo "[DEBUG] $@"
+}
+
+######################
+# 在指定机器上执行shell命令
+# Globals:
+# Arguments:cmd:执行命令,ip:远程机器id,user:远程机器用户,passwd:该用户密码
+# Returns:
+######################
+function sshcmd()
+{
+ sh "${BUILD_SCRIPT_DIR}/tools/safe_sshcmd.sh" -c "$1" -m "${RELEASE_SERVER_IP}" -u "${USER}" -p "${PASSWD}" -t 120 -n 3
+}
+
+######################
+# 拷贝本地东西到远程机器
+# Globals:
+# Arguments:
+# Returns:
+######################
+function sshscp()
+{
+ sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -p "${PASSWD}" -s "$1" -d "${RELEASE_SERVER_IP}:$2" -r -t 120 -n 3
+}
+
+######################
+# 从远程机器拷贝东西到本地
+# Globals:
+# Arguments:
+# Returns:
+######################
+function sshscp_from()
+{
+ sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -p "${PASSWD}" -s "${RELEASE_SERVER_IP}:$1" -d "$2" -r -t 120 -n 3
+}
+
+######################
+# 在指定arm机器上执行shell命令,用于制作交叉编译环境
+# Globals:
+# Arguments:cmd:执行命令,ip:远程机器id,user:远程机器用户,passwd:该用户密码
+# Returns:
+######################
+function sshcmd_arm()
+{
+ sh "${BUILD_SCRIPT_DIR}/tools/safe_sshcmd.sh" -c "$1" -m "${RELEASE_ROOT_PATH}" -u "${USER}" -p "${PASSWD}" -t 120 -n 3
+}
+
+######################
+# 拷贝本地东西到远程arm机器, 用于制作交叉编译环境
+# Globals:
+# Arguments:
+# Returns:
+######################
+function sshscp_arm()
+{
+ sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -p "${PASSWD}" -s "$1" -d "${RELEASE_SERVER_IP}:$2" -r -t 120 -n 3
+}
+
+######################
+# 从远程arm机器拷贝东西到本地, 用于制作交叉编译环境
+# Globals:
+# Arguments:
+# Returns:
+######################
+function sshscp_from_arm()
+{
+ sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -p "${PASSWD}" -s "${RELEASE_ROOT_PATH}:$1" -d "$2" -r -t 120 -n 3
+}
+######################
+# 安全运行相关命令
+# Globals:
+# Arguments:
+# Returns:
+######################
+function safe_run()
+{
+ if ! "$@"; then
+ log_error "$* failed; aborting!"
+ fi
+}
+
+######################
+# 生成文件的sha256值,并存放在相应的文件中
+# Globals:
+# Arguments:
+# Returns:
+######################
+function create_checksum()
+{
+ file="$1"
+ sha256sum "${file}" > "$file${SHA256SUM}"
+}
+
+
diff --git a/utils.py b/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..585aad8fb9108ff2cc015ed61dae2b534194dfa4
--- /dev/null
+++ b/utils.py
@@ -0,0 +1,249 @@
+#!/usr/bin/env python
+# -*- coding:utf8 -*-
+# build utils file
+# Author: tianfengping yhon
+# Copyright Huawei Technologies Co., Ltd. 2010-2018. All rights reserved.
+import os
+import sys
+import subprocess
+import signal
+import re
+
+PY3 = sys.version_info >= (3, 0)
+
+
+def trace_execute(cmd, cwd=None, env=None, logger=None):
+ """
+ # 执行shell命令
+ @param cmd: 执行命令
+ @param cwd: 执行命令对应目录
+ @param env: 执行命令环境变量
+ @param logger: 日志打印对象
+ @return: 0/非0
+ """
+ p = subprocess.Popen(cmd, cwd=cwd, shell=True, stdout=subprocess.PIPE, env=env)
+ return_code = p.poll()
+ while True:
+ next_line = p.stdout.readline().decode("utf-8", "ignore").strip()
+ if next_line == "" and return_code is not None:
+ break
+ return_code = p.poll()
+ if next_line != "" and re.findall(".*ignored\.$",next_line) == []:
+ if logger is not None:
+ logger.info(next_line)
+ else:
+ print(next_line)
+ return return_code
+
+
+def execute_shell_cmd_for_exitcode(cmd, cwd=None, log=None, timeout=-1, env=None):
+ """
+ # 执行shell命令
+ @param cmd: 执行命令
+ @param cwd: 执行命令对应目录
+ @param log: 命令执行日志文件
+ @param timeout: 执行命令超时时间(s), -1 -- 不超时
+ @param env: 执行命令环境变量
+ @return: 0/非0
+ """
+ exit_code, _, _ = execute_shell_cmd(cmd, cwd, log, timeout, env)
+ return exit_code
+
+
+def execute_shell_cmd_for_output(cmd, cwd=None, log=None, timeout=-1, env=None):
+ """
+ # 执行shell命令
+ @param cmd: 执行命令
+ @param cwd: 执行命令对应目录
+ @param log: 命令执行日志文件
+ @param timeout: 执行命令超时时间(s), -1 -- 不超时
+ @param env: 执行命令环境变量
+ @return: cmd标准输出内容
+ """
+ _, output, _ = execute_shell_cmd(cmd, cwd, log, timeout, env)
+ return output
+
+
+def execute_shell_cmd(cmd, cwd=None, log=None, timeout=-1, env=None):
+ """
+ Execute shell command
+ @param cmd: shell command
+ @param cwd: current work direction
+ @param log: file-like object
+ @param timeout: timeout in sec ( -1 --- no timeout)
+ @param env: environment variable dict
+ @return: (return_code, stdout_data, stderr_data)
+ """
+ if isinstance(log, int) or hasattr(log, "fileno"):
+ std_out, std_err = log, log
+ else:
+ std_out = subprocess.PIPE
+ std_err = subprocess.PIPE
+ return execute_cmd(cmd, cwd, shell=True, timeout=timeout, env=env, stderr=std_err, stdout=std_out)
+
+
+def execute_cmd(args, cwd=None, shell=False, timeout=-1,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=None):
+ """
+ Execute outer command with a timeout after which it will be forcibly killed.
+ @param args: 执行命令
+ @param cwd: 执行命令对应目录
+ @param shell: 是否为shell命令
+ @param timeout: 执行命令超时时间(s), -1 -- 不超时
+ @param stdout: 标准输出
+ @param stderr: 异常输出
+ @param env: 执行命令环境变量
+ @return: (return_code, stdout_data, stderr_data)
+ """
+
+ class Alarm(Exception):
+ pass
+
+ def alarm_handler(signum, frame):
+ """
+ alarm 信号处理
+ @param signum: 信号number
+ @param frame:
+ @return:
+ """
+ raise Alarm
+
+ p = subprocess.Popen(args, shell=shell, cwd=cwd,
+ stdin=subprocess.PIPE, stdout=stdout, stderr=stderr, env=env)
+ if timeout != -1:
+ signal.signal(signal.SIGALRM, alarm_handler)
+ signal.alarm(timeout)
+ try:
+ stdout_data, stderr_data = p.communicate()
+ if timeout != -1:
+ signal.alarm(0)
+ if PY3:
+ # python3. process.communicate returns bytes
+ stdout_data = str(stdout_data, "utf-8") # stdoutdata
+ stderr_data = str(stderr_data, "utf-8") # stderrdata
+ return_code = p.returncode
+ return return_code, stdout_data, stderr_data
+ except Alarm:
+ pids = [p.pid]
+ pids.extend(get_process_children(p.pid))
+ for pid in pids:
+ # process might have died before getting to this line
+ # so wrap to avoid OSError: no such process
+ try:
+ os.kill(pid, signal.SIGKILL)
+ except OSError:
+ pass
+ return -9, None, None
+
+
+def get_process_children(ppid):
+ """
+ # 获取一个进程所有子进程
+ @param ppid: 进程id
+ @return: 子进程list
+ """
+
+ def get_children(pid):
+ p = subprocess.Popen("ps --no-headers -o pid --ppid {0}".format(pid), shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, _ = p.communicate()
+ if not stdout.strip():
+ return
+ for p in stdout.split():
+ children_pids.append(int(p))
+ get_children(p)
+
+ children_pids = []
+ try:
+ import psutil
+ proc = psutil.Process(int(ppid))
+ for child in proc.children(recursive=True):
+ children_pids.append(child.pid)
+ children_pids.append(int(ppid))
+ except ImportError:
+ get_children(ppid)
+ except:
+ pass
+ return children_pids
+
+
+def cp(src, dst):
+ """
+ file copy
+ @param src: source dir/file
+ @param dst: destination dir/file
+ @return: True/False
+ """
+ if not src or not dst:
+ return False
+ stderr = sys.stderr
+ stdout = sys.stdout
+ p = subprocess.Popen("cp -rf {0} {1}".format(src, dst), shell=True, stderr=stderr, stdout=stdout)
+ rt = p.wait()
+ return rt == 0
+
+
+def makedir(path, force=False, logger=None):
+ """
+ create a directory
+ @param path: directory path
+ @param logger: var for logger
+ @param force: whether remove path if it exists, default false
+ """
+ if force and os.path.isdir(path):
+ rm(path)
+ if not os.path.isdir(path):
+ try:
+ os.makedirs(path)
+ except:
+ if logger is not None:
+ logger.exception("Fatal error in os.makedirs", exc_info=True)
+ else:
+ print("Fatal error in os.makedirs")
+
+
+def mv(src, dst):
+ """
+ mv command
+ @param src: 源文件
+ @param dst: 目的文件
+ """
+ # shutil.move(src, dst)
+ if not src or not dst:
+ return False
+ stderr = sys.stderr
+ stdout = sys.stdout
+ p = subprocess.Popen("mv -f '{0}' '{1}'".format(src, dst), shell=True, stderr=stderr, stdout=stdout)
+ rt = p.wait()
+ return rt == 0
+
+
+def rm(path, logger=None):
+ """os.unlink and shutil.rmtree replacement"""
+ stderr = sys.stderr
+ stdout = sys.stdout
+ if path == "" or path == "/":
+ if logger is not None:
+ logger.error("rm -rf path cannot be null or /")
+ else:
+ print("rm -rf path cannot be null or /")
+ exit(1)
+ p = subprocess.Popen("rm -rf {0}".format(path), shell=True, stderr=stderr, stdout=stdout)
+ rt = p.wait()
+ return rt == 0
+
+
+def is_exist_dir(dir_path):
+ """
+ @param dir_path: 文件夹目录
+ @return: True/False
+ """
+ return os.path.exists(dir_path)
+
+
+def is_exist_file(file_path):
+ """
+ @param file_path: 文件目录
+ @return: True/False
+ """
+ return os.path.isfile(file_path)