diff options
author | Leah Rowe <leah@libreboot.org> | 2023-08-22 00:34:15 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-08-22 00:34:15 +0100 |
commit | 04ee26726af5f09dc47efc95d853341201019f5a (patch) | |
tree | 68d385ed3cafcc6851d5839624f65ffc157c0b66 /fetch_trees | |
parent | 62f23123cb2a5ef594f405053d0b111c6e01de87 (diff) |
also clean up the main scripts
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'fetch_trees')
-rwxr-xr-x | fetch_trees | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/fetch_trees b/fetch_trees index 19112a2e..ed15739a 100755 --- a/fetch_trees +++ b/fetch_trees @@ -1,7 +1,7 @@ #!/usr/bin/env sh # helper script: create code trees based on git revision, with patches -# (currently used for downloading coreboot and u-boot) +# (currently used for downloading coreboot, seabios and u-boot) # # Copyright (C) 2014-2016,2020,2021,2023 Leah Rowe <info@minifree.org> # Copyright (C) 2022 Alper Nebi Yasak <alpernebiyasak@gmail.com> @@ -72,16 +72,14 @@ download_for_target() if [ -d "${project}/${tree}" ]; then printf "REMARK: download/%s %s: exists. Skipping.\n" \ - ${project} ${tree} - [ "${tree}" != "${1}" ] && \ - printf "(for target: '%s}')\n" ${1} + ${project} ${tree} + [ "${tree}" != "${_target}" ] && \ + printf "(for target: '%s}')\n" ${_target} return 0 fi fetch_from_upstream || exit 1 - - prepare_new_tree "${1}" "${tree}" "${rev}" \ - || exit 1 + prepare_new_tree "${_target}" "${tree}" "${rev}" || exit 1 } fetch_config() @@ -135,14 +133,11 @@ check_config_for_target() fetch_from_upstream() { - [ ! -d "${project}" ] && \ - mkdir -p "${project}" - [ ! -d "${project}" ] && \ - return 1 - [ -d "${project}/${project}" ] && \ - return 0 - ./fetch ${project} || \ - return 1 + [ -d "${project}" ] || mkdir -p "${project}" + [ -d "${project}" ] || return 1 + [ -d "${project}/${project}" ] && return 0 + + ./fetch ${project} || return 1 } prepare_new_tree() @@ -157,16 +152,14 @@ prepare_new_tree() cp -R "${project}/${project}" "${project}/${tree}" || exit 1 ( - cd "${project}/${tree}" \ - || err "cannot cd to ${project}/${tree}" - git reset --hard ${rev} \ - || err "cannot reset ${project} revision for tree, ${tree}" - git submodule update --init --checkout \ - || err "cannot update ${project} submodules for tree, ${tree}" + cd "${project}/${tree}" || err "cannot cd to ${project}/${tree}" + git reset --hard ${rev} || \ + err "cannot reset ${project} revision for tree, ${tree}" + git submodule update --init --checkout || \ + err "cannot update ${project} submodules for tree, ${tree}" for patch in ../../"${cfgsdir}"/"${tree}"/patches/*.patch; do - [ ! -f "${patch}" ] && \ - continue + [ ! -f "${patch}" ] && continue if ! git am "${patch}"; then git am --abort err "cannot patch ${tree}" |