blob: 58e9313a7ab5a9707c167a5e0ba4605fb3fab5d7 (
plain)
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
|
#!/bin/sh
# (C) 2015 by Matteo Pasotti <matteo.pasotti@gmail.com>
# (C) 2015 by Marja van Waes <marja@mageia.org>
# License: GPLv3+
# This script needs bash, perl, rsync, unzip, wget
set -e
LANGS="ca cs de el en eo es et eu fr id nl pl pt_br ro ru sl sq sv tr uk"
DLPATH="http://docteam.mageia.nl/zipped/drakx-installer-help/"
DOCSRC="${DLPATH}"
txtbld=$(tput bold) # Bold
red=$(tput setaf 1) # red
blue=$(tput setaf 4) # blue
white=$(tput setaf 7) # white
bldred=${txtbld}${red} # Bold red
bldblue=${txtbld}${blue} # Bold blue
bldwhite=${txtbld}${white} # Bold white
txtrst=$(tput sgr0) # Reset
for lang in $LANGS;
do
lc_lang=`echo $lang | perl -e 'print lc <>;'`
if [[ "$lang" == "en" ]]; then
srcfile="en.zip"
destdir="."
continue
else
srcfile="${lc_lang}.zip"
destdir="$lc_lang"
echo "$bldwhite==$bldblue Checking for resource ${bldred}$uc_lang${bldblue} $txtrst"
set +e
check=`curl -s --head "${DLPATH}${srcfile}" | head -n 1 | grep "200 OK" > /dev/null ; echo $?`
set -e
if [[ "$check" != "0" ]];
then
# not found
echo "$bldwhite==$bldblue language: ${bldred}$uc_lang${bldblue} NOT available$txtrst"
continue
else
echo "$bldwhite==$bldblue language: ${bldred}$uc_lang${bldblue} available$txtrst"
echo "$bldwhite==$bldblue Downloading documentation archive for the language: ${bldred}$uc_lang${bldblue}...$txtrst"
wget -c "${DLPATH}${srcfile}"
fi
tmpdir="tmp_$lang"
mkdir $tmpdir
mv $srcfile $tmpdir
pushd $tmpdir
echo "$bldwhite==$bldblue Decompressing...$txtrst"
unzip -q $srcfile
echo "$bldwhite==$bldblue Sync trunk documentation...$txtrst"
rsync -a --exclude="*.zip" . ../$lang/
popd
echo "$bldwhite==$bldblue Removing temporary directory...$txtrst"
rm -fr $tmpdir
echo ""
fi
done
echo -e "$bldwhite==$bldblue WAIT BEFORE COMMITTING\nSee what's changed:$txtrst"
git status
echo "$bldwhite==$bldblue Completed $bname"
exit 0
|