Improving the updater to support folders

This commit is contained in:
Fabio Belavenuto 2023-01-12 19:42:15 -03:00
parent 86350062d2
commit aa6473e37e
7 changed files with 43 additions and 20 deletions

View File

@ -106,11 +106,20 @@ jobs:
zip -9 "arpl-${{ steps.build.outputs.VERSION }}.vmdk-dyn.zip" arpl-dyn.vmdk zip -9 "arpl-${{ steps.build.outputs.VERSION }}.vmdk-dyn.zip" arpl-dyn.vmdk
zip -9 "arpl-${{ steps.build.outputs.VERSION }}.vmdk-flat.zip" arpl.vmdk arpl-flat.vmdk zip -9 "arpl-${{ steps.build.outputs.VERSION }}.vmdk-flat.zip" arpl.vmdk arpl-flat.vmdk
sha256sum update-list.yml > sha256sum sha256sum update-list.yml > sha256sum
yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml | while read F; do zip -9j update.zip update-list.yml
while read F; do
if [ -d "${F}" ]; then
FTGZ="`basename "${F}"`.tgz"
tar czf "${FTGZ}" -C "${F}" .
sha256sum "${FTGZ}" >> sha256sum
zip -9j update.zip "${FTGZ}"
rm "${FTGZ}"
else
(cd `dirname ${F}` && sha256sum `basename ${F}`) >> sha256sum (cd `dirname ${F}` && sha256sum `basename ${F}`) >> sha256sum
done zip -9j update.zip "${F}"
yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml | xargs zip -9j "update.zip" sha256sum update-list.yml fi
done < <(yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml)
zip -9j update.zip sha256sum
# Upload artifact # Upload artifact
- name: Upload - name: Upload
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View File

@ -1 +1 @@
1.0-beta11 1.0-beta11a

View File

@ -1,5 +1,5 @@
ARPL_VERSION="1.0-beta11" ARPL_VERSION="1.0-beta11a"
# Define paths # Define paths
TMP_PATH="/tmp" TMP_PATH="/tmp"

View File

@ -1026,14 +1026,20 @@ function updateMenu() {
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \ dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--infobox "Installing new files" 0 0 --infobox "Installing new files" 0 0
# Process update-list.yml # Process update-list.yml
while IFS="=" read KEY VALUE; do
mkdir -p "`dirname "${VALUE}"`"
mv /tmp/`basename "${KEY}"` "${VALUE}"
done < <(readConfigMap "replace" "/tmp/update-list.yml")
while read F; do while read F; do
[ -f "${F}" ] && rm -f "${F}" [ -f "${F}" ] && rm -f "${F}"
[ -d "${F}" ] && rm -Rf "${F}" [ -d "${F}" ] && rm -Rf "${F}"
done < <(readConfigArray "remove" "/tmp/update-list.yml") done < <(readConfigArray "remove" "/tmp/update-list.yml")
while IFS="=" read KEY VALUE; do
if [ "${KEY: -1}" = "/" ]; then
rm -Rf "${VALUE}"
mkdir -p "${VALUE}"
gzip -dc "/tmp/`basename "${KEY}"`.tgz" | tar xf - -C "${VALUE}"
else
mkdir -p "`dirname "${VALUE}"`"
mv "/tmp/`basename "${KEY}"`" "${VALUE}"
fi
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

View File

@ -1 +1 @@
1.0-beta11 1.0-beta11a

View File

@ -89,8 +89,18 @@ zip -9 "arpl-${VERSION}.img.zip" arpl.img
zip -9 "arpl-${VERSION}.vmdk-dyn.zip" arpl-dyn.vmdk zip -9 "arpl-${VERSION}.vmdk-dyn.zip" arpl-dyn.vmdk
zip -9 "arpl-${VERSION}.vmdk-flat.zip" arpl.vmdk arpl-flat.vmdk zip -9 "arpl-${VERSION}.vmdk-flat.zip" arpl.vmdk arpl-flat.vmdk
sha256sum update-list.yml > sha256sum sha256sum update-list.yml > sha256sum
yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml | while read F; do zip -9j update.zip update-list.yml
while read F; do
if [ -d "${F}" ]; then
FTGZ="`basename "${F}"`.tgz"
tar czf "${FTGZ}" -C "${F}" .
sha256sum "${FTGZ}" >> sha256sum
zip -9j update.zip "${FTGZ}"
rm "${FTGZ}"
else
(cd `dirname ${F}` && sha256sum `basename ${F}`) >> sha256sum (cd `dirname ${F}` && sha256sum `basename ${F}`) >> sha256sum
done zip -9j update.zip "${F}"
yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml | xargs zip -9j "update.zip" sha256sum update-list.yml fi
done < <(yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml)
zip -9j update.zip sha256sum
rm -f sha256sum rm -f sha256sum

View File

@ -1,8 +1,6 @@
remove:
replace: replace:
".buildroot/output/images/bzImage": "/mnt/p3/bzImage-arpl" ".buildroot/output/images/bzImage": "/mnt/p3/bzImage-arpl"
".buildroot/output/images/rootfs.cpio.xz": "/mnt/p3/initrd-arpl" ".buildroot/output/images/rootfs.cpio.xz": "/mnt/p3/initrd-arpl"
"files/board/arpl/p1/grub/grub.cfg": "/mnt/p1/grub/grub.cfg"
"files/board/arpl/p1/ARPL-VERSION" : "/mnt/p1/ARPL-VERSION" "files/board/arpl/p1/ARPL-VERSION" : "/mnt/p1/ARPL-VERSION"
"files/board/arpl/p1/grub/fonts/unicode.pf2": "/mnt/p1/grub/fonts/unicode.pf2" "files/board/arpl/p1/grub/": "/mnt/p1/grub/"
remove:
"/mnt/p1/grub/locales"