build-package: more verbose output on BP_DEBUG=1

merge-requests/33/head
Christopher Roy Bratusek 4 years ago
parent 374682a91e
commit 90337742ef

@ -11,6 +11,16 @@ repo_nanolx="https://nanolx.org/fdroid/repo"
repo_bromite="https://fdroid.bromite.org/fdroid/repo"
repo_ogapps="https://gitlab.opengapps.org/opengapps"
USERAGENT="Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0"
if [ "${BP_DEBUG}" = '1' ]; then
WGET="wget -v"
CURL="curl -v"
else
WGET="wget -q"
CURL="curl -s"
fi
# check dependencies
for dep in gawk curl jq gzip; do
if ! which ${dep} &>/dev/null; then
@ -22,33 +32,33 @@ done
debug_download () {
case $1 in
index)
if [ "$BP_USE_WGET" = '1' ]; then
if [ "${BP_USE_WGET}" = '1' ]; then
rm -rf "$2"
debug_message normal "wget -q --show-progress \"$3\" -O \"${2#$CWD/}\"" " "
wget -q --show-progress "$3" -O "$2" || error "$4"
debug_message normal "${WGET} --show-progress \"$3\" -O \"${2#$CWD/}\"" " "
${WGET} --show-progress "$3" -O "$2" || error "$4"
else
debug_message normal "curl -sSL -o \"${2#$CWD/}\" \"$3\"" " "
curl -sSL -o "$2" "$3" || error "$4"
debug_message normal "${CURL} -A \"${USERAGENT}\" -SL -o \"${2#$CWD/}\" \"$3\"" " "
${CURL} -A "${USERAGENT}" -SL -o "$2" "$3" || error "$4"
fi
;;
no_delete)
if [ "$BP_USE_WGET" = '1' ]; then
if [ "${BP_USE_WGET}" = '1' ]; then
rm -rf "$2"
debug_message normal "wget -q --show-progress \"$3\" -O \"${2#$CWD/}\""
wget -q --show-progress "$3" -O "$2"
debug_message normal "${WGET} --show-progress \"$3\" -O \"${2#$CWD/}\""
${WGET} --show-progress "$3" -O "$2"
else
debug_message normal "curl -sSL -o \"${2#$CWD/}\" \"$3\""
curl -sSL -o "$2" "$3"
debug_message normal "${CURL} -A \"${USERAGENT}\" -SL -o \"${2#$CWD/}\" \"$3\""
${CURL} -A "${USERAGENT}" -SL -o "$2" "$3"
fi
;;
delete)
if [ "$BP_USE_WGET" = '1' ]; then
if [ "${BP_USE_WGET}" = '1' ]; then
rm -rf "$2"
debug_message normal "wget -q --show-progress \"$3\" -O \"${2#$CWD/}\""
wget -q --show-progress "$3" -O "$2" || rm -f "$4"
debug_message normal "${WGET} --show-progress \"$3\" -O \"${2#$CWD/}\""
${WGET} --show-progress "$3" -O "$2" || rm -f "$4"
else
debug_message normal "curl -sSL -o \"${2#$CWD/}\" \"$3\""
curl -sSL -o "$2" "$3" || rm -f "$4"
debug_message normal "${CURL} -A \"${USERAGENT}\" -SL -o \"${2#$CWD/}\" \"$3\""
${CURL} -A "${USERAGENT}" -SL -o "$2" "$3" || rm -f "$4"
fi
;;
esac
@ -214,8 +224,8 @@ grab_apk_from_url () {
}
grab_apk_from_github () {
[ "$BP_DEBUG" = '1' ] && debug_message normal "curl -s -N \"https://api.github.com/repos/${1}/releases\""
local apk_url="$(curl -s -N "https://api.github.com/repos/${1}/releases" | \
[ "$BP_DEBUG" = '1' ] && debug_message normal "${CURL} -s -N \"https://api.github.com/repos/${1}/releases\""
local apk_url="$(${CURL} -s -N "https://api.github.com/repos/${1}/releases" | \
gawk -F\" '/browser_download_url.*apk/{print $4 ; exit}')"
local apk_dest="${appsfolder[2]}/${2}/${3}"
@ -240,8 +250,8 @@ grab_apk_from_github () {
}
grab_apk_from_gitlab () {
[ "$BP_DEBUG" = '1' ] && debug_message newline "curl -s -N \"https://gitlab.com/${1}/-/tags\"" "\n"
local apk_url=$(curl -s -N "https://gitlab.com/${1}/-/tags" | grep '.apk' | head -n 1)
[ "$BP_DEBUG" = '1' ] && debug_message newline "${CURL} -s -N \"https://gitlab.com/${1}/-/tags\"" "\n"
local apk_url=$(${CURL} -s -N "https://gitlab.com/${1}/-/tags" | grep '.apk' | head -n 1)
local apk_url=${apk_url%\">*.apk*}
local apk_url="https://gitlab.com${apk_url##*a href=\"}"
local apk_url="${apk_url/\"*}"

Loading…
Cancel
Save