commit 5ba9fb663d5c8299a89be8b5884739e61f48d774 Author: Vladimir Kravets Date: Sat Apr 7 00:16:58 2012 +0300 Add cookie support diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 80bb1c9..9eaf2e7 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -385,6 +385,8 @@ download_file() { # temporary download file, default to last component of the URL local dlfile="${url##*/}" + local cookie=$4 + # replace %o by the temporary dlfile if it exists if [[ $dlcmd = *%o* ]]; then dlcmd=${dlcmd//\%o/\"$file.part\"} @@ -397,6 +399,14 @@ download_file() { dlcmd="$dlcmd \"$url\"" fi + if [[ $dlcmd = *%h* ]]; then + if [[ -n $cookie ]]; then + dlcmd=${dlcmd//\%h/--header \"Cookie: $cookie\"} + else + dlcmd=${dlcmd//\%h/} + fi + fi + local ret=0 eval "$dlcmd || ret=\$?" if (( ret )); then @@ -562,7 +572,11 @@ download_sources() { msg2 "$(gettext "Downloading %s...")" "$file" # fix flyspray bug #3289 local ret=0 - download_file "$dlclient" "$url" "$file" || ret=$? + if [[ -n ${cookies} ]]; then + download_file "$dlclient" "$url" "$file" "${cookies}" || ret=$? + else + download_file "$dlclient" "$url" "$file" || ret=$? + fi if (( ret )); then error "$(gettext "Failure while downloading %s")" "$file" plain "$(gettext "Aborting...")"