Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #498 from fbelavenuto/better-updater
Browse files Browse the repository at this point in the history
Improving the updater to support folders
  • Loading branch information
fbelavenuto authored Jan 12, 2023
2 parents b52afda + 269d3a3 commit 188ebcc
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 20 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-flat.zip" arpl.vmdk arpl-flat.vmdk
sha256sum update-list.yml > sha256sum
yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml | while read F; do
(cd `dirname ${F}` && sha256sum `basename ${F}`) >> sha256sum
done
yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml | xargs zip -9j "update.zip" sha256sum update-list.yml
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
zip -9j update.zip "${F}"
fi
done < <(yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml)
zip -9j update.zip sha256sum
# Upload artifact
- name: Upload
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0-beta11
1.0-beta11a
2 changes: 1 addition & 1 deletion files/board/arpl/overlayfs/opt/arpl/include/consts.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

ARPL_VERSION="1.0-beta11"
ARPL_VERSION="1.0-beta11a"

# Define paths
TMP_PATH="/tmp"
Expand Down
14 changes: 10 additions & 4 deletions files/board/arpl/overlayfs/opt/arpl/menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1026,14 +1026,20 @@ function updateMenu() {
dialog --backtitle "`backtitle`" --title "Update arpl" --aspect 18 \
--infobox "Installing new files" 0 0
# 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
[ -f "${F}" ] && rm -f "${F}"
[ -d "${F}" ] && rm -Rf "${F}"
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 \
--yesno "Arpl updated with success to ${TAG}!\nReboot?" 0 0
[ $? -ne 0 ] && continue
Expand Down
2 changes: 1 addition & 1 deletion files/board/arpl/p1/ARPL-VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0-beta11
1.0-beta11a
18 changes: 14 additions & 4 deletions img-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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-flat.zip" arpl.vmdk arpl-flat.vmdk
sha256sum update-list.yml > sha256sum
yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml | while read F; do
(cd `dirname ${F}` && sha256sum `basename ${F}`) >> sha256sum
done
yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml | xargs zip -9j "update.zip" sha256sum update-list.yml
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
zip -9j update.zip "${F}"
fi
done < <(yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml)
zip -9j update.zip sha256sum
rm -f sha256sum
6 changes: 2 additions & 4 deletions update-list.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
remove:
replace:
".buildroot/output/images/bzImage": "/mnt/p3/bzImage-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/grub/fonts/unicode.pf2": "/mnt/p1/grub/fonts/unicode.pf2"
remove:
"/mnt/p1/grub/locales"
"files/board/arpl/p1/grub/": "/mnt/p1/grub/"

0 comments on commit 188ebcc

Please sign in to comment.