Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 197 lines (170 sloc) 3.371 kb
#!/bin/sh
# process all languages
ERROR()
{
echo error: $*
exit 1
}
USAGE()
{
[ -z "$1" ] || echo error: $*
echo usage: $(basename "$0") '<options> <command>'
echo ' --help -h This message'
echo ' --brief -b Brief output (for analyse)'
echo ' --verbose -v Display messages'
echo 'commands:'
echo ' help This message'
echo ' link Move all symlinks to latest versions'
echo ' run Rebuild all'
echo ' cjk Rebuild ko,ja,zh'
echo ' en Rebuild short for en:pedia (or other two letter language code)'
echo ' en:dict Rebuild specific item (<lang>:<type>)'
echo ' ja,es:dict,da Rebuild several items (comma separated list)'
echo ' analyse Show summary of logs'
echo ' get Combine and fetch all recently rendered data'
exit 1
}
# main program
verbose=no
brief=no
debug=no
getopt=/usr/local/bin/getopt
[ -x "${getopt}" ] || getopt=getopt
args=$(${getopt} -o hvbd --long=help,verbose,brief,debug -- "$@") ||exit 1
# replace the arguments with the parsed values
eval set -- "${args}"
while :
do
case "$1" in
-v|--verbose)
verbose=yes
shift
;;
-b|--brief)
brief=yes
shift
;;
-d|--debug)
debug=yes
shift
;;
--)
shift
break
;;
-h|--help)
USAGE
;;
*)
USAGE invalid option: $1
;;
esac
done
AllItems='
cy
de
de:dict
da
el
en::::::-2
en:appro
en:dict
en:how
en:quote
en:trav
en:starw
es
es:dict
fi
fr
fr:dict
hu
it
ja
ko
nl
no
pl
pt
ru
sr
sv
tr
zh
'
AllLanguages=
AllCSV=
for item in ${AllItems}
do
AllCSV="${AllCSV},${item}"
lang="${item%%:*}"
eval flag="\${lf_${lang}}"
if [ X"${flag}" = X"" ]
then
eval lf_${lang}="${lang}"
AllLanguages="${AllLanguages} ${lang}"
fi
done
AllLanguages="${AllLanguages## }"
AllCSV="${AllCSV##,}"
[ $# -eq 0 ] && USAGE missing command
for command in $@
do
case "${command}" in
help)
USAGE
;;
# command to rebuild all
run)
progress -z 16:128ki -r "${AllCSV}"
;;
# Chinese, Japanese, Korean
cjk)
progress -z 16:128ki -r 'ja,ko,zh'
;;
# retrieve all data
get)
for l in ${AllItems}
do
progress -L"${l}" -c -G
done
;;
# link all data
link)
for l in ${AllLanguages}
do
progress -L"${l}" -x
done
;;
# analyse
analyse)
for l in ${AllItems}
do
echo Analysis for: ${l}
if [ X"${brief}" = X"yes" ]
then
progress -L"${l}" -a | egrep '(^Analysis|Completion:)'
else
progress -L"${l}" -a
fi
done
;;
# en is the exception (reduce the number of threads)
en)
progress -z 16:128ki -r en::::::-2
;;
rr-en|rren)
progress -z 16:128ki --re-render en::::::-2
;;
# run only one language
[a-z][a-z]|[a-z][a-z]:*)
progress -z 16:128ki -r "${command}"
;;
# re-render an already built English Wikipedia to fit into 4GB
en4gb|en4GB)
progress --re-render en:::NO:255:350000:-2:20000
;;
*)
ERROR invalid command: ${command}
esac
done
Jump to Line
Something went wrong with that request. Please try again.