Skip to main content
Added example script to extract required information.
Source Link
epposan
  • 139
  • 6

There is a /boot/.firmware_revision file created by the installation process.

The following bash script (extracted from Hexxeh's actual rpi-update script) could be used to extract the required info:

#!/bin/bash

set -o nounset
set -o errexit

REPO_URI=${REPO_URI:-"https://github.com/Hexxeh/rpi-firmware"}

BRANCH=${BRANCH:-"master"}
ROOT_PATH=${ROOT_PATH:-"/"}
BOOT_PATH=${BOOT_PATH:-"/boot"}
FW_PATH="${BOOT_PATH}"
FW_REV=${1:-""}
FW_REVFILE="${FW_PATH}/.firmware_revision"

# ask github for latest version hash
REPO_API=${REPO_URI/github.com/api.github.com\/repos}/git/refs/heads/${BRANCH}
FW_REV=$(curl -Ls ${REPO_API} | awk '{ if ($1 == "\"sha\":") { print substr($2, 2, 40) } }')
if [[ "${FW_REV}" == "" ]]; then
        echo " *** No hash received from github: ${REPO_API}"
        # run again with errors not suppressed
        curl -L ${REPO_API}
        exit 1
else
        echo "latest version: $FW_REV"
fi

# display local version hash
if [ -f "$FW_REVFILE" ]; then
        LOCAL_HASH=$(cat "$FW_REVFILE")
        echo " local version: $LOCAL_HASH"
else
        LOCAL_HASH=0
        echo " local version: unkown"
fi

There is a /boot/.firmware_revision file created by the installation process.

There is a /boot/.firmware_revision file created by the installation process.

The following bash script (extracted from Hexxeh's actual rpi-update script) could be used to extract the required info:

#!/bin/bash

set -o nounset
set -o errexit

REPO_URI=${REPO_URI:-"https://github.com/Hexxeh/rpi-firmware"}

BRANCH=${BRANCH:-"master"}
ROOT_PATH=${ROOT_PATH:-"/"}
BOOT_PATH=${BOOT_PATH:-"/boot"}
FW_PATH="${BOOT_PATH}"
FW_REV=${1:-""}
FW_REVFILE="${FW_PATH}/.firmware_revision"

# ask github for latest version hash
REPO_API=${REPO_URI/github.com/api.github.com\/repos}/git/refs/heads/${BRANCH}
FW_REV=$(curl -Ls ${REPO_API} | awk '{ if ($1 == "\"sha\":") { print substr($2, 2, 40) } }')
if [[ "${FW_REV}" == "" ]]; then
        echo " *** No hash received from github: ${REPO_API}"
        # run again with errors not suppressed
        curl -L ${REPO_API}
        exit 1
else
        echo "latest version: $FW_REV"
fi

# display local version hash
if [ -f "$FW_REVFILE" ]; then
        LOCAL_HASH=$(cat "$FW_REVFILE")
        echo " local version: $LOCAL_HASH"
else
        LOCAL_HASH=0
        echo " local version: unkown"
fi
Source Link
epposan
  • 139
  • 6

There is a /boot/.firmware_revision file created by the installation process.