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

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