Fix dietpi and make it dynamic

This commit is contained in:
zenobit 2025-03-03 12:44:32 +01:00
parent 29894efe6f
commit dccea3891b
2 changed files with 7 additions and 50 deletions

View File

@ -11,7 +11,7 @@ function releases_() {
} }
function editions_() { function editions_() {
echo bookworm bookworm-installer bullseye bullseye-installer echo $(web_pipe "https://dietpi.com/downloads/images/" | grep '\.iso"' | cut -d'"' -f2 | grep '_VM-UEFI' | cut -d'-' -f4 | cut -d'_' -f1)
} }
function get_() { function get_() {
@ -19,38 +19,16 @@ function get_() {
local ISO="" local ISO=""
local URL="https://dietpi.com/downloads/images" local URL="https://dietpi.com/downloads/images"
if [ "${RELEASE}" == 'bios' ]; then if [ "${RELEASE}" == 'bios' ]; then
case ${EDITION} in local ISO="DietPi_VM-x86_64-${EDITION}_Installer.iso"
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
elif [ "${RELEASE}" == 'uefi' ]; then elif [ "${RELEASE}" == 'uefi' ]; then
case ${EDITION} in local ISO="DietPi_VM-UEFI-x86_64-${EDITION}_Installer.iso"
'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
fi fi
HASH=$(wget -q -O- "${URL}/SHASUMS.txt" | grep "${ISO}" | cut -d' ' -f1) HASH=$(wget -q -O- "${URL}/SHASUMS.txt" | grep "${ISO}" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}" echo "${URL}/${ISO} ${HASH}"
} }
function distro_specific() {
if [[ "${ISO}" =~ ".7z" ]]; then
7zip x -o${VM_PATH} ${VM_PATH}/${ISO}
ISO=$(ls ${VM_PATH} | grep -i '.iso')
fi
}
function specific_tweaks() { function specific_tweaks() {
if [[ "${RELEASE}" == 'bios' ]]; then if [[ "${RELEASE}" == 'bios' ]]; then
echo "boot=\"legacy\"" >> "${CONF_FILE}" echo "boot=\"legacy\"" >> "${CONF_FILE}"
fi fi
} }

View File

@ -8,14 +8,14 @@ CREDENTIALS="-"
RELEASES="uefi bios" RELEASES="uefi bios"
EDITIONS="bullseye-installer bullseye bookworm-installer bookworm" EDITIONS="Trixie Bullseye Bookworm"
function releases_() { function releases_() {
echo bios uefi echo bios uefi
} }
function editions_() { function editions_() {
echo bookworm bookworm-installer bullseye bullseye-installer echo $(web_pipe "https://dietpi.com/downloads/images/" | grep '\.iso"' | cut -d'"' -f2 | grep '_VM-UEFI' | cut -d'-' -f4 | cut -d'_' -f1)
} }
function get_() { function get_() {
@ -23,35 +23,14 @@ function get_() {
local ISO="" local ISO=""
local URL="https://dietpi.com/downloads/images" local URL="https://dietpi.com/downloads/images"
if [ "${RELEASE}" == 'bios' ]; then if [ "${RELEASE}" == 'bios' ]; then
case ${EDITION} in local ISO="DietPi_VM-x86_64-${EDITION}_Installer.iso"
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
elif [ "${RELEASE}" == 'uefi' ]; then elif [ "${RELEASE}" == 'uefi' ]; then
case ${EDITION} in local ISO="DietPi_VM-UEFI-x86_64-${EDITION}_Installer.iso"
'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
fi fi
HASH=$(wget -q -O- "${URL}/SHASUMS.txt" | grep "${ISO}" | cut -d' ' -f1) HASH=$(wget -q -O- "${URL}/SHASUMS.txt" | grep "${ISO}" | cut -d' ' -f1)
echo "${URL}/${ISO} ${HASH}" echo "${URL}/${ISO} ${HASH}"
} }
function distro_specific() {
if [[ "${ISO}" =~ ".7z" ]]; then
7zip x -o${VM_PATH} ${VM_PATH}/${ISO}
ISO=$(ls ${VM_PATH} | grep -i '.iso')
fi
}
function specific_tweaks() { function specific_tweaks() {
if [[ "${RELEASE}" == 'bios' ]]; then if [[ "${RELEASE}" == 'bios' ]]; then
echo "boot=\"legacy\"" >> "${CONF_FILE}" echo "boot=\"legacy\"" >> "${CONF_FILE}"