mirror of
https://github.com/raspberrypi/rpi-update.git
synced 2026-01-20 21:13:38 +08:00
Ensure all string variables are fully quoted
This commit is contained in:
31
rpi-update
31
rpi-update
@@ -25,7 +25,7 @@ FW_PATH="${BOOT_PATH}"
|
|||||||
FW_MODPATH="${ROOT_PATH}/lib/modules"
|
FW_MODPATH="${ROOT_PATH}/lib/modules"
|
||||||
FW_REV=${1:-""}
|
FW_REV=${1:-""}
|
||||||
FW_REVFILE="${FW_PATH}/.firmware_revision"
|
FW_REVFILE="${FW_PATH}/.firmware_revision"
|
||||||
[ "${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
|
[ "${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
|
||||||
|
|
||||||
function update_self() {
|
function update_self() {
|
||||||
echo " *** Performing self-update"
|
echo " *** Performing self-update"
|
||||||
@@ -61,8 +61,9 @@ function update_modules {
|
|||||||
echo " *** Updating kernel modules"
|
echo " *** Updating kernel modules"
|
||||||
cp -vR "${FW_REPOLOCAL}/modules/"* "${FW_MODPATH}/"
|
cp -vR "${FW_REPOLOCAL}/modules/"* "${FW_MODPATH}/"
|
||||||
find "${FW_REPOLOCAL}/modules" -mindepth 1 -maxdepth 1 -type d | while read DIR; do
|
find "${FW_REPOLOCAL}/modules" -mindepth 1 -maxdepth 1 -type d | while read DIR; do
|
||||||
echo " *** depmod $(basename "${DIR}")"
|
BASEDIR=$(basename "${DIR}")
|
||||||
depmod -b "${ROOT_PATH}" -a $(basename "${DIR}")
|
echo " *** depmod ${BASEDIR}"
|
||||||
|
depmod -b "${ROOT_PATH}" -a "${BASEDIR}"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo " *** As requested, not updating kernel modules"
|
echo " *** As requested, not updating kernel modules"
|
||||||
@@ -85,11 +86,11 @@ function update_sdk {
|
|||||||
|
|
||||||
function update_firmware {
|
function update_firmware {
|
||||||
echo " *** Updating firmware"
|
echo " *** Updating firmware"
|
||||||
rm -rf ${FW_PATH}/*.elf
|
rm -rf "${FW_PATH}/"*.elf
|
||||||
rm -rf ${FW_PATH}/*.bin
|
rm -rf "${FW_PATH}/"*.bin
|
||||||
cp -v ${FW_REPOLOCAL}/*.elf "${FW_PATH}/"
|
cp -v "${FW_REPOLOCAL}/"*.elf "${FW_PATH}/"
|
||||||
cp -v ${FW_REPOLOCAL}/*.bin "${FW_PATH}/"
|
cp -v "${FW_REPOLOCAL}/"*.bin "${FW_PATH}/"
|
||||||
cp -v ${FW_REPOLOCAL}/*.dat "${FW_PATH}/"
|
cp -v "${FW_REPOLOCAL}/"*.dat "${FW_PATH}/"
|
||||||
if [[ ${SKIP_KERNEL} -eq 0 ]]; then
|
if [[ ${SKIP_KERNEL} -eq 0 ]]; then
|
||||||
cp -v "${FW_REPOLOCAL}/"*.img "${FW_PATH}/"
|
cp -v "${FW_REPOLOCAL}/"*.img "${FW_PATH}/"
|
||||||
else
|
else
|
||||||
@@ -104,11 +105,11 @@ function finalise {
|
|||||||
fi
|
fi
|
||||||
echo " *** Running ldconfig"
|
echo " *** Running ldconfig"
|
||||||
ldconfig -r "${ROOT_PATH}"
|
ldconfig -r "${ROOT_PATH}"
|
||||||
if [[ ${FW_REV} == "" ]]; then
|
if [[ "${FW_REV}" == "" ]]; then
|
||||||
echo " *** Storing current firmware revision"
|
echo " *** Storing current firmware revision"
|
||||||
git --git-dir="${FW_REPOLOCAL}/.git" rev-parse ${BRANCH} > "${FW_REVFILE}"
|
git --git-dir="${FW_REPOLOCAL}/.git" rev-parse "${BRANCH}" > "${FW_REVFILE}"
|
||||||
else
|
else
|
||||||
echo ${FW_REV} > "${FW_REVFILE}"
|
echo "${FW_REV}" > "${FW_REVFILE}"
|
||||||
fi
|
fi
|
||||||
echo " *** Syncing changes to disk"
|
echo " *** Syncing changes to disk"
|
||||||
sync
|
sync
|
||||||
@@ -118,7 +119,7 @@ function download_repo {
|
|||||||
echo " *** Setting up firmware (this may take a few minutes)"
|
echo " *** Setting up firmware (this may take a few minutes)"
|
||||||
mkdir -p "${FW_REPOLOCAL}"
|
mkdir -p "${FW_REPOLOCAL}"
|
||||||
set +e
|
set +e
|
||||||
git clone "${FW_REPO}" "${FW_REPOLOCAL}" --depth=1 --branch ${BRANCH}
|
git clone "${FW_REPO}" "${FW_REPOLOCAL}" --depth=1 --branch "${BRANCH}"
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
set -e
|
set -e
|
||||||
if [[ ${RETVAL} -ne 0 ]]; then
|
if [[ ${RETVAL} -ne 0 ]]; then
|
||||||
@@ -129,7 +130,7 @@ function download_repo {
|
|||||||
|
|
||||||
function update_repo {
|
function update_repo {
|
||||||
# updating a depth=1 git tree doesn't work, so just kill it and clone a new one
|
# updating a depth=1 git tree doesn't work, so just kill it and clone a new one
|
||||||
rm -rf ${FW_REPOLOCAL}
|
rm -rf "${FW_REPOLOCAL}"
|
||||||
download_repo
|
download_repo
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,12 +201,12 @@ command -v readelf >/dev/null 2>&1 || {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo " *** ARM/GPU split is now defined in /boot/config.txt using the gpu_mem option!"
|
echo " *** ARM/GPU split is now defined in /boot/config.txt using the gpu_mem option!"
|
||||||
if [[ ${FW_REV} != "" ]]; then
|
if [[ "${FW_REV}" != "" ]]; then
|
||||||
download_rev
|
download_rev
|
||||||
do_update "updated to revision ${FW_REV}"
|
do_update "updated to revision ${FW_REV}"
|
||||||
elif [[ -f "${FW_REPOLOCAL}/bootcode.bin" ]]; then
|
elif [[ -f "${FW_REPOLOCAL}/bootcode.bin" ]]; then
|
||||||
# ask git server version before spending time cloning
|
# ask git server version before spending time cloning
|
||||||
GITREV=$(git ls-remote -h ${REPO_URI} refs/heads/${BRANCH} | awk '{print $1}')
|
GITREV=$(git ls-remote -h "${REPO_URI}" "refs/heads/${BRANCH}" | awk '{print $1}')
|
||||||
if [[ -f "${FW_REVFILE}" ]] && [[ $(cat "${FW_REVFILE}") == "$GITREV" ]]; then
|
if [[ -f "${FW_REVFILE}" ]] && [[ $(cat "${FW_REVFILE}") == "$GITREV" ]]; then
|
||||||
echo " *** Your firmware is already up to date"
|
echo " *** Your firmware is already up to date"
|
||||||
# no changes made, nothing to finalise
|
# no changes made, nothing to finalise
|
||||||
|
|||||||
Reference in New Issue
Block a user