DistroHopper/OS/android
zen0bit c087af2323 tmp
2024-04-10 21:20:44 +02:00

31 lines
No EOL
1.1 KiB
Text

INFO="Android x86|Independent||https://www.android-x86.org/|Port Android Open Source Project to x86 platform.";;
function releases_android() {
echo 9.0 8.1 7.1
}
function editions_android() {
echo x86_64 x86
}
function get_android() {
local EDITION="${1:-}"
local HASH=""
local ISO=""
local JSON_ALL=""
local JSON_REL=""
local URL="https://mirrors.gigenet.com/OSDN/android-x86"
JSON_ALL=$(wget -q -O- "https://www.fosshub.com/Android-x86-old.html" | grep "var settings =" | cut -d'=' -f2-)
JSON_REL=$(echo "${JSON_ALL}" | jq --arg ver "${OS}-${EDITION}-${RELEASE}" 'first(.pool.f[] | select((.n | startswith($ver)) and (.n | endswith(".iso"))))')
ISO=$(echo "${JSON_REL}" | jq -r .n)
HASH=$(echo "${JSON_REL}" | jq -r .hash.sha256)
# Traverse the directories to find the .iso location
for DIR in $(wget -4 -q -O- "${URL}" | grep -o -E '[0-9]{5}' | sort -ur); do
if wget -4 -q -O- "${URL}/${DIR}" | grep "${ISO}" &>/dev/null; then
URL="${URL}/${DIR}"
break
fi
done
echo "${URL}/${ISO} ${HASH}"
}