Add DietPi

This commit is contained in:
zenobit 2023-09-14 15:08:42 +02:00
parent 109c77148a
commit cdd0744fa1

View file

@ -42,6 +42,7 @@ function pretty_name() {
cachyos) PRETTY_NAME="CachyOS";; cachyos) PRETTY_NAME="CachyOS";;
centos-stream) PRETTY_NAME="CentOS Stream";; centos-stream) PRETTY_NAME="CentOS Stream";;
cereus) PRETTY_NAME="Cereus Linux";; cereus) PRETTY_NAME="Cereus Linux";;
dietpi) PRETTY_NAME="DietPi";;
dragonflybsd) PRETTY_NAME="DragonFlyBSD";; dragonflybsd) PRETTY_NAME="DragonFlyBSD";;
elementary) PRETTY_NAME="elementary OS";; elementary) PRETTY_NAME="elementary OS";;
endeavouros) PRETTY_NAME="EndeavourOS";; endeavouros) PRETTY_NAME="EndeavourOS";;
@ -195,6 +196,7 @@ function os_support() {
debian \ debian \
deepin \ deepin \
devuan \ devuan \
dietpi \
dragonflybsd \ dragonflybsd \
elementary \ elementary \
endeavouros \ endeavouros \
@ -354,6 +356,14 @@ function releases_devuan() {
echo beowulf chimaera echo beowulf chimaera
} }
function releases_dietpi() {
echo bios uefi
}
function editions_dietpi() {
echo bookworm bookworm-installer bullseye bullseye-installer
}
function releases_dragonflybsd() { function releases_dragonflybsd() {
# If you remove "".bz2" from the end of the searched URL, you will get only the current release - currently 6.4.0 # If you remove "".bz2" from the end of the searched URL, you will get only the current release - currently 6.4.0
# We could add a variable so this behaviour is optional/switchable (maybe from option or env) # We could add a variable so this behaviour is optional/switchable (maybe from option or env)
@ -904,6 +914,11 @@ EOF
echo "disk_size=\"32G\"" >> "${CONF_FILE}";; echo "disk_size=\"32G\"" >> "${CONF_FILE}";;
batocera) batocera)
echo "disk_size=\"8G\"" >> "${CONF_FILE}";; echo "disk_size=\"8G\"" >> "${CONF_FILE}";;
dietpi)
if [ "${RELEASE}" == "bios" ]; then
echo "boot=\"legacy\"" >> "${CONF_FILE}"
fi
;;
dragonflybsd|haiku|openbsd|netbsd|slackware|tails) dragonflybsd|haiku|openbsd|netbsd|slackware|tails)
echo "boot=\"legacy\"" >> "${CONF_FILE}";; echo "boot=\"legacy\"" >> "${CONF_FILE}";;
deepin) deepin)
@ -1263,6 +1278,42 @@ function get_devuan() {
echo "${URL}/${ISO} ${HASH}" echo "${URL}/${ISO} ${HASH}"
} }
function get_dietpi() {
local HASH=""
local ISO=""
local URL="https://dietpi.com/downloads/images"
case ${RELEASE} in
bios)
case ${EDITION} in
bookworm)
local ISO="DietPi_NativePC-BIOS-x86_64-Bookworm.7z"
;;
bullseye)
local ISO="DietPi_NativePC-BIOS-x86_64-Bullseye.7z"
;;
bookworm-installer)
local ISO="DietPi_NativePC-BIOS-x86_64-Bookworm_Installer.7z"
;;
bullseye-installer)
local ISO="DietPi_NativePC-BIOS-x86_64-Bullseye_Installer.7z"
;;
esac
;;
uefi)
case ${EDITION} in
bookworm-installer)
local ISO="DietPi_NativePC-UEFI-x86_64-Bookworm_Installer.7z"
;;
bullseye-installer)
local ISO="DietPi_NativePC-UEFI-x86_64-Bullseye_Installer.7z"
;;
esac
;;
esac
HASH=$(wget -q -O- "${URL}/SHASUMS.txt" | grep "${ISO}" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}"
}
function get_dragonflybsd() { function get_dragonflybsd() {
local HASH="" local HASH=""
local ISO="dfly-x86_64-${RELEASE}_REL.iso.bz2" local ISO="dfly-x86_64-${RELEASE}_REL.iso.bz2"
@ -2295,6 +2346,13 @@ create_vm() {
ISO="${ISO/.bz2/}" ISO="${ISO/.bz2/}"
fi fi
if [ ${OS} == "dietpi" ] && [[ $ISO =~ ".7z" ]]; then
7zip x -o${VM_PATH} ${VM_PATH}/${ISO}
ISO=$(ls ${VM_PATH} | grep -i '.iso')
fi
if [ ${OS} == "reactos" ] && [[ $ISO =~ ".zip" ]]; then if [ ${OS} == "reactos" ] && [[ $ISO =~ ".zip" ]]; then
unzip ${VM_PATH}/${ISO} -d ${VM_PATH} unzip ${VM_PATH}/${ISO} -d ${VM_PATH}
ISO=$(ls ${VM_PATH} | grep -i '.iso' | grep -v '.zip') ISO=$(ls ${VM_PATH} | grep -i '.iso' | grep -v '.zip')
@ -2355,7 +2413,16 @@ if [ -n "${2}" ]; then
fi fi
fi fi
# Handle odd missing fedora cominations # Handle odd missing dietpi combinations
if [[ $OS == dietpi ]] ; then
if [[ ${RELEASE} = "uefi" && ${EDITION} = "bookworm" ]] || [[ ${RELEASE} = "uefi" && ${EDITION} = "bullseye" ]] ; then
echo "ERROR! Unsupported combination"
echo "Only installers are supported for uefi, please choose another Release or Edition"
exit 1;
fi
fi
# Handle odd missing fedora combinations
if [[ $OS == fedora ]] ; then if [[ $OS == fedora ]] ; then
if [[ ${RELEASE} = "33" && ${EDITION} = "i3" ]] || [[ ${RELEASE} = "34" && ${EDITION} = "Cinnamon" ]] ; then if [[ ${RELEASE} = "33" && ${EDITION} = "i3" ]] || [[ ${RELEASE} = "34" && ${EDITION} = "Cinnamon" ]] ; then
echo "ERROR! Unsupported combination" echo "ERROR! Unsupported combination"