diff options
author | Alexei Sorokin <sor.alexei@meowr.ru> | 2022-11-29 23:00:51 +0300 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2022-11-29 20:26:35 +0000 |
commit | ec082429ab35a45d8a362703c26932206b5b1747 (patch) | |
tree | 185414f3151dcceef6c2442e2ebb1045a71f2a01 /resources/scripts | |
parent | 7c5334ca0e65d4e0df377b1e6e07b18e6dbe6af2 (diff) |
scripts: avoid relying on spaces from sha1sum output
Diffstat (limited to 'resources/scripts')
-rwxr-xr-x | resources/scripts/blobs/download | 2 | ||||
-rwxr-xr-x | resources/scripts/build/boot/roms_helper | 6 | ||||
-rwxr-xr-x | resources/scripts/download/mrc | 4 |
3 files changed, 5 insertions, 7 deletions
diff --git a/resources/scripts/blobs/download b/resources/scripts/blobs/download index e8e82448..d8933573 100755 --- a/resources/scripts/blobs/download +++ b/resources/scripts/blobs/download @@ -66,7 +66,7 @@ Extract_me(){ curl ${me_dl} > blobs/me.exe || curl ${me_dl_bkup} > blobs/me.exe - if [ ! "$(sha1sum blobs/me.exe)" = "${me_hash} blobs/me.exe" ]; then + if [ "$(sha1sum blobs/me.exe | awk '{print $1}')" != "${me_hash}" ]; then printf 'checksum of downloaded me did not mactch\ncorrupted me downloaded or wrong me for board\n' rm blobs/me.exe return 1 diff --git a/resources/scripts/build/boot/roms_helper b/resources/scripts/build/boot/roms_helper index 06820b43..40c0f394 100755 --- a/resources/scripts/build/boot/roms_helper +++ b/resources/scripts/build/boot/roms_helper @@ -230,10 +230,8 @@ rm -f "${romdir}"/* if [ "${payload_grub}" = "y" ] || [ "${payload_seabios_withgrub}" = "y" ]; then if [ -f "payload/grub/grub_usqwerty.cfg" ]; then - grubrefchecksum="$(sha1sum resources/grub/config/grub.cfg)" - grubrefchecksum="${grubrefchecksum% resources/grub/config/grub.cfg}" - grubbuildchecksum="$(sha1sum payload/grub/grub_usqwerty.cfg)" - grubbuildchecksum="${grubbuildchecksum% payload/grub/grub_usqwerty.cfg}" + grubrefchecksum="$(sha1sum resources/grub/config/grub.cfg | awk '{print $1}')" + grubbuildchecksum="$(sha1sum payload/grub/grub_usqwerty.cfg | awk '{print $1}')" if [ "${grubrefchecksum}" != "${grubbuildchecksum}" ]; then rm -Rf payload/grub/ printf "Changes detected to GRUB. Re-building now:\n" diff --git a/resources/scripts/download/mrc b/resources/scripts/download/mrc index e51da9e5..2b33ddb9 100755 --- a/resources/scripts/download/mrc +++ b/resources/scripts/download/mrc @@ -35,7 +35,7 @@ download_image() echo "Downloading recovery image" curl "$_url" > "$_file.zip" - if [ "$(sha1sum ${_file}.zip)" = "${_sha1sum} ${_file}.zip" ]; then + if [ "$(sha1sum ${_file}.zip | awk '{print $1}')" = "${_sha1sum}" ]; then unzip -q "${_file}.zip" rm "${_file}.zip" echo "Checksum verification passed for recovery image." @@ -95,7 +95,7 @@ check_existing() _mrc_complete_hash="d18de1e3d52c0815b82ea406ca07897c56c65696" if [ -f mrc/haswell/mrc.bin ]; then printf 'found existing mrc.bin, checking its hash\n' - if [ "$(sha1sum mrc/haswell/mrc.bin)" = "${_mrc_complete_hash} mrc/haswell/mrc.bin" ]; then + if [ "$(sha1sum mrc/haswell/mrc.bin | awk '{print $1}')" = "${_mrc_complete_hash}" ]; then printf 'checksums matched, skipping redownloading image\n' return 0 else |