summaryrefslogtreecommitdiff
path: root/script/update
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-10-03 12:59:35 +0100
committerLeah Rowe <leah@libreboot.org>2023-10-03 12:59:49 +0100
commit5de8eda21c61fd7e1cf6b7e4ec6c9d98dae3e365 (patch)
treeaa0099feff1f80fece4ce4efe16caa74ef905097 /script/update
parent334aa1f7c985e86bd6f0302dbf404927cbb8a19e (diff)
general code cleanup in shell scripts
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'script/update')
-rwxr-xr-xscript/update/blobs/download2
-rwxr-xr-xscript/update/blobs/inject17
-rwxr-xr-xscript/update/project/trees24
3 files changed, 14 insertions, 29 deletions
diff --git a/script/update/blobs/download b/script/update/blobs/download
index f1cab1b8..fef6b2c6 100755
--- a/script/update/blobs/download
+++ b/script/update/blobs/download
@@ -147,7 +147,7 @@ extract_e6400vga()
[ -f "${E6400_VGA_romname}" ] || \
err "extract_e6400vga: can't extract vga rom from bios.bin"
)
- x_ cp "${appdir}"/"${E6400_VGA_romname}" "${_dest}"
+ x_ cp "${appdir}/${E6400_VGA_romname}" "${_dest}"
}
extract_sch5545ec()
diff --git a/script/update/blobs/inject b/script/update/blobs/inject
index 99eb9d5b..96ee0002 100755
--- a/script/update/blobs/inject
+++ b/script/update/blobs/inject
@@ -96,13 +96,10 @@ build_dependencies()
inject_blobs()
{
release_archive="n"
- if [ "${release}" = "true" ]; then
- printf "patching release file\n"
- release_archive="y"
- patch_release_roms
- else
- x_ patch_rom "${rom}"
- fi
+ [ "${release}" != "true" ] && x_ patch_rom "${rom}" && return 0
+ printf "patching release file\n"
+ release_archive="y"
+ patch_release_roms
}
patch_release_roms()
@@ -240,11 +237,9 @@ inject_blob_hp_kbc1126_ec()
if [ "${_ec1_offset}" = "" ] || [ "${_ec1_offset}" = "" ]; then
err "inject_blob_hp_kbc1126_ec: ${board}: offset not declared"
- fi
- if [ "${_ec1_location}" = "" ] || [ "${_ec2_location}" = "" ]; then
+ elif [ "${_ec1_location}" = "" ] || [ "${_ec2_location}" = "" ]; then
err "inject_blob_hp_kbc1126_ec: ${board}: EC path not declared"
- fi
- if [ ! -f "${_ec1_location}" ] || [ ! -f "${_ec2_location}" ]; then
+ elif [ ! -f "${_ec1_location}" ] || [ ! -f "${_ec2_location}" ]; then
err "inject_blob_hp_kbc1126_ec: ${board}: ecfw not downloaded"
fi
diff --git a/script/update/project/trees b/script/update/project/trees
index 093d5086..b61aab22 100755
--- a/script/update/project/trees
+++ b/script/update/project/trees
@@ -18,10 +18,9 @@ main()
printf "Downloading %s and applying patches\n" ${project}
[ -z "${1}" ] && err "project name not specified"
- project="${1}"
+ project="${1}" && shift 1
cfgsdir="config/${project}"
[ -d "${cfgsdir}" ] || err "unsupported project name"
- shift 1
targets=$(listitems "${cfgsdir}")
[ $# -gt 0 ] && targets=$@
@@ -39,21 +38,16 @@ download_for_target()
tree="undefined"
rev="undefined"
- fetch_config "${_target}"
+ fetch_config
+ [ -d "${project}/${tree}" ] && printf "download/%s %s (%s): exists\n" \
+ "${project}" "${tree}" "${_target}" 1>&2 && return 0
- if [ -d "${project}/${tree}" ]; then
- printf "REMARK: download/%s %s (%s): exists. Skipping.\n" \
- "${project}" "${tree}" "${_target}" 1>&2
- else
- fetch_from_upstream
- prepare_new_tree
- fi
+ fetch_from_upstream
+ prepare_new_tree
}
fetch_config()
{
- _target=${1}
-
while true; do
eval "$(setvars "" rev tree)"
_xm="fetch_config ${project}/${_target}"
@@ -64,10 +58,7 @@ fetch_config()
. "${cfgsdir}/${_target}/target.cfg" || \
err "fetch_config: no \"${cfgsdir}/${_target}/target.cfg\""
- if [ "${_target}" != "${tree}" ]; then
- _target="${tree}"
- continue
- fi
+ [ "${_target}" != "${tree}" ] && _target="${tree}" && continue
[ -z ${tree} ] && err "${_xm}: tree undefined"
[ -z ${rev} ] && err "${_xm}: revision undefined"
break
@@ -78,7 +69,6 @@ check_config_for_target()
{
[ -f "${cfgsdir}/${1}/target.cfg" ] || \
err "${_xm} check: target.cfg does not exist"
-
[ -f "${cfgsdir}/${1}/seen" ] && \
err "${_xm} check: infinite loop in tree definitions"