From 0b98c9b00c6b99940555cff25f7c6858745a560c Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 19 Oct 2023 23:36:56 +0100 Subject: minor code cleanup in shell scripts Signed-off-by: Leah Rowe --- include/git.sh | 3 +-- include/mrc.sh | 26 +++++++++++--------------- include/option.sh | 4 ++-- 3 files changed, 14 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/include/git.sh b/include/git.sh index 7f926c28..9e6c60db 100755 --- a/include/git.sh +++ b/include/git.sh @@ -4,8 +4,7 @@ # This file is only used by update/project/trees -eval "$(setvars "" _target rev _xm)" -eval "$(setvars "" loc url bkup_url depend)" +eval "$(setvars "" _target rev _xm loc url bkup_url depend)" tmp_git_dir="${PWD}/tmp/gitclone" fetch_project_trees() diff --git a/include/mrc.sh b/include/mrc.sh index 4ff067a9..3c6ac24e 100755 --- a/include/mrc.sh +++ b/include/mrc.sh @@ -4,7 +4,7 @@ # Modifications in this version are Copyright 2021 and 2023 Leah Rowe. # Original copyright detailed in repo: https://review.coreboot.org/coreboot/ -eval "$(setvars "" MRC_url MRC_url_bkup MRC_hash MRC_board)" +eval "$(setvars "" MRC_url MRC_url_bkup MRC_hash MRC_board ROOTFS SHELLBALL)" extract_mrc() { @@ -12,14 +12,14 @@ extract_mrc() [ -z "${CONFIG_MRC_FILE}" ] && \ err "extract_mrc $MRC_hash: CONFIG_MRC_FILE not set" - _file="${MRC_url##*/}" - _file="${_file%.zip}" + ROOTFS="root-a.ext2" + SHELLBALL="chromeos-firmwareupdate-${MRC_board}" ( x_ cd "${appdir}" - extract_partition ROOT-A "${_file}" root-a.ext2 - extract_shellball root-a.ext2 chromeos-firmwareupdate-${MRC_board} - extract_coreboot chromeos-firmwareupdate-${MRC_board} + extract_partition + extract_shellball + extract_coreboot ) x_ "${cbfstool}" "${appdir}/"coreboot-*.bin extract -n mrc.bin \ @@ -28,9 +28,9 @@ extract_mrc() extract_partition() { - NAME=${1} - FILE=${2} - ROOTFS=${3} + NAME="ROOT-A" + FILE="${MRC_url##*/}" + FILE="${FILE%.zip}" _bs=1024 printf "Extracting ROOT-A partition\n" @@ -46,9 +46,6 @@ extract_partition() extract_shellball() { - ROOTFS=${1} - SHELLBALL=${2} - printf "Extracting chromeos-firmwareupdate\n" printf "cd /usr/sbin\ndump chromeos-firmwareupdate ${SHELLBALL}\nquit" \ | debugfs "${ROOTFS}" || err "extract_shellball: debugfs" @@ -56,13 +53,12 @@ extract_shellball() extract_coreboot() { - _shellball=${1} _unpacked=$( mktemp -d ) printf "Extracting coreboot image\n" - [ -f "${_shellball}" ] || \ + [ -f "${SHELLBALL}" ] || \ err "extract_coreboot: shellball missing in google cros image" - x_ sh "${_shellball}" --unpack "${_unpacked}" + x_ sh "${SHELLBALL}" --unpack "${_unpacked}" # TODO: audit the f* out of that shellball, for each mrc version. # it has to be updated for each mrc update. we should ideally diff --git a/include/option.sh b/include/option.sh index 991ec0dc..73a567bb 100755 --- a/include/option.sh +++ b/include/option.sh @@ -17,11 +17,11 @@ eval "$(setvars "" CONFIG_BOARD_DELL_E6400 CONFIG_HAVE_MRC CONFIG_HAVE_ME_BIN \ CONFIG_INCLUDE_SMSC_SCH5545_EC_FW CONFIG_SMSC_SCH5545_EC_FW_FILE \ CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE _dest board boarddir)" -listitems() +items() { rval=1 [ ! -d "${1}" ] && \ - printf "listitems: directory '%s' doesn't exist" "${1}" && \ + printf "items: directory '%s' doesn't exist" "${1}" && \ return 1 for x in "${1}/"*; do # -e used because this is for files *or* directories -- cgit v1.2.1