From 80d8f2306805a91692d1c5ef4c40a9476071eccb Mon Sep 17 00:00:00 2001 From: Christopher Roy Bratusek Date: Sun, 7 Jul 2013 08:49:52 +0200 Subject: [PATCH] move nsmbw version-detection into a function (no duplicated code) --- script.d/anothersmb.sh | 20 +------------------- script.d/cannon.sh | 21 +-------------------- script.d/common.sh | 24 ++++++++++++++++++++++++ script.d/epicbowserworld.sh | 21 +-------------------- script.d/koopacountry.sh | 21 +-------------------- script.d/newerholiday.sh | 21 +-------------------- script.d/newersmb.sh | 20 +------------------- script.d/newersummersun.sh | 21 +-------------------- script.d/nsmbw4.sh | 21 +-------------------- 9 files changed, 32 insertions(+), 158 deletions(-) diff --git a/script.d/anothersmb.sh b/script.d/anothersmb.sh index 317ca10..95fef86 100644 --- a/script.d/anothersmb.sh +++ b/script.d/anothersmb.sh @@ -48,25 +48,7 @@ check_input_image_special () { detect_game_version () { - if [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232911 ]]; then - VERSION=EURv1 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_152101 ]]; then - VERSION=EURv2 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232303 ]]; then - VERSION=USAv1 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_143554 ]]; then - VERSION=USAv2 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_231655 ]]; then - VERSION=JPNv1 - REG_LETTER=J - elif [[ ! ${VERSION} ]]; then - echo -e "please specify your games version using --version={EURv1,USAv1,USAv2}" - exit 1 - fi + nsmbw_version GAMEID=SMN${REG_LETTER}05 CUSTOM_BANNER=http://dl.dropboxusercontent.com/u/101209384/${GAMEID}.bnr diff --git a/script.d/cannon.sh b/script.d/cannon.sh index bf173ce..9c3dbe9 100644 --- a/script.d/cannon.sh +++ b/script.d/cannon.sh @@ -46,26 +46,7 @@ check_input_image_special () { detect_game_version () { - - if [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232911 ]]; then - VERSION=EURv1 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_152101 ]]; then - VERSION=EURv2 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232303 ]]; then - VERSION=USAv1 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_143554 ]]; then - VERSION=USAv2 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_231655 ]]; then - VERSION=JPNv1 - REG_LETTER=J - elif [[ ! ${VERSION} ]]; then - echo -e "please specify your games version using --version={EURv1,EURv2,USAv1,USAv2,JPNv1}" - exit 1 - fi + nsmbw_version GAMEID=SMN${REG_LETTER}04 CUSTOM_BANNER=http://dl.dropboxusercontent.com/u/101209384/${GAMEID}.bnr diff --git a/script.d/common.sh b/script.d/common.sh index f5b388f..5f271e7 100644 --- a/script.d/common.sh +++ b/script.d/common.sh @@ -76,6 +76,30 @@ download_banner () { } +nsmbw_version () { + + if [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232911 ]]; then + VERSION=EURv1 + REG_LETTER=P + elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_152101 ]]; then + VERSION=EURv2 + REG_LETTER=P + elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232303 ]]; then + VERSION=USAv1 + REG_LETTER=E + elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_143554 ]]; then + VERSION=USAv2 + REG_LETTER=E + elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_231655 ]]; then + VERSION=JPNv1 + REG_LETTER=J + elif [[ ! ${VERSION} ]]; then + echo -e "please specify your games version using --version={EURv1,EURv2,USAv1,USAv2,JPNv1}" + exit 1 + fi + +} + apply_banner () { if [[ ${BANNER} != "" ]]; then diff --git a/script.d/epicbowserworld.sh b/script.d/epicbowserworld.sh index 925a846..2f80a76 100644 --- a/script.d/epicbowserworld.sh +++ b/script.d/epicbowserworld.sh @@ -43,26 +43,7 @@ check_input_image_special () { detect_game_version () { - - if [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232911 ]]; then - VERSION=EURv1 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_152101 ]]; then - VERSION=EURv2 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232303 ]]; then - VERSION=USAv1 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_143554 ]]; then - VERSION=USAv2 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_231655 ]]; then - VERSION=JPNv1 - REG_LETTER=J - elif [[ ! ${VERSION} ]]; then - echo -e "please specify your games version using --version={EURv1,EURv2,USAv1,USAv2,JPNv1}" - exit 1 - fi + nsmbw_version GAMEID=SMN${REG_LETTER}08 diff --git a/script.d/koopacountry.sh b/script.d/koopacountry.sh index b809feb..763a9a9 100644 --- a/script.d/koopacountry.sh +++ b/script.d/koopacountry.sh @@ -51,26 +51,7 @@ check_input_image_special () { detect_game_version () { - - if [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232911 ]]; then - VERSION=EURv1 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_152101 ]]; then - VERSION=EURv2 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232303 ]]; then - VERSION=USAv1 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_143554 ]]; then - VERSION=USAv2 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_231655 ]]; then - VERSION=JPNv1 - REG_LETTER=J - elif [[ ! ${VERSION} ]]; then - echo -e "please specify your games version using --version={EURv1,EURv2,USAv1,USAv2,JPNv1}" - exit 1 - fi + nsmbw_version GAMEID=SMN${REG_LETTER}10 diff --git a/script.d/newerholiday.sh b/script.d/newerholiday.sh index b98fd59..ff15ffa 100644 --- a/script.d/newerholiday.sh +++ b/script.d/newerholiday.sh @@ -47,26 +47,7 @@ check_input_image_special () { detect_game_version () { - - if [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232911 ]]; then - VERSION=EURv1 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_152101 ]]; then - VERSION=EURv2 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232303 ]]; then - VERSION=USAv1 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_143554 ]]; then - VERSION=USAv2 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_231655 ]]; then - VERSION=JPNv1 - REG_LETTER=J - elif [[ ! ${VERSION} ]]; then - echo -e "please specify your games version using --version={EURv1,EURv2,USAv1,USAv2,JPNv1}" - exit 1 - fi + nsmbw_version XML_FILE="${XML_FILE}"${REG_LETTER}.xml GAMEID=SMN${REG_LETTER}07 diff --git a/script.d/newersmb.sh b/script.d/newersmb.sh index 52aa6fc..de0405d 100644 --- a/script.d/newersmb.sh +++ b/script.d/newersmb.sh @@ -47,25 +47,7 @@ check_input_image_special () { detect_game_version () { - if [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232911 ]]; then - VERSION=EURv1 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_152101 ]]; then - VERSION=EURv2 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232303 ]]; then - VERSION=USAv1 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_143554 ]]; then - VERSION=USAv2 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_231655 ]]; then - VERSION=JPNv1 - REG_LETTER=J - elif [[ ! ${VERSION} ]]; then - echo -e "please specify your games version using --version={EURv1,EURv2,USAv1,USAv2,JPNv1}" - exit 1 - fi + nsmbw_version GAMEID=SMN${REG_LETTER}03 CUSTOM_BANNER=http://dl.dropboxusercontent.com/u/101209384/${GAMEID}.bnr diff --git a/script.d/newersummersun.sh b/script.d/newersummersun.sh index d5a762b..5ba16b3 100644 --- a/script.d/newersummersun.sh +++ b/script.d/newersummersun.sh @@ -46,26 +46,7 @@ check_input_image_special () { detect_game_version () { - - if [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232911 ]]; then - VERSION=EURv1 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_152101 ]]; then - VERSION=EURv2 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232303 ]]; then - VERSION=USAv1 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_143554 ]]; then - VERSION=USAv2 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_231655 ]]; then - VERSION=JPNv1 - REG_LETTER=J - elif [[ ! ${VERSION} ]]; then - echo -e "please specify your games version using --version={EURv1,EURv2,USAv1,USAv2,JPNv1}" - exit 1 - fi + nsmbw_version GAMEID=SMN${REG_LETTER}06 CUSTOM_BANNER=http://dl.dropboxusercontent.com/u/101209384/${GAMEID}.bnr diff --git a/script.d/nsmbw4.sh b/script.d/nsmbw4.sh index bf5d47d..a1bc10d 100644 --- a/script.d/nsmbw4.sh +++ b/script.d/nsmbw4.sh @@ -42,26 +42,7 @@ check_input_image_special () { detect_game_version () { - - if [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232911 ]]; then - VERSION=EURv1 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_152101 ]]; then - VERSION=EURv2 - REG_LETTER=P - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_232303 ]]; then - VERSION=USAv1 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2010-01-05_143554 ]]; then - VERSION=USAv2 - REG_LETTER=E - elif [[ -f ${WORKDIR}/files/COPYDATE_LAST_2009-10-03_231655 ]]; then - VERSION=JPNv1 - REG_LETTER=J - elif [[ ! ${VERSION} ]]; then - echo -e "please specify your games version using --version={EURv1,EURv2,USAv1,USAv2,JPNv1}" - exit 1 - fi + nsmbw_version GAMEID=SMN${REG_LETTER}11