Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: basic arm64 support for quickget #917

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 48 additions & 5 deletions quickget
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,17 @@ function os_homepages(){
echo "${HOMEPAGE}"
}

function check_arch() {
# Check the architecture of the host system. Format it in a more standard way (e.g. x86_64 -> amd64), and set it as a global variable
local OUTPUT=$(uname -m)
case ${OUTPUT} in
x86_64) ARCH="amd64";;
i386|i686) ARCH="i386";;
armv8*|aarch64*) ARCH="arm64";;
*) ARCH="${OUTPUT}";;
esac
}

function releases_alma() {
echo 8 9
}
Expand Down Expand Up @@ -939,6 +950,10 @@ function web_get() {
exit 1
fi

if echo ${URL} | grep -qE "aarch64|arm64"; then
setArch="on"
fi

if command -v aria2c &>/dev/null; then
if ! aria2c --stderr -x16 --continue=true --summary-interval=0 --download-result=hide --console-log-level=error "${URL}" --dir "${DIR}" -o "${FILE}"; then
echo #Necessary as aria2c in suppressed mode does not have new lines
Expand All @@ -958,6 +973,10 @@ function zsync_get() {
local OUT=""
local URL="${1}"

if echo ${URL} | grep -qE "aarch64|arm64"; then
setArch="on"
fi

# Test mode for ISO
if [ "${show_iso_url}" == 'on' ]; then
echo "${URL}"
Expand Down Expand Up @@ -1136,6 +1155,10 @@ EOF
;;
esac

if [[ "${setArch}" == "on" ]]; then
echo "arch=\"${ARCH}\"" >> "${CONF_FILE}"
fi

if [ "${OS}" == "ubuntu" ] && [[ ${RELEASE} == *"daily"* ]]; then
# Minimum to install lobster testing is 18GB but 32GB are allocated for headroom
echo "disk_size=\"32G\"" >> "${CONF_FILE}"
Expand Down Expand Up @@ -1486,6 +1509,7 @@ function get_fedora() {
local HASH=""
local ISO=""
local JSON=""
local RAWJSON="$(wget -q -O- "https://getfedora.org/releases.json")"
local URL=""
local VARIANT=""

Expand All @@ -1494,7 +1518,15 @@ function get_fedora() {
*) VARIANT="Spins";;
esac

JSON=$(wget -q -O- "https://getfedora.org/releases.json" | jq '.[] | select(.variant=="'${VARIANT}'" and .subvariant=="'"${EDITION}"'" and .arch=="x86_64" and .version=="'"${RELEASE}"'")')
if [[ "${ARCH}" == "arm64" ]]; then
JSON=$(echo "${RAWJSON}" | jq '.[] | select(.subvariant=="'"${EDITION}"'" and .arch=="aarch64" and .version=="'"${RELEASE}"'" and (.link | test("iso")))')
if [ -z "${JSON}" ]; then
JSON=$(echo "${RAWJSON}" | jq '.[] | select(.variant=="'${VARIANT}'" and .subvariant=="'"${EDITION}"'" and .arch=="x86_64" and .version=="'"${RELEASE}"'")')
fi
else
JSON=$(echo "${RAWJSON}" | jq '.[] | select(.variant=="'${VARIANT}'" and .subvariant=="'"${EDITION}"'" and .arch=="x86_64" and .version=="'"${RELEASE}"'")')
fi

URL=$(echo "${JSON}" | jq -r '.link' | head -n1)
HASH=$(echo "${JSON}" | jq -r '.sha256' | head -n1)
echo "${URL} ${HASH}"
Expand Down Expand Up @@ -2041,7 +2073,6 @@ function get_truenas-core() {
}

function get_ubuntu-server() {

local HASH=""
local ISO=""
local URL=""
Expand All @@ -2050,16 +2081,18 @@ function get_ubuntu-server() {

if [[ "${RELEASE}" == "daily"* ]]; then
URL="https://cdimage.ubuntu.com/${OS}/${RELEASE}/current"
elif [[ ${ARCH} == "arm64" ]]; then
URL="https://cdimage.ubuntu.com/releases/${RELEASE}/release"
else
URL="https://releases.ubuntu.com/${RELEASE}"
fi

if wget -q --spider "${URL}/SHA256SUMS"; then
DATA=$(wget -qO- "${URL}/SHA256SUMS" | grep 'live-server' | grep amd64 | grep iso)
DATA=$(wget -qO- "${URL}/SHA256SUMS" | grep 'live-server' | grep "${ARCH}" | grep iso)
ISO=$(cut -d'*' -f2 <<<${DATA})
HASH=$(cut -d' ' -f1 <<<${DATA})
else
DATA=$(wget -qO- "${URL}/MD5SUMS" | grep 'live-server' | grep amd64 | grep iso)
DATA=$(wget -qO- "${URL}/MD5SUMS" | grep 'live-server' | grep "${ARCH}" | grep iso)
ISO=$(cut -d' ' -f3 <<<${DATA})
HASH=$(cut -d' ' -f1 <<<${DATA})
fi
Expand Down Expand Up @@ -2101,6 +2134,8 @@ function get_ubuntu() {
URL="https://cdimage.ubuntu.com/${OS}/jammy/daily-live/current"
fi
VM_PATH="${OS}-jammy-live"
elif [[ "${OS}" == "ubuntu" ]] && [[ "${RELEASE}" == "22.04" ]] && [[ "${ARCH}" == "arm64" ]]; then
URL="https://cdimage.ubuntu.com/jammy/daily-live/current"
elif [[ "${RELEASE}" == "daily"* ]] || [ "${RELEASE}" == "dvd" ]; then
URL="https://cdimage.ubuntu.com/${OS}/${RELEASE}/current"
VM_PATH="${OS}-${RELEASE}"
Expand All @@ -2111,7 +2146,13 @@ function get_ubuntu() {
fi

if wget -q --spider "${URL}/SHA256SUMS"; then
DATA=$(wget -qO- "${URL}/SHA256SUMS" | grep 'desktop\|dvd\|install' | grep amd64 | grep iso | grep -v "+mac")
DATA=$(wget -qO- "${URL}/SHA256SUMS" | grep 'desktop\|dvd\|install' | grep iso | grep -v "+mac")
# Check whether the host architecture (excluding amd64) is available
if echo "${DATA}" | grep -q $ARCH && [[ "${ARCH}" != "amd64" ]]; then
DATA=$(echo "${DATA}" | grep $ARCH)
else
DATA=$(echo "${DATA}" | grep amd64)
fi
ISO=$(cut -d'*' -f2 <<<${DATA} | sed '1q;d')
HASH=$(cut -d' ' -f1 <<<${DATA} | sed '1q;d')
else
Expand Down Expand Up @@ -2764,6 +2805,8 @@ if [[ ! $(os_support) =~ ${OS} ]]; then
exit 1
fi

check_arch

if [ -n "${2}" ]; then
RELEASE="${2,,}"
VM_PATH="${OS}-${RELEASE}"
Expand Down
Loading