util: allow passing commit and checksum through envvars to acquire
This commit is contained in:
parent
fca8488b08
commit
3103186443
|
@ -30,11 +30,17 @@ argue()
|
||||||
(dest) dest="$rhs" ;; \
|
(dest) dest="$rhs" ;; \
|
||||||
(commit) commit="$rhs" ;; \
|
(commit) commit="$rhs" ;; \
|
||||||
(checksum) checksum="$rhs" ;; \
|
(checksum) checksum="$rhs" ;; \
|
||||||
|
(env) env="${rhs%%[!A-Za-z0-9_]*}" ;; \
|
||||||
(*) warn "ignoring unknown key: $lhs" ;; \
|
(*) warn "ignoring unknown key: $lhs" ;; \
|
||||||
esac \
|
esac \
|
||||||
|| exit \
|
|| exit \
|
||||||
;done \
|
;done \
|
||||||
&& { [ "${#from}" != 0 ] || die "missing a required key: from" ;} \
|
&& { [ "${#from}" != 0 ] || die "missing a required key: from" ;} \
|
||||||
|
&& if [ -n "$env" ] && [ ".${env#[0-9]}" = ".$env" ] \
|
||||||
|
;then : \
|
||||||
|
"${commit:="$(printenv "${env}_COMMIT")"}" \
|
||||||
|
"${checksum:="$(printenv "${env}_SHA256")"}" \
|
||||||
|
;fi \
|
||||||
&& if [ "$from" = github ] || [ "$from" = sourcehut ] \
|
&& if [ "$from" = github ] || [ "$from" = sourcehut ] \
|
||||||
;then : \
|
;then : \
|
||||||
&& missing key repo "$repo" \
|
&& missing key repo "$repo" \
|
||||||
|
@ -62,9 +68,7 @@ argue()
|
||||||
|| exit \
|
|| exit \
|
||||||
;}
|
;}
|
||||||
|
|
||||||
ok=1 from= repo= commit= checksum=
|
ok=1 from= repo= commit= checksum= env= \
|
||||||
|
|
||||||
: \
|
|
||||||
&& { [ "$#" == 0 ] || argue "$@" ;} \
|
&& { [ "$#" == 0 ] || argue "$@" ;} \
|
||||||
&& { [ -d "/tmp" ] || die '/tmp must be mounted (or just exist)' ;} \
|
&& { [ -d "/tmp" ] || die '/tmp must be mounted (or just exist)' ;} \
|
||||||
&& missing variable dest "$dest" \
|
&& missing variable dest "$dest" \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user