
+check_iso_name() +{ + local skipped_iso_prefixes + case ${iso_os} in + "openeuler") +
skipped_iso_prefixes=( "openEuler-2.0-SP8" ) As long as one line, there is no need to wrap
ok.
+ ;; + *) return; ;; Does this approach look better?
good.
+ ;; + esac + + local prefix + for prefix in "${skipped_iso_prefixes[@]}" + do + [[ ${ISO_NAME} != ${prefix}* ]] ||
[[ ${ISO_NAME} = ${prefix}* ]] &&
In this way, process will exit 1 while ${ISO_NAME} != ${prefix}*. -------- Thanks Yu Chuan
Thanks sunyukui
+ exit_info "${iso_os} haven't release new iso for openEuler, no need to generate rootfs" + done +} + get_daily_iso_checksum() { ISO_URL="$(curl "${iso_url_file}")" @@ -63,8 +91,10 @@ get_daily_iso_checksum() local pub_ip=$(echo "${iso_url_file}" | grep -oEw "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}") ISO_URL="$(curl "${iso_url_file}" |sed -r "s/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/${pub_ip}/g")" } + ISO_NAME=$(basename "$ISO_URL") ISO_CHECKSUM_URL="${ISO_URL}.sha256sum" + check_iso_name
curl -o "${CHECKSUM_FILE_CACHE}.tmp" "${ISO_CHECKSUM_URL}" SHA256SUM_NET=$(awk '{print $1}' "${CHECKSUM_FILE_CACHE}.tmp") @@ -118,9 +148,8 @@ check_sha256sum_update()
if [ "$SHA256SUM_CACHE" == "$SHA256SUM_NET" ] then - log_info "${iso_os} haven't release new iso, no need to generate rootfs" rm -f "${CHECKSUM_FILE_CACHE}.tmp" - exit 0 + exit_info "${iso_os} haven't release new iso, no need to generate rootfs" else log_info "${iso_os} release a new iso, start to generate rootfs ..." return -- 2.23.0