util: add sourcehut support to acquire

This commit is contained in:
Connor Olding 2022-10-04 02:25:37 -07:00
parent 6abe53acf8
commit 6bb35ed5b5

View File

@ -41,7 +41,7 @@
|| exit \ || exit \
;done \ ;done \
&& { [ "${#from}" != 0 ] || die "missing a required key: from" ;} \ && { [ "${#from}" != 0 ] || die "missing a required key: from" ;} \
&& if [ "$from" = github ] \ && if [ "$from" = github ] || [ "$from" = sourcehut ] \
;then : \ ;then : \
&& missing key repo "$repo" \ && missing key repo "$repo" \
&& missing key commit "$commit" \ && missing key commit "$commit" \
@ -55,7 +55,11 @@
;fi \ ;fi \
&& remote_fn="$commit.tar.gz" \ && remote_fn="$commit.tar.gz" \
&& local_fn="$username!$project-$remote_fn" \ && local_fn="$username!$project-$remote_fn" \
&& remote_url="https://github.com/$repo/archive/$remote_fn" \ && pathy="$repo/archive/$remote_fn" \
&& case "$from" in
(github) remote_url="https://github.com/$pathy" ;; \
(sourcehut) remote_url="https://git.sr.ht/~$pathy" ;; \
esac \
&& sha256="$checksum" \ && sha256="$checksum" \
&& { [ "${#dest}" != 0 ] || dest="${repo##*/}" ;} \ && { [ "${#dest}" != 0 ] || dest="${repo##*/}" ;} \
;else : \ ;else : \