refactor(quickget): special case image processing shellcheck compliant

This commit is contained in:
Martin Wimpress 2024-05-07 10:58:08 +01:00 committed by Martin Wimpress
parent 31de07fb9c
commit 1e05e7a3b2
1 changed files with 30 additions and 26 deletions

View File

@ -3369,31 +3369,35 @@ function create_vm() {
check_hash "${ISO}" "${HASH}"
fi
if [ ${OS} == "freedos" ] && [[ ${ISO} =~ ".zip" ]]; then
unzip ${VM_PATH}/${ISO} -d ${VM_PATH}
ISO=$(ls ${VM_PATH} | grep -i '.iso')
fi
if [[ ${OS} == "batocera" ]] && [[ ${ISO} =~ ".gz" ]]; then
case "${OS}" in
batocera)
if [[ ${ISO} = *".gz"* ]]; then
gzip -d "${VM_PATH}/${ISO}"
ISO="${ISO/.gz/}"
fi
fi;;
dragonflybsd)
# Could be other OS iso files compressed with bzip2 or gzip
# but for now we'll keep this to know cases
if [[ ${OS} == "dragonflybsd" ]] && [[ ${ISO} =~ ".bz2" ]]; then
if [[ ${ISO} = *".bz2"* ]]; then
bzip2 -d "${VM_PATH}/${ISO}"
ISO="${ISO/.bz2/}"
fi
if [[ ${OS} == "easyos" ]] && [[ ${ISO} =~ ".img" ]]; then
fi;;
easyos)
if [[ ${ISO} = *".img"* ]]; then
qemu-img convert -f raw -O qcow2 "${VM_PATH}/${ISO}" "${VM_PATH}/disk.qcow2"
ISO="${ISO/.img/}"
fi
if [ ${OS} == "reactos" ] && [[ ${ISO} =~ ".zip" ]]; then
fi;;
freedos)
if [[ ${ISO} = *".zip"* ]]; then
unzip ${VM_PATH}/${ISO} -d ${VM_PATH}
ISO=$(ls ${VM_PATH} | grep -i '.iso')
fi;;
reactos)
if [[ ${ISO} = *".zip"* ]]; then
unzip ${VM_PATH}/${ISO} -d ${VM_PATH}
ISO=$(ls ${VM_PATH} | grep -i '.iso' | grep -v '.zip')
fi
fi;;
esac
make_vm_config "${ISO}"
}