Initial attempt at supporting Ubuntu Server

Pros:

- Supports Ubuntu Server 20.04+

Cons:

- Ugh, for some reason, keeps defaulting to the desktop/live branch
- The configuration isn't created either.
This commit is contained in:
funk-on-code 2022-09-27 07:10:01 +00:00 committed by GitHub
parent 7db5167cac
commit 52aaa9bd32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,6 +62,7 @@ function pretty_name() {
ubuntu-budgie) PRETTY_NAME="Ubuntu Budgie";;
ubuntukylin) PRETTY_NAME="Ubuntu Kylin";;
ubuntu-mate) PRETTY_NAME="Ubuntu MATE";;
ubuntu-server) PRETTY_NAME="Ubuntu Server";;
ubuntustudio) PRETTY_NAME="Ubuntu Studio";;
void) PRETTY_NAME="Void Linux";;
zorin) PRETTY_NAME="Zorin OS";;
@ -77,6 +78,7 @@ function validate_release() {
DISPLAY_NAME="$(pretty_name "${OS}")"
case ${OS} in
ubuntu-server) RELEASE_GENERATOR="releases_ubuntuserver";;
*ubuntu*) RELEASE_GENERATOR="releases_ubuntu";;
*) RELEASE_GENERATOR="${1}";;
esac
@ -205,6 +207,7 @@ function os_support() {
ubuntu-budgie \
ubuntukylin \
ubuntu-mate \
ubuntu-server \
ubuntustudio \
void \
windows \
@ -470,6 +473,10 @@ function releases_tails() {
echo stable
}
function releases_ubuntuserver() {
echo live-server-20.04 live-server-22.04
}
function releases_ubuntu() {
local LTS_SUPPORT="14.04 16.04 18.04 20.04 22.04"
case "${OS}" in
@ -1434,6 +1441,16 @@ function get_ubuntu() {
URL="https://cdimage.ubuntu.com/${OS}/releases/${RELEASE}/release"
fi
if [ "${RELEASE}" == "ubuntu-server" ]; then
if wget -q --spider "${URL}/SHA256SUMS"; then
ISO=$(wget -q -O- "${URL}/SHA256SUMS" | grep 'live-server\|install' | grep amd64 | grep iso | cut -d'*' -f2)
HASH=$(wget -q -O- "${URL}/SHA256SUMS" | grep 'live-server\|install' | grep amd64 | grep iso |cut -d' ' -f1)
else
ISO=$(wget -q -O- "${URL}/MD5SUMS" | grep 'live-server\|install' | grep amd64 | grep iso | cut -d' ' -f3)
HASH=$(wget -q -O- "${URL}/MD5SUMS" | grep 'live-server|install' | grep amd64 | grep iso | cut -d' ' -f1)
fi
else
if wget -q --spider "${URL}/SHA256SUMS"; then
ISO=$(wget -q -O- "${URL}/SHA256SUMS" | grep 'desktop\|dvd\|install' | grep amd64 | grep iso | cut -d'*' -f2)
HASH=$(wget -q -O- "${URL}/SHA256SUMS" | grep 'desktop\|dvd\|install' | grep amd64 | grep iso |cut -d' ' -f1)
@ -1441,7 +1458,7 @@ function get_ubuntu() {
ISO=$(wget -q -O- "${URL}/MD5SUMS" | grep 'desktop\|dvd\|install' | grep amd64 | grep iso | cut -d' ' -f3)
HASH=$(wget -q -O- "${URL}/MD5SUMS" | grep 'desktop\|dvd\|install' | grep amd64 | grep iso | cut -d' ' -f1)
fi
#echo "${URL}/${ISO} ${HASH}"
fi
if [[ "${RELEASE}" == *"daily"* ]] || [ "${RELEASE}" == "dvd" ]; then
zsync_get "${URL}/${ISO}" "${VM_PATH}" "${OS}-devel.iso"
@ -1965,6 +1982,10 @@ if [ -n "${2}" ]; then
# macOS doesn't use create_vm()
validate_release releases_macos
get_macos
elif [[ "${OS}" == "ubuntuserver" ]]; then
# Ubuntu doesn't use create_vm()
validate_release releases_ubuntuserver
get_ubuntu
elif [[ "${OS}" == *"ubuntu"* ]]; then
# Ubuntu doesn't use create_vm()
validate_release releases_ubuntu
@ -1995,6 +2016,10 @@ if [ -n "${2}" ]; then
else
echo "ERROR! You must specify a release."
case ${OS} in
*ubuntu-server*)
echo -n " - Releases: "
releases_ubuntuserver | sed -Ee 's/eol-\S+//g' # hide eol releases
;;
*ubuntu*)
echo -n " - Releases: "
releases_ubuntu | sed -Ee 's/eol-\S+//g' # hide eol releases