/usr/share/wit/load-titles.sh is in wit 2.31a-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | #!/usr/bin/env bash
#####################################################################
## __ __ _ ___________ ##
## \ \ / /| |____ ____| ##
## \ \ / / | | | | ##
## \ \ /\ / / | | | | ##
## \ \/ \/ / | | | | ##
## \ /\ / | | | | ##
## \/ \/ |_| |_| ##
## ##
## Wiimms ISO Tools ##
## http://wit.wiimm.de/ ##
## ##
#####################################################################
## ##
## This file is part of the WIT project. ##
## Visit http://wit.wiimm.de/ for project details and sources. ##
## ##
## Copyright (c) 2009-2015 by Dirk Clemens <wiimm@wiimm.de> ##
## ##
#####################################################################
## ##
## This file loads the title files from WiiTDB.com ##
## ##
#####################################################################
#------------------------------------------------------------------------------
NEEDED="wit wget tr"
BASE_PATH="/build/wit-bfKOK5/wit-2.31a/debian/wit/usr"
SHARE_PATH="/build/wit-bfKOK5/wit-2.31a/debian/wit/usr/share/wit"
URI_TITLES=http://gametdb.com/titles.txt
LANGUAGES="de es fr it ja ko nl pt ru zhcn zhtw"
SHARE_DIR=./share
#------------------------------------------------------------------------------
CYGWIN=0
if [[ $1 = --cygwin ]]
then
shift
CYGWIN=1
SHARE_DIR=.
export PATH=".:$PATH"
fi
#------------------------------------------------------------------------------
MAKE=0
if [[ $1 = --make ]]
then
# it's called from make
shift
MAKE=1
fi
#------------------------------------------------------------------------------
function load_and_store()
{
local URI="$1"
local DEST="$2"
local ADD="$3"
echo "*** load $DEST from $URI"
if wget -q -O- "$URI" | wit titles / - >"$DEST.tmp" && test -s "$DEST.tmp"
then
if [[ $ADD != "" ]]
then
wit titles / "$ADD" "$DEST.tmp" >"$DEST.tmp.2"
mv "$DEST.tmp.2" "$DEST.tmp"
fi
if [[ -s $DEST ]]
then
grep -v ^TITLES "$DEST" >"$DEST.tmp.1"
grep -v ^TITLES "$DEST.tmp" >"$DEST.tmp.2"
if ! diff -q "$DEST.tmp.1" "$DEST.tmp.2" >/dev/null
then
#echo " => content changed!"
mv "$DEST.tmp" "$DEST"
fi
else
mv "$DEST.tmp" "$DEST"
fi
fi
rm -f "$DEST.tmp" "$DEST.tmp.1" "$DEST.tmp.2"
}
#------------------------------------------------------------------------------
errtool=
for tool in $NEEDED
do
((CYGWIN)) && [[ -x $tool.exe ]] && continue
which $tool >/dev/null 2>&1 || errtool="$errtool $tool"
done
if [[ $errtool != "" ]]
then
echo "missing tools in PATH:$errtool" >&2
exit 2
fi
#------------------------------------------------------------------------------
mkdir -p "$SHARE_DIR"
load_and_store "$URI_TITLES" "$SHARE_DIR/titles.txt"
# load language specific title files
for lang in $LANGUAGES
do
LANG="$( echo $lang | tr '[a-z]' '[A-Z]' )"
load_and_store $URI_TITLES?LANG=$LANG "$SHARE_DIR/titles-$lang.txt" "$SHARE_DIR/titles.txt"
done
if (( !MAKE && !CYGWIN ))
then
echo "*** install titles to $SHARE_PATH"
mkdir -p "$SHARE_PATH"
cp -p "$SHARE_DIR"/titles*.txt "$SHARE_PATH"
fi
# remove a possible temp dir in SHARE_PATH
((CYGWIN)) || rm -rf "$SHARE_PATH/$SHARE_DIR"
|