Sanity check contents of updated rpi-update

See: https://github.com/Hexxeh/rpi-update/issues/285
This commit is contained in:
popcornmix
2019-07-22 18:25:08 +01:00
parent d48253f83a
commit a0c5de1e32

View File

@@ -84,6 +84,12 @@ function update_self() {
exit 1 exit 1
fi fi
if [[ "$(head -1 ${_tempFileName})" != '#!/bin/bash' ]]; then
echo " !!! Failed to download update for rpi-update!"
echo " !!! Contents of file is not as expected - github may be down"
exit 1
fi
local OCTAL_MODE=$(stat -c '%a' "$0") local OCTAL_MODE=$(stat -c '%a' "$0")
if ! chmod ${OCTAL_MODE} "${_tempFileName}" ; then if ! chmod ${OCTAL_MODE} "${_tempFileName}" ; then
echo " !!! Failed: Error while trying to set mode on ${_tempFileName}" echo " !!! Failed: Error while trying to set mode on ${_tempFileName}"