Replace usages of $FW_PATH/.firmware_revision with a $FW_REVFILE variable

This commit is contained in:
Andrew Scheller
2013-08-26 20:10:27 +01:00
parent 1b9a011e7d
commit b7d3dba7d2

View File

@@ -24,6 +24,7 @@ FW_REPOLOCAL="${ROOT_PATH}/root/.rpi-firmware"
FW_PATH="${BOOT_PATH}"
FW_MODPATH="${ROOT_PATH}/lib/modules"
FW_REV=${1:-""}
FW_REVFILE="${FW_PATH}/.firmware_revision"
GITCMD="git --git-dir=\"${FW_REPOLOCAL}/.git\" --work-tree=\"${FW_REPOLOCAL}\""
[ "${RPI_UPDATE_UNSUPPORTED}" -ne 0 ] && echo -e "You appear to be trying to update firmware on an incompatible distribution. To force update, run the following:\nsudo -E RPI_UPDATE_UNSUPPORTED=0 ./rpi-update" && exit 1
@@ -107,9 +108,9 @@ function finalise {
ldconfig -r "${ROOT_PATH}"
if [[ ${FW_REV} == "" ]]; then
echo " *** Storing current firmware revision"
eval ${GITCMD} rev-parse ${BRANCH} > "${FW_PATH}/.firmware_revision"
eval ${GITCMD} rev-parse ${BRANCH} > "${FW_REVFILE}"
else
echo ${FW_REV} > "${FW_PATH}/.firmware_revision"
echo ${FW_REV} > "${FW_REVFILE}"
fi
echo " *** Syncing changes to disk"
sync
@@ -205,7 +206,7 @@ if [[ ${FW_REV} != "" ]]; then
elif [[ -f "${FW_REPOLOCAL}/.git/config" ]]; then
# ask git server version before spending time cloning
GITREV=$(git ls-remote -h ${REPO_URI} refs/heads/${BRANCH} | awk '{print $1}')
if [[ -f "${FW_PATH}/.firmware_revision" ]] && [[ $(cat "${FW_PATH}/.firmware_revision") == "$GITREV" ]]; then
if [[ -f "${FW_REVFILE}" ]] && [[ $(cat "${FW_REVFILE}") == "$GITREV" ]]; then
echo " *** Your firmware is already up to date"
# no changes made, nothing to finalise
# finalise