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 fi
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \ dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--infobox "Downloading last version ${TAG}" 0 0 --infobox "Downloading last version ${TAG}" 0 0
# Download checksum # Download update file
STATUS=`curl --insecure -s -w "%{http_code}" -L "https://github.com/fbelavenuto/arpl/releases/download/${TAG}/sha256sum" -o /tmp/sha256sum` 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 if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \ dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--msgbox "Error downloading checksums" 0 0 --msgbox "Error downloading update file" 0 0
continue continue
fi fi
STATUS=`curl --insecure -s -w "%{http_code}" -L "https://github.com/fbelavenuto/arpl/releases/download/${TAG}/bzImage" -o /tmp/bzImage` unzip /tmp/update.zip -d /tmp
if [ $? -ne 0 -o ${STATUS} -ne 200 ]; then if [ $? -ne 0 ]; then
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \ dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--msgbox "Error downloading bzImage" 0 0 --msgbox "Error extracting update file" 0 0
continue continue
fi 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` # Check checksums
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
(cd /tmp && sha256sum --status -c sha256sum) (cd /tmp && sha256sum --status -c sha256sum)
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \ dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--msgbox "Checksum do not match!" 0 0 --msgbox "Checksum do not match!" 0 0
continue continue
fi fi
mv /tmp/bzImage "${ARPL_BZIMAGE_FILE}" dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
mv /tmp/rootfs.cpio.xz "${ARPL_RAMDISK_FILE}" --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 \ dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--yesno "Arpl updated with success to ${TAG}!\nReboot?" 0 0 --yesno "Arpl updated with success to ${TAG}!\nReboot?" 0 0
[ $? -ne 0 ] && continue [ $? -ne 0 ] && continue