Fix curl redirections

gf-arm64
FriendlyNeighborhoodShane 4 years ago
parent 005806de2f
commit cca7e7238d

@ -191,7 +191,7 @@ checkwhitelist() {
echo " ";
echo " - Getting priv-app permissions...";
curl --progress-bar "$privpermurl" -o "$tmpdir/tmppage" || { echo "ERROR: Android permission docpage failed to download" >&2; return 1; }
curl -L --progress-bar "$privpermurl" -o "$tmpdir/tmppage" || { echo "ERROR: Android permission docpage failed to download" >&2; return 1; }
lines="$(grep -Pn "<!-- [=]* [A-Z ]* [=]* -->" "$tmpdir/tmppage" | grep -A1 "ENUM CONSTANTS DETAIL" | sed "s|:| |g" | select_word 1)";
for line in $lines; do

@ -93,7 +93,7 @@ for repo in $(echo "$stuff_repo" | select_word 1); do
repourl="$(echo "$line" | select_word 2)";
[ "$repourl" ] || { echo "ERROR: Repo $repo has no URL" >&2; continue; }
echo " -- REPO: Downloading repo $repo";
curl --progress-bar "$repourl/index-v1.jar" -o "$tmpdir/repos/$repo.jar";
curl -L --progress-bar "$repourl/index-v1.jar" -o "$tmpdir/repos/$repo.jar";
[ -f "$tmpdir/repos/$repo.jar" ] || { echo "ERROR: Repo $repo failed to download" >&2; continue; }
unzip -oq "$tmpdir/repos/$repo.jar" "index-v1.json" -d "$tmpdir/repos/";
[ -f "$tmpdir/repos/index-v1.json" ] || { echo "ERROR: Repo $repo failed to unzip" >&2; continue; }
@ -124,14 +124,14 @@ for object in $(echo "$stuff_download" | select_word 1); do
;;
github)
echo " ---- Getting GitHub URL for $object";
objecturl="$(curl -sN "https://api.github.com/repos/$objectpath/releases" | jq -r '.[].assets[].browser_download_url' | grep -P "$objectarg$" | head -n1)";
objecturl="$(curl -Ls "https://api.github.com/repos/$objectpath/releases" | jq -r '.[].assets[].browser_download_url' | grep -P "$objectarg$" | head -n1)";
;;
gitlab)
echo " ---- Getting GitLab project ID for $object";
objectid="$(curl -sN "https://gitlab.com/$objectpath" | grep "Project ID" | head -n1 | select_word 3)";
objectid="$(curl -Ls "https://gitlab.com/$objectpath" | grep "Project ID" | head -n1 | select_word 3)";
[ "$objectid" ] || { echo "ERROR: $object gitlab project ID not found" >&2; continue; }
echo " ---- Getting GitLab URL for $object";
objectupload="$(curl -sN "https://gitlab.com/api/v4/projects/$objectid/repository/tags" | jq -r '.[].release.description' | grep -Po "(/uploads/[^()]*$objectarg)" | head -n1 | tr -d "()")";
objectupload="$(curl -Ls "https://gitlab.com/api/v4/projects/$objectid/repository/tags" | jq -r '.[].release.description' | grep -Po "(/uploads/[^()]*$objectarg)" | head -n1 | tr -d "()")";
[ "$objectupload" ] || { echo "ERROR: $object gitlab project upload not found" >&2; continue; }
objecturl="https://gitlab.com/$objectpath$objectupload";
;;
@ -163,7 +163,7 @@ for object in $(echo "$stuff_download" | select_word 1); do
objectname="$(basename "$objecturl")";
objectfile="$tmpdir/$objectname";
echo " ---- Downloading $objecturl";
curl --progress-bar "$objecturl" -o "$objectfile" || { echo "ERROR: $object failed to download" >&2; continue; }
curl -L --progress-bar "$objecturl" -o "$objectfile" || { echo "ERROR: $object failed to download" >&2; continue; }
[ -f "$objectfile" ] || { echo "ERROR: $object failed to download" >&2; continue; }
echo "NAME: $objectname, FILE: $object, URL: $objecturl;" >> "$updatelog";
;;

Loading…
Cancel
Save