From 258dec4263376a66d142aca420d7a13b4dd6a006 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Thu, 6 Nov 2025 14:04:40 +0800 Subject: [PATCH] Fix update.sh Dockerfile status reporting Compare each generated Dockerfile with its existing copy before replacing it, so the script only announces an update when the content actually changes. Otherwise keep the original file and print an 'already up to date' message to eliminate false positives. --- update.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/update.sh b/update.sh index c30b6b3088..bdd27ea96e 100755 --- a/update.sh +++ b/update.sh @@ -165,21 +165,21 @@ function update_node_version() { sed -Ei -e "s/(debian:)name-slim/\\1${variant}/" "${dockerfile}-tmp" fi - if diff -q "${dockerfile}-tmp" "${dockerfile}" > /dev/null; then - echo "${dockerfile} is already up to date!" - else - if [ "${SKIP}" != true ]; then - sed -Ei -e 's/^(ENV YARN_VERSION)=.*/\1='"${yarnVersion}"'/' "${dockerfile}-tmp" - fi - echo "${dockerfile} updated!" + if [ "${SKIP}" != true ]; then + sed -Ei -e 's/^(ENV YARN_VERSION)=.*/\1='"${yarnVersion}"'/' "${dockerfile}-tmp" fi # Required for POSIX sed if [ -f "${dockerfile}-tmp-e" ]; then rm "${dockerfile}-tmp-e" fi - - mv -f "${dockerfile}-tmp" "${dockerfile}" + if cmp -s "${dockerfile}-tmp" "${dockerfile}"; then + rm -f "${dockerfile}-tmp" + info "${dockerfile} already up to date." + else + mv -f "${dockerfile}-tmp" "${dockerfile}" + info "${dockerfile} updated." + fi ) }