From b9b1a7942b3721ee80729bff31ab64d77f418e2b Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Sat, 6 Aug 2016 21:08:16 +0200 Subject: [PATCH] fixup image and rom detection (really now) --- scripts/common.sh | 48 +++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/scripts/common.sh b/scripts/common.sh index 01c23fe..5c17319 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -220,18 +220,23 @@ check_input_image () { x=0 if [[ ! ${IMAGE} ]]; then - if test -f "${WBFS_MASK}".wbfs; then + WBFS0=$(find . -maxdepth 1 -name "${WBFS_MASK}".wbfs) + WBFS1=$(find "${PATCHIMAGE_WBFS_DIR}" -name "${WBFS_MASK}".wbfs) + ISO0=$(find . -maxdepth 1 -name "${WBFS_MASK}".iso) + ISO1=$(find "${PATCHIMAGE_WBFS_DIR}" -name "${WBFS_MASK}".iso) + + if [[ -f ${WBFS0} ]]; then x=1 - IMAGE="${WBFS_MASK}".wbfs - elif test -f "${WBFS_MASK}".iso; then + IMAGE=${WBFS0} + elif [[ -f ${ISO0} ]]; then x=2 - IMAGE="${WBFS_MASK}".iso - elif test -f "${PATCHIMAGE_WBFS_DIR}"/"${WBFS_MASK}".iso; then + IMAGE=${ISO0} + elif [[ -f ${WBFS1} ]]; then x=3 - IMAGE="${PATCHIMAGE_WBFS_DIR}"/"${WBFS_MASK}".iso - elif test -f "${PATCHIMAGE_WBFS_DIR}"/"${WBFS_MASK}".wbfs; then + IMAGE=${WBFS1} + elif [[ -f ${ISO1} ]]; then x=4 - IMAGE="${PATCHIMAGE_WBFS_DIR}"/"${WBFS_MASK}".wbfs + IMAGE=${ISO1} else echo -e "please specify image to use with --iso=" exit 15 @@ -239,30 +244,33 @@ check_input_image () { fi echo "*** >> status: ${x}" + IMAGE=$(readlink -m "${IMAGE}") + } check_input_rom () { x=5 if [[ ! ${ROM} ]]; then - ROM=$(find . -name "${ROM_MASK}" | sed -e 's,./,,') - if [[ -f ${ROM} ]]; then + ROM0=$(find . -maxdepth 1 -name "${ROM_MASK}") + ROM1=$(find "${PATCHIMAGE_3DS_DIR}" -name "${ROM_MASK}") + + if [[ -f ${ROM0} ]]; then x=6 - ROM="${ROM}" + ROM=${ROM0} + elif [[ -f ${ROM1} ]]; then + x=7 + ROM=${ROM1} else - ROM=$(find "${PATCHIMAGE_3DS_DIR}" -name "${ROM_MASK}") - if [[ -f ${ROM} ]]; then - x=7 - ROM="${ROM}" - else - if [[ ! ${HANS_MULTI_SOURCE} ]]; then - echo -e "error: could not find suitable ROM, specify using --rom" - exit 15 - fi + if [[ ! ${HANS_MULTI_SOURCE} ]]; then + echo -e "error: could not find suitable ROM, specify using --rom" + exit 15 fi fi fi echo "*** >> status: ${x}" + + ROM=$(readlink -m "${ROM}") } show_nsmb_db () {