Skip to content

Commit

Permalink
Appease shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
NateChoe1 committed Dec 8, 2023
1 parent 4fdb3d5 commit c2054a4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/disk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,16 @@ addDisk () {
[ ! -d "${DIR}" ] && return 0

if ! [ -f "${DISK_FILE}" ] ; then
local OTHER_FORMS="$(find "${DIR}" -maxdepth 1 | sed -n -- "/\/${DISK_ROOT}\./p" | sed -- "/\.${DISK_EXT}$/d")"
local OTHER_FORMS
OTHER_FORMS="$(find "${DIR}" -maxdepth 1 | sed -n -- "/\/${DISK_ROOT}\./p" | sed -- "/\.${DISK_EXT}$/d")"

if ! [[ -z "${OTHER_FORMS}" ]] ; then
local SOURCE_FILE="$(echo "${OTHER_FORMS}" | head -n1)"
local SOURCE_EXT="$(echo "${SOURCE_FILE}" | sed 's/^.*\.//')"
local SOURCE_FMT="$(ext2fmt "${SOURCE_EXT}")"
local SOURCE_FILE
local SOURCE_EXT
local SOURCE_FMT
SOURCE_FILE="$(echo "${OTHER_FORMS}" | head -n1)"
SOURCE_EXT="$(echo "${SOURCE_FILE}" | sed 's/^.*\.//')"
SOURCE_FMT="$(ext2fmt "${SOURCE_EXT}")"
info "Other disk formats detected for ${DISK_DESC} (${OTHER_FORMS//$'\n'/, }), converting ${SOURCE_FILE}"
if ! convertDisk "${SOURCE_FILE}" "${SOURCE_FMT}" "${DISK_FILE}" "${DISK_FMT}" ; then
info "Disk conversion failed, creating new disk image as fallback"
Expand Down

0 comments on commit c2054a4

Please sign in to comment.