sfx-repack: support wget

This commit is contained in:
ed 2020-12-14 02:59:15 +01:00
parent 29286e159b
commit 580a42dec7
2 changed files with 15 additions and 3 deletions

16
scripts/copyparty-repack.sh Executable file → Normal file
View file

@ -27,13 +27,24 @@ cd "$td"
pwd
dl_text() {
command -v curl && exec curl "$@"
exec wget -O- "$@"
}
dl_files() {
command -v curl && exec curl -L --remote-name-all "$@"
exec wget "$@"
}
export -f dl_files
# debug: if cache exists, use that instead of bothering github
cache="$od/.copyparty-repack.cache"
[ -e "$cache" ] &&
tar -xvf "$cache" ||
{
# get download links from github
curl https://api.github.com/repos/9001/copyparty/releases/latest |
dl_text https://api.github.com/repos/9001/copyparty/releases/latest |
(
# prefer jq if available
jq -r '.assets[]|select(.name|test("-sfx|tar.gz")).browser_download_url' ||
@ -42,7 +53,8 @@ cache="$od/.copyparty-repack.cache"
awk -F\" '/"browser_download_url".*(\.tar\.gz|-sfx\.)/ {print$4}'
) |
tee /dev/stderr |
tr -d '\r' | tr '\n' '\0' | xargs -0 curl -L --remote-name-all
tr -d '\r' | tr '\n' '\0' |
xargs -0 bash -c 'dl_files "$@"' _
# debug: create cache
#tar -czvf "$cache" *

2
scripts/make-sfx.sh Executable file → Normal file
View file

@ -115,7 +115,7 @@ git describe --tags >/dev/null 2>/dev/null && {
exit 1
}
dt="$(git log -1 --format=%cd --date=format:'%Y, %m, %d')"
dt="$(git log -1 --format=%cd --date=format:'%Y,%m,%d' | sed 's/,0?/, /g')"
printf 'git %3s: \033[36m%s\033[0m\n' ver "$ver" dt "$dt"
sed -ri '
s/^(VERSION =)(.*)/#\1\2\n\1 ('"$t_ver"')/;