diff options
author | Marja van Waes <marja@mageia.org> | 2015-02-02 11:57:39 +0100 |
---|---|---|
committer | Marja van Waes <marja@mageia.org> | 2015-02-02 11:57:39 +0100 |
commit | 551b0553cbe4c0134508baae36c8c6871f731d69 (patch) | |
tree | e5ae4e596cdeba631e7470cac8a8b197a739ffd0 | |
parent | 6537bc979213e206538577417104005295e9cf76 (diff) | |
download | drakx-installer-help-551b0553cbe4c0134508baae36c8c6871f731d69.tar drakx-installer-help-551b0553cbe4c0134508baae36c8c6871f731d69.tar.gz drakx-installer-help-551b0553cbe4c0134508baae36c8c6871f731d69.tar.bz2 drakx-installer-help-551b0553cbe4c0134508baae36c8c6871f731d69.tar.xz drakx-installer-help-551b0553cbe4c0134508baae36c8c6871f731d69.zip |
add update script (thx pasmatt)
-rwxr-xr-x | update-help_files.sh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/update-help_files.sh b/update-help_files.sh new file mode 100755 index 0000000..58e9313 --- /dev/null +++ b/update-help_files.sh @@ -0,0 +1,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 |