# Template file for 'ubuntu-server' OSNAME="ubuntu-server" PRETTY="Ubuntu Server" ICON="ubuntu-server.svg" CATEGORY="advanced" BASEDOF="Debian" HOMEPAGE="https://ubuntu.com/server" DESCRIPTION="Brings economic and technical scalability to your datacentre, public or private. Whether you want to deploy an OpenStack cloud, a Kubernetes cluster or a 50,000-node render farm, Ubuntu Server delivers the best value scale-out performance available" CREDENTIALS="-" GPG="" RSS="" DW="" function releases_() { local ALL_VERSIONS=() # shellcheck disable=SC2207 ALL_VERSIONS=($(IFS=$'\n' web_pipe https://releases.ubuntu.com/streams/v1/com.ubuntu.releases:ubuntu-server.json | jq -r '.products[] | select(.arch=="amd64") | .version' | sort -rV)) echo daily-live "${ALL_VERSIONS[@]}" } function get_() { local HASH="" local ISO="" local NAME="live-server" local URL="" DATA="" CODENAME="" if [[ "${RELEASE}" == "daily"* ]]; then CODENAME=$(web_pipe "https://api.launchpad.net/devel/ubuntu/series" \ | jq -r '[.entries[] | select(.status == "Active Development")][0].name // empty') [ -n "${CODENAME}" ] || return 1 URL="https://cdimage.ubuntu.com/${OS}/${CODENAME}/${RELEASE}/current" else URL="https://releases.ubuntu.com/${RELEASE}" fi case "${RELEASE}" in 14*|16*) NAME="server";; esac if web_check "${URL}/SHA256SUMS"; then DATA=$(web_pipe "${URL}/SHA256SUMS" | grep "${NAME}" | grep amd64 | grep '\.iso$' | sort -k2,2V | tail -n 1) ISO=$(cut -d'*' -f2 <<<"${DATA}") HASH=$(cut -d' ' -f1 <<<"${DATA}") else DATA=$(web_pipe "${URL}/MD5SUMS" | grep "${NAME}" | grep amd64 | grep '\.iso$' | sort -k2,2V | tail -n 1) ISO=$(awk '{sub(/^\*/, "", $2); print $2}' <<<"${DATA}") HASH=$(cut -d' ' -f1 <<<"${DATA}") fi [ -n "${ISO}" ] && [ -n "${HASH}" ] || return 1 if [[ "${RELEASE}" == "daily"* ]] || [ "${RELEASE}" == "dvd" ]; then zsync_get "${URL}/${ISO}" "${VM_PATH}" "${OS}-devel.iso" || return $? make_vm_config "${OS}-devel.iso" else web_get "${URL}/${ISO}" "${VM_PATH}" || return $? check_hash "${ISO}" "${HASH}" make_vm_config "${ISO}" fi } function config_() { # 22.04+ fails on LVM build if disk size is < 10G # 22.04.1 fails on auto-install if TPM is disabled echo "disk_size=\"10G\"" >> "${CONF_FILE}" echo "ram=\"4G\"" >> "${CONF_FILE}" if [[ "${RELEASE}" == *"22.04"* ]]; then echo "tpm=\"on\"" >> "${CONF_FILE}" fi } function get_entries_() { local OS="$1" ARCH="$2" RELEASE="$3" OPERATION="$4" PUBLIC_DIR="$5" TEMPLATES_DIR="$6" local _out _url _out=$( (get_) 2>/dev/null ) _url=$(grep -oP 'https?://\S+' <<<"${_out}" | head -1) [ -z "${_url}" ] && return if [ "${OPERATION}" == "test" ]; then local _status _status=$(grep -oP '\bPASS\b|\bFAIL\b' <<<"${_out}" | tail -1) table_add_row "$OS" "$ARCH" "$RELEASE" "" "${_url}" "${_status:-FAIL}" printf '%s\t%s\t%s\t%s\t%s\n' \ "${ARCH}" "${RELEASE}" "-" "${_url}" "${_status:-FAIL}" \ >> "${PUBLIC_DIR}/tmp_${OS}.dat" else _emit_entry "${OS}" "${ARCH}" "${RELEASE}" "" "${_url}" "${OPERATION}" "${PUBLIC_DIR}" fi }