Skip to content

Commit

Permalink
tree: more fixes
Browse files Browse the repository at this point in the history
Signed-off-by: AuxXxilium <[email protected]>
  • Loading branch information
AuxXxilium committed May 22, 2024
1 parent 2fc01c1 commit c2beb03
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 56 deletions.
56 changes: 56 additions & 0 deletions files/initrd/opt/arc/include/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -413,4 +413,60 @@ function extractDSMFiles() {
else
return 1
fi
}

###############################################################################
# Livepatch
function livepatch() {
FAIL=0
# Patch zImage
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}")"
if [ "${OFFLINE}" = "false" ]; then
# Looking for Update
if [ ${FAIL} -eq 1 ]; then
# Update Configs
updateConfigs
# Update Patches
updatePatches
# Patch zImage
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
fi
if [ ${FAIL} -eq 1 ]; then
echo
echo -e "Patching DSM Files failed! Please stay patient for Update." 0 0
sleep 5
exit 1
else
echo "DSM Image patched - Ready!"
fi
}
56 changes: 0 additions & 56 deletions files/initrd/opt/arc/include/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -344,60 +344,4 @@ function updateLKMs() {
) 2>&1 | dialog --backtitle "$(backtitle)" --title "Update LKMs" \
--progressbox "Updating LKMs..." 20 70
return 0
}

###############################################################################
# Livepatch
function livepatch() {
FAIL=0
# Patch zImage
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}")"
if [ "${OFFLINE}" = "false" ]; then
# Looking for Update
if [ ${FAIL} -eq 1 ]; then
# Update Configs
updateConfigs
# Update Patches
updatePatches
# Patch zImage
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
fi
if [ ${FAIL} -eq 1 ]; then
echo
echo -e "Patching DSM Files failed! Please stay patient for Update." 0 0
sleep 5
exit 1
else
echo "DSM Image patched - Ready!"
fi
}

0 comments on commit c2beb03

Please sign in to comment.