bin sh -e MAPS nsk Novosibirsk omsk Omsk tomsk Tomsk OUTDIR HOME wine

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh -e
MAPS="nsk|Novosibirsk omsk|Omsk tomsk|Tomsk"
OUTDIR="$HOME/.wine/drive_c/Program Files/2gis/3.0/"
# -- -- --
TMPDIR=$(mktemp -d -t update_2gis.XXXXXXXX)
trap cleanup 0 HUP INT QUIT ILL ABRT FPE KILL SEGV PIPE ALRM USR1 USR2 BUS PROF SYS TRAP XCPU XFSZ
cleanup() {
rm -rf "$TMPDIR"
}
for m in $MAPS; do
ARCHNAME=${m%|*}
wget --quiet -O "$TMPDIR/$ARCHNAME.zip" "http://fresh.2gis.ru/distributive/$ARCHNAME/last/"
(cd "$OUTDIR"; rm -f 2GISData_${m#*|}-*.dgdat; unzip -q -o "$TMPDIR/$ARCHNAME.zip")
rm -f "$TMPDIR/$ARCHNAME.zip"
done