123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- #!/bin/bash
- SELF_PATH="$(dirname $(realpath "$0"))"
- CACHE_PATH="${SELF_PATH}/cache"
- DL_PATH="${CACHE_PATH}/dl"
- EXTRACT_PATH="${CACHE_PATH}/extract"
- TMP_PATH="${CACHE_PATH}/tmp"
- FILES=( \
- "Jazz2swc.exe::http://discmaster.textfiles.com/file/23917/PC%20Gamer%20IT%20CD%2031%202-2.iso/jazz2/Jazz2swc.exe" \
- "jazz2swf.exe::http://discmaster.textfiles.com/file/24033/1998-07_Disc_4.1.iso/jazz2/jazz2swf.exe" \
- "Battery_Check_SETUP.EXE::https://archive.org/download/BATTERYCHECK/SETUP.EXE" \
- #"Jazz2swf.exe::http://discmaster.textfiles.com/file/10572/TOP100WIN98.iso/100win98/Install/jazzjack/Jazz2swf.exe" \
- "JAZZ2SWF.EXE::http://discmaster.textfiles.com/file/22548/GAMBLERCD19.BIN/DEMOS/JAZZJAC2/JAZZ2SWF.EXE" \
- "J2swc123.exe::http://discmaster.textfiles.com/file/24044/1998-12_Disc_4.6.bin/JAZZ2/J2swc123.exe" \
- "JazzJackrabbit2.exe::http://discmaster.textfiles.com/file/21986/PowerPlay0599.bin/Demos/JazzJackrabbit2.exe" \
- "Jumbo_Puzzel_Setup.exe::http://discmaster.textfiles.com/file/13787/Jumbo%20Cartoon.bin/Setup/Setup.exe" \
- "Jumbo_Puzzel_Setup2000.exe::http://discmaster.textfiles.com/file/13787/Jumbo%20Cartoon.bin/Setup/Setup2000.exe" \
- "Melk_gamefull.exe::https://archive.org/download/melk-the-game/gamefull.exe" \
- "Melk_patch.exe::https://archive.org/download/melk-the-game/patch.exe" \
- "Melk_upgrade.exe::https://archive.org/download/melk-the-game/upgrade.exe" \
- "Melk_gamelight.exe::https://archive.org/download/melk-the-game/gamelight.exe"
- )
- SHA256_SUMS=( \
- "f05c9f0ddc6a9fafa96140e1bb7707e38124babf79f94cf9df2f49baae9fca11" \
- "ce1bfbc7727a6ff03ba461ad5fdc7c292d3b90924baaf6111d7bbfecf7a55231" \
- "ed748389be06131ed9df2f28294707ea3926f408c40733e95c34656b86be34b3" \
- #"cd3beccbfd03dab477ca648418b23d3d337fa5a03aaacd25ca9b7f2fdabe05c9" \ # Corrupt
- "3d2c2cf6f9d44811ebceab4a3757e078ceff22f45cade97b362c414fb5a1360d" \
- "ad06659d6057b7c696889fc194d2c651320b8a2ed8d989d4a602df4b0df551f7" \
- "8cb81307d4121718e488f8dbc513eae9126dee5a4a77932e1d7c25de61479f4a" \
- "e04235bc0447b26580febcf69926b91a2e68f47c27166aefcf881af45861d93a" \
- "4d577083e1c37070ce71ee846bb1f483abc21d145851aaa226a5d3cde60c7d2c" \
- "3655e8f5460cf339423be888bd9d2709f0c7b20822fd84571d49c13afedf0b9b" \
- "92c3c1ae25bcbd718dd6b9917714d769e72ca986df9c371f4011e9a72dc4f5eb" \
- "0fa9a6dfc2a951bbcd61f0f16cc700c9c0922f7cbdf6f2617dbf7fd6d54f56a8" \
- "dba618ba99c1a0ee692f040a13944677207973acbbfd57c8fd68a4d202e92059"
- )
- dl_installer() {
- FILEPATH="$1"
- URL="$2"
- wget --quiet -O "${FILEPATH}" "${URL}"
- if [[ "$?" -ne "0" ]]; then
- echo "Failed"
- exit 1
- fi
- }
- verify_installer() {
- SHASUM="$1"
- FILEPATH="$2"
- sha256sum --quiet -c - <<< "${SHASUM} ${FILEPATH}"
- if [[ "$?" -ne "0" ]]; then
- echo "Mismatch"
- exit 1
- fi
- }
- clear_extract_dir() {
- rm -rf "${EXTRACT_PATH}" && mkdir "${EXTRACT_PATH}"
- }
- # Create cache dirs
- if [[ ! -d "${DL_PATH}" ]]; then
- mkdir -p "${DL_PATH}"
- fi
- if [[ ! -d "${EXTRACT_PATH}" ]]; then
- mkdir "${EXTRACT_PATH}"
- fi
- if [[ ! -d "${TMP_PATH}" ]]; then
- mkdir "${TMP_PATH}"
- fi
- # cd into SELF_PATH so didiextract can be found by ../didiextract
- cd "${SELF_PATH}"
- # Make sure didiextract is present.
- if [[ ! -f "../didiextract" ]]; then
- echo "DiDi Extract (${SELF_PATH}/../didiextract) not found."
- exit 1
- fi
- for i in ${!FILES[@]}; do
- FILE="${FILES[i]}"
- FILENAME="${FILE%%::*}"
- FILEURL="${FILE#*::}"
- FILEPATH="${DL_PATH}/${FILENAME}"
- echo "TEST ${FILENAME}"
- echo "-------------------------------------------------------------"
- # Make sure the installer file is present, else download it.
- if [[ ! -f "${FILEPATH}" ]]; then
- echo -n "DOWNLOAD file : "
- dl_installer "${FILEPATH}" "${FILEURL}"
- echo "OK"
- fi
- # Verify installer file its sha256.
- echo -n "CHECK file integrity : "
- verify_installer "${SHA256_SUMS[i]}" "${FILEPATH}"
- echo "OK"
- # Test --verify
- # This assumes DiDi Extract will exit accordingly.
- echo -n "CHECK didiextract verify : "
- ../didiextract --verify --silent "${FILEPATH}"
- if [[ $? -ne 0 ]]; then
- echo "Failed"
- exit 2
- fi
- echo "OK"
- # Test --extract
- echo -n "CHECK didiextract extract : "
- ../didiextract --extract "${EXTRACT_PATH}" --silent "${FILEPATH}"
- if [[ $? -ne 0 ]]; then
- echo "Failed"
- clear_extract_dir
- exit 2
- fi
- # Match sha256 sums of extracted files.
- (
- cd "${EXTRACT_PATH}"
- sha256sum --quiet -c "${SELF_PATH}/sums/${FILENAME}.sha256"
- if [[ $? -ne 0 ]]; then
- echo "Mismatch"
- #clear_extract_dir
- exit 1
- fi
- )
- echo "OK"
- clear_extract_dir
- echo "-------------------------------------------------------------"
- echo ""
- done
- echo "All seems OK! :-D"
- exit 0
|