mirror of
https://github.com/kaboomserver/server.git
synced 2024-12-22 23:55:18 +00:00
27 lines
586 B
Bash
27 lines
586 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
_download_type_zip() {
|
||
|
read_args url skip_404 extract
|
||
|
|
||
|
zip_path="$(mktemp --suffix=.zip)"
|
||
|
|
||
|
exitcode=0
|
||
|
download_with_args "$zip_path" || exitcode=$?
|
||
|
if [ $exitcode != 0 ]; then
|
||
|
rm -f "$zip_path" 2>/dev/null
|
||
|
|
||
|
if [ $exitcode = 100 ] && [ "${arg_skip_404:-false}" = "true" ]; then
|
||
|
return 0
|
||
|
else
|
||
|
return $exitcode
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
debug "extracting ${arg_extract:?} to $1"
|
||
|
unzip -p "$zip_path" \
|
||
|
"${arg_extract:?}" > "$1" || exitcode=$?
|
||
|
rm -f "$zip_path" 2>/dev/null
|
||
|
|
||
|
return $exitcode
|
||
|
}
|