mirror of
https://github.com/raspberrypi/rpi-eeprom.git
synced 2026-01-20 21:13:36 +08:00
rpi-eeprom-update: Move .bin filter for checksums into subshell
Move all package checksum related operations to the subshell and check the old rpi-eeprom-images packages if rpi-eeprom contains no .bin files. The rpi-eeprom-config --edit and --apply option passes the -i flag so checksums should have been skipped anyway.
This commit is contained in:
@@ -192,20 +192,26 @@ applyRecoveryUpdate()
|
||||
}
|
||||
|
||||
applyUpdate() {
|
||||
package_checksums_file="/var/lib/dpkg/info/rpi-eeprom.md5sums"
|
||||
CHECKSUMS=$(mktemp)
|
||||
cat "${package_checksums_file}" | grep -E '\.bin$' > "${CHECKSUMS}"
|
||||
|
||||
[ "$(id -u)" = "0" ] || die "* Must be run as root - try 'sudo rpi-eeprom-update'"
|
||||
|
||||
if [ "${IGNORE_DPKG_CHECKSUMS}" = 0 ] && [ -f "${CHECKSUMS}" ]; then
|
||||
if [ "${IGNORE_DPKG_CHECKSUMS}" = 0 ]; then
|
||||
(
|
||||
package_info_dir="/var/lib/dpkg/info/"
|
||||
package_checksums_file="${package_info_dir}/rpi-eeprom.md5sums"
|
||||
|
||||
if ! grep -qE '\.bin$' "${package_info_dir}/rpi-eeprom.md5sums"; then
|
||||
# Try the old rpi-eeprom-images package
|
||||
package_checksums_file="${package_info_dir}/rpi-eeprom-images.md5sums"
|
||||
fi
|
||||
|
||||
CHECKSUMS=$(mktemp)
|
||||
cat "${package_checksums_file}" | grep -E '\.bin$' > "${CHECKSUMS}"
|
||||
cd /
|
||||
if ! md5sum -c "${CHECKSUMS}" > /dev/null 2>&1; then
|
||||
md5sum -c "${CHECKSUMS}"
|
||||
die "rpi-eeprom checksums failed - try reinstalling this package"
|
||||
fi
|
||||
)
|
||||
) || die "Unable to validate EEPROM image package checksums"
|
||||
fi
|
||||
|
||||
if [ "${USE_FLASHROM}" = 0 ]; then
|
||||
|
||||
Reference in New Issue
Block a user