nutools/lib/tiddlywiki/download-latest.sh

36 lines
1018 B
Bash
Executable File

#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
source "$(dirname "$0")/../../ulib/ulib" &&
urequire DEFAULTS tiddlywiki ||
exit 1
OENC="$UTF8"
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