nutools/lib/tiddlywiki/download-latest.sh

33 lines
1005 B
Bash
Raw Permalink Normal View History

2013-08-27 15:14:44 +04:00
#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
2014-07-07 22:06:38 +04:00
source "$(dirname "$0")/../../lib/ulib/ulib" || exit 1
urequire DEFAULTS tiddlywiki
2013-08-27 15:14:44 +04:00
function display_help() {
echo "$scriptname: Télécharger la dernière version de TiddlyWiki"
}
parse_opts "${PRETTYOPTS[@]}" \
--help '$exit_with display_help' \
@ args -- "$@" && set -- "${args[@]}" || die "$args"
cd "$scriptdir"
tmpfile="empty.html.$$"
autoclean "$tmpfile"
estep "Téléchargement de la dernière version"
wget -q -O "$tmpfile" http://www.tiddlywiki.com/empty.html || die
if testdiff "$tmpfile" empty.html; then
version="$(get_version "$tmpfile")"
estep "Une nouvelle version est disponible ($version)"
read_value -i "Confirmez le numéro de version" version "$version"
versionfile="empty-$version.html"
/bin/mv "$tmpfile" "$versionfile"
/bin/cp -f "$versionfile" empty.html
else
estep "La dernière version $(get_version empty.html) est déjà disponible en local"
fi