From d51add1678f3272b55b450e67af8912c0b216569 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Wed, 22 May 2024 20:40:37 +0200 Subject: [PATCH] functions: cleanup code Signed-off-by: AuxXxilium --- files/initrd/opt/arc/include/functions.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/files/initrd/opt/arc/include/functions.sh b/files/initrd/opt/arc/include/functions.sh index 180b8af70..ee196057b 100755 --- a/files/initrd/opt/arc/include/functions.sh +++ b/files/initrd/opt/arc/include/functions.sh @@ -423,16 +423,12 @@ function livepatch() { if ! ${ARC_PATH}/zimage-patch.sh; then FAIL=1 else - ZIMAGE_HASH_CUR="$(sha256sum "${ORI_ZIMAGE_FILE}" | awk '{print $1}')" - writeConfigKey "zimage-hash" "${ZIMAGE_HASH_CUR}" "${USER_CONFIG_FILE}" FAIL=0 fi # Patch Ramdisk if ! ${ARC_PATH}/ramdisk-patch.sh; then FAIL=1 else - RAMDISK_HASH_CUR="$(sha256sum "${ORI_RDGZ_FILE}" | awk '{print $1}')" - writeConfigKey "ramdisk-hash" "${RAMDISK_HASH_CUR}" "${USER_CONFIG_FILE}" FAIL=0 fi OFFLINE="$(readConfigKey "arc.offline" "${USER_CONFIG_FILE}")" @@ -447,16 +443,12 @@ function livepatch() { if ! ${ARC_PATH}/zimage-patch.sh; then FAIL=1 else - ZIMAGE_HASH_CUR="$(sha256sum "${ORI_ZIMAGE_FILE}" | awk '{print $1}')" - writeConfigKey "zimage-hash" "${ZIMAGE_HASH_CUR}" "${USER_CONFIG_FILE}" FAIL=0 fi # Patch Ramdisk if ! ${ARC_PATH}/ramdisk-patch.sh; then FAIL=1 else - RAMDISK_HASH_CUR="$(sha256sum "${ORI_RDGZ_FILE}" | awk '{print $1}')" - writeConfigKey "ramdisk-hash" "${RAMDISK_HASH_CUR}" "${USER_CONFIG_FILE}" FAIL=0 fi fi @@ -467,6 +459,10 @@ function livepatch() { sleep 5 exit 1 else + ZIMAGE_HASH_CUR="$(sha256sum "${ORI_ZIMAGE_FILE}" | awk '{print $1}')" + writeConfigKey "zimage-hash" "${ZIMAGE_HASH_CUR}" "${USER_CONFIG_FILE}" + RAMDISK_HASH_CUR="$(sha256sum "${ORI_RDGZ_FILE}" | awk '{print $1}')" + writeConfigKey "ramdisk-hash" "${RAMDISK_HASH_CUR}" "${USER_CONFIG_FILE}" echo "DSM Image patched - Ready!" fi } \ No newline at end of file