More tests

This commit is contained in:
Fabio Belavenuto 2022-10-26 13:22:55 -03:00
parent c3551cff01
commit 04455518e2

View File

@ -889,35 +889,32 @@ function updateMenu() {
fi
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--infobox "Downloading last version ${TAG}" 0 0
# Download checksum
STATUS=`curl --insecure -s -w "%{http_code}" -L "https://github.com/fbelavenuto/arpl/releases/download/${TAG}/sha256sum" -o /tmp/sha256sum`
# Download update file
STATUS=`curl --insecure -s -w "%{http_code}" -L "https://github.com/fbelavenuto/arpl/releases/download/${TAG}/update-${TAG}.zip" -o /tmp/update.zip`
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--msgbox "Error downloading checksums" 0 0
--msgbox "Error downloading update file" 0 0
continue
fi
STATUS=`curl --insecure -s -w "%{http_code}" -L "https://github.com/fbelavenuto/arpl/releases/download/${TAG}/bzImage" -o /tmp/bzImage`
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
unzip /tmp/update.zip -d /tmp
if [ $? -ne 0 ]; then
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--msgbox "Error downloading bzImage" 0 0
--msgbox "Error extracting update file" 0 0
continue
fi
STATUS=`curl --insecure -s -w "%{http_code}" -L "https://github.com/fbelavenuto/arpl/releases/download/${TAG}/rootfs.cpio.xz" -o /tmp/rootfs.cpio.xz`
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--msgbox "Error downloading rootfs.cpio.xz" 0 0
continue
fi
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--infobox "Installing new files" 0 0
# Check checksums
(cd /tmp && sha256sum --status -c sha256sum)
if [ $? -ne 0 ]; then
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--msgbox "Checksum do not match!" 0 0
continue
fi
mv /tmp/bzImage "${ARPL_BZIMAGE_FILE}"
mv /tmp/rootfs.cpio.xz "${ARPL_RAMDISK_FILE}"
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--infobox "Installing new files" 0 0
# Process update-list.yml
while IFS="=" read KEY VALUE; do
mv /tmp/`basename "${KEY}"` "${VALUE}"
done < <(readConfigMap "replace" "/tmp/update-list.yml")
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--yesno "Arpl updated with success to ${TAG}!\nReboot?" 0 0
[ $? -ne 0 ] && continue