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