# Template file for 'redox-os' OSNAME="redox-os" PRETTY="Redox OS" LOGO="" ICON="redox-os.svg" CATEGORY="Desktop, Live Medium, Server" BASEDOF="-" HOMEPAGE="https://www.redox-os.org" DESCRIPTION="Microkernel-based operating system, with a large number of supported programs and components, to create a full-featured user and application environment" CREDENTIALS="-" GPG="" RSS="" DW="" function releases_() { echo livedisk harddrive } function editions_() { echo demo desktop server } function arch_() { echo amd64 arm64 i586 riscv64 } function get_() { local REDOX_ARCH EXT case "${ARCH:-amd64}" in amd64|x86_64) REDOX_ARCH=x86_64 ;; arm64|aarch64) REDOX_ARCH=aarch64 ;; i586) REDOX_ARCH=i586 ;; riscv64|riscv64gc) REDOX_ARCH=riscv64gc ;; *) return 1 ;; esac case "${RELEASE}" in livedisk) EXT=iso ;; harddrive) EXT=img ;; *) return 1 ;; esac case "${EDITION}" in demo|desktop|server) ;; *) return 1 ;; esac local URL="https://static.redox-os.org/img/${REDOX_ARCH}" local ENTRY ISO HASH MANIFEST # Do not silently parse an HTTP error page as an empty checksum list. if ! MANIFEST=$(web_pipe "${URL}/SHA256SUM" \ --fail --show-error --retry 3 --retry-delay 2 --retry-all-errors \ --connect-timeout 15 --max-time 60); then echo "ERROR: Redox could not fetch ${URL}/SHA256SUM (HTTP/network failure; the host may restrict CI runners)." >&2 return 1 fi # Cloudflare can return a browser challenge with HTTP 200, which --fail # cannot detect. This is an access failure, not a missing Redox image. if [[ "${MANIFEST}" == *'Just a moment...'* || "${MANIFEST}" == *'/cdn-cgi/challenge-platform/'* ]]; then echo "ERROR: Redox download host returned a Cloudflare browser challenge for ${URL}/SHA256SUM." >&2 echo 'Automated access is blocked on this network; no image checksum can be verified. Retry later or ask Redox to allow automated downloads.' >&2 return 1 fi ENTRY=$(printf '%s\n' "${MANIFEST}" | awk \ -v prefix="redox_${EDITION}_${REDOX_ARCH}_" \ -v suffix="_${RELEASE}.${EXT}" ' { hash = $1; file = $2 sub(/^\*/, "", file) if (length(hash) != 64 || hash ~ /[^[:xdigit:]]/) next if (index(file, prefix) != 1) next tail = substr(file, length(prefix) + 1) # Accept only dated build filenames, never paths or error pages. if (tail !~ /^[0-9]+-[0-9]+-[0-9]+_[0-9]+_/) next sub(/^[0-9]+-[0-9]+-[0-9]+_[0-9]+/, "", tail) if (tail != suffix && tail != suffix ".zst") next printf "%s\t%s\n", file, hash }' | sort -k1,1V | tail -n1) if [ -z "${ENTRY}" ]; then echo "ERROR: Redox ${REDOX_ARCH}/${RELEASE}/${EDITION}: no matching image in ${URL}/SHA256SUM" >&2 printf 'Manifest response (first 200 characters): %s\n' "${MANIFEST:0:200}" >&2 return 1 fi IFS=$'\t' read -r ISO HASH <<< "${ENTRY}" echo "${URL}/${ISO} ${HASH}" } function extract_() { if [[ "${ISO}" == *.zst ]]; then zstd -d "${VM_PATH}/${ISO}" || return 1 ISO="${ISO%.zst}" fi if [[ "${ISO}" == *.img ]]; then if ! command -v qemu-img >/dev/null 2>&1; then echo 'ERROR! qemu-img is required to convert the Redox harddrive image.' >&2 return 1 fi qemu-img convert -f raw -O qcow2 "${VM_PATH}/${ISO}" "${VM_PATH}/disk.qcow2" || return 1 ISO="disk.qcow2" # Boot the converted system disk, not a nonexistent installer ISO. IMAGE_TYPE="none" fi }