diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-09-12 13:24:13 +0100 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-09-12 13:24:13 +0100 |
| commit | 897c2667af32342a39093733315a25cc2e0296e8 (patch) | |
| tree | a7fa3404cdaef55397cd7166411fb3784b0462cd /include | |
| parent | 446eca846e3dc4dafef51098f6959086a51999b2 (diff) | |
get.sh: even more cleanup (simplified fetch)
fetch_submodule now contains just the right amount
of eval, which means all of the eval.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/get.sh | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/include/get.sh b/include/get.sh index a71993a0..ea03b07f 100644 --- a/include/get.sh +++ b/include/get.sh @@ -44,12 +44,10 @@ fetch_project() clone_project() { - if ! singletree "$project"; then + singletree "$project" || \ return 0 - fi loc="src/$project" - [ -d "$loc" ] && \ return 0 @@ -81,7 +79,6 @@ git_prep() fetch_submodule() { mcfgdir="$mdir/${1##*/}" - eval "`newvar st subcurl subcurl_bkup subgit subgit_bkup subhash`" if e "$mcfgdir/module.cfg" f missing; then @@ -90,39 +87,22 @@ fetch_submodule() . "$mcfgdir/module.cfg" || \ err "Can't read '$mcfgdir/module.cfg'" "fetch_submodules" "$@" - if [ -n "$subgit" ] || [ -n "$subgit_bkup" ]; then - st="$st git" - fi - if [ -n "$subcurl" ] || [ -n "$subcurl_bkup" ]; then - st="$st curl" - fi - - st="${st# }" - [ "$st" = "git curl" ] && \ + [ -n "$subgit" ] && [ -n "$subgit_bkup" ] && \ + st="git" + [ -n "$subcurl" ] && [ -n "$subcurl_bkup" ] && \ + st="curl$st" + [ "$st" = "curlgit" ] && \ err "$mdir: git+curl defined" "fetch_submodule" "$@" - [ -z "$st" ] && \ return 0 - - if [ "$st" = "curl" ]; then - if [ -z "$subcurl" ] || [ -z "$subcurl_bkup" ]; then - err "subcurl/subcurl_bkup not both set" \ - "fetch_submodule" "$@" - fi - elif [ -z "$subgit" ] || [ -z "$subgit_bkup" ]; then - err "subgit/subgit_bkup not both set" "fetch_submodule" "$@" - elif [ -z "$subhash" ]; then + [ -z "$subhash" ] && \ err "subhash not set" "fetch_submodule" "$@" - fi - if [ "$st" = "git" ]; then + [ "$st" = "git" ] && \ x_ rm -Rf "$tmpgit/$1" - xbget "$st" "$subgit" "$subgit_bkup" "$tmpgit/$1" \ - "$subhash" "$mdir/${1##*/}/patches" - else - xbget "$st" "$subcurl" "$subcurl_bkup" "$tmpgit/$1" \ - "$subhash" "$mdir/${1##*/}/patches" - fi + + eval "xbget \"\$st\" \"\$sub$st\" \"\$sub${st}_bkup\" \"\$tmpgit/\$1\" \ + \"\$subhash\" \"\$mdir/\${1##*/}/patches\"" } # TODO: in the following functions, argument numbers are used |
