mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
Add debug for get_windows()
This commit is contained in:
parent
5408979da5
commit
126e2d3aa0
1 changed files with 20 additions and 0 deletions
20
quickget
20
quickget
|
@ -1382,6 +1382,13 @@ function get_garuda() {
|
|||
make_vm_config "${OS}-${RELEASE}.iso"
|
||||
}
|
||||
|
||||
function dbg_windows() {
|
||||
local DEBUG=0
|
||||
if [ ${DEBUG} -eq 1 ]; then
|
||||
echo "${1}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Adapted from https://gist.github.com/hongkongkiwi/15a5bf16437315df256c118c163607cb
|
||||
function get_windows() {
|
||||
local ARCH="x64"
|
||||
|
@ -1411,24 +1418,37 @@ function get_windows() {
|
|||
|
||||
echo "Getting Windows ${RELEASE} URL..."
|
||||
WINDOWS_VERSIONS=$(wget -q -O- "https://tb.rg-adguard.net/php/get_version.php?type_id=1" | jq '.versions | sort_by(-(.version_id | tonumber))')
|
||||
dbg_windows "${WINDOWS_VERSIONS}"
|
||||
LATEST_WINDOWS_VERSION=$(echo "${WINDOWS_VERSIONS}" | jq -c 'map(select(.name | contains("Windows '${RELEASE}'")))['${INDEX}']')
|
||||
dbg_windows "${LATEST_WINDOWS_VERSION}"
|
||||
|
||||
WINDOWS_NAME=$(echo "${LATEST_WINDOWS_VERSION}" | jq -r .name)
|
||||
dbg_windows "${WINDOWS_NAME}"
|
||||
VERSION_ID=$(echo "${LATEST_WINDOWS_VERSION}" | jq -r .version_id)
|
||||
dbg_windows "${VERSION_ID}"
|
||||
|
||||
case ${RELEASE} in
|
||||
8) EDITION_ID=$(wget -q -O- "https://tb.rg-adguard.net/php/get_edition.php?version_id=${VERSION_ID}&lang=name_${LANG_CODE}" | jq -r '.editions[] | select(.name_'${LANG_CODE}'=="Windows 8.1 Pro + Core").edition_id');;
|
||||
10|11) EDITION_ID=$(wget -q -O- "https://tb.rg-adguard.net/php/get_edition.php?version_id=${VERSION_ID}&lang=name_${LANG_CODE}" | jq -r '.editions[] | select(.name_'${LANG_CODE}'=="Windows '${RELEASE}'").edition_id');;
|
||||
esac
|
||||
dbg_windows "${EDITION_ID}"
|
||||
|
||||
LANGUAGE_ID=$(wget -q -O- "https://tb.rg-adguard.net/php/get_language.php?edition_id=${EDITION_ID}&lang=name_${LANG_CODE}" | jq -r '.languages[] | select(.name_'${LANG_CODE}'=="'"${LANG_NAME}"'").language_id')
|
||||
dbg_windows "${LANGUAGE_ID}"
|
||||
ARCH_INFO=$(wget -q -O- "https://tb.rg-adguard.net/php/get_arch.php?language_id=${LANGUAGE_ID}")
|
||||
dbg_windows "${ARCH_INFO}"
|
||||
FILE_NAME=$(echo "${ARCH_INFO}" | jq -r '.archs[] | select(.name | contains("'${ARCH}'")).name')
|
||||
dbg_windows "${FILE_NAME}"
|
||||
ARCH_ID=$(echo "${ARCH_INFO}" | jq -r '.archs[] | select(.name | contains("'${ARCH}'")).arch_id')
|
||||
dbg_windows "${ARCH_ID}"
|
||||
DOWNLOAD_INFO=$(wget -q -O- "https://tb.rg-adguard.net/dl.php?fileName=${ARCH_ID}&lang=en")
|
||||
dbg_windows "${DOWNLOAD_INFO}"
|
||||
DOWNLOAD_SHA1=$(echo "${DOWNLOAD_INFO}" | sed -e 's/<[^>]*>//g' | grep -o -P '(?<=SHA1: ).*(?= expire)' | sed 's/Link//')
|
||||
dbg_windows "${DOWNLOAD_SHA1}"
|
||||
DOWNLOAD_ID=$(echo "${DOWNLOAD_INFO}" | grep -oP '(?<=https:\/\/tb\.rg-adguard\.net/dl\.php\?go=)[0-9a-z]+')
|
||||
dbg_windows "${DOWNLOAD_ID}"
|
||||
DOWNLOAD_URL="https://tb.rg-adguard.net/dl.php?go=${DOWNLOAD_ID}"
|
||||
dbg_windows "${DOWNLOAD_URL}"
|
||||
|
||||
echo "Downloading ${WINDOWS_NAME}..."
|
||||
web_get "${DOWNLOAD_URL}" "${VM_PATH}" "${FILE_NAME}"
|
||||
|
|
Loading…
Reference in a new issue