From b7d3dba7d25423fcd886e4c2077ca25ee625e1a6 Mon Sep 17 00:00:00 2001 From: Andrew Scheller Date: Mon, 26 Aug 2013 20:10:27 +0100 Subject: [PATCH 1/2] Replace usages of $FW_PATH/.firmware_revision with a $FW_REVFILE variable --- rpi-update | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rpi-update b/rpi-update index 5825a1f..9a3ead9 100755 --- a/rpi-update +++ b/rpi-update @@ -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 From 6bab03cbc98e6ce9648b8c3d0d224de1b9b064c6 Mon Sep 17 00:00:00 2001 From: Andrew Scheller Date: Tue, 27 Aug 2013 02:02:24 +0100 Subject: [PATCH 2/2] Replace ${FW_REPOLOCAL}/${FW_REV}.tar.gz with $FW_TARBALL --- rpi-update | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rpi-update b/rpi-update index 9a3ead9..4da123e 100755 --- a/rpi-update +++ b/rpi-update @@ -159,9 +159,10 @@ function do_update { function download_rev { echo " *** Downloading specific firmware revision (this will take a few minutes)" mkdir -p "${FW_REPOLOCAL}" - wget "${REPO_URI}/tarball/${FW_REV}" -O "${FW_REPOLOCAL}/${FW_REV}.tar.gz" - tar xzf "${FW_REPOLOCAL}/${FW_REV}.tar.gz" -C "${FW_REPOLOCAL}" --strip-components=1 - rm "${FW_REPOLOCAL}/${FW_REV}.tar.gz" + FW_TARBALL="${FW_REPOLOCAL}/${FW_REV}.tar.gz" + wget "${REPO_URI}/tarball/${FW_REV}" -O "${FW_TARBALL}" + tar xzf "${FW_TARBALL}" -C "${FW_REPOLOCAL}" --strip-components=1 + rm "${FW_TARBALL}" } if [[ ${EUID} -ne 0 ]]; then