37 lines
832 B
Bash
Executable File
37 lines
832 B
Bash
Executable File
#!/bin/bash
|
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
|
|
|
function display_help() {
|
|
uecho "$scriptname: faire un miroir d'un site web
|
|
|
|
USAGE
|
|
$scriptname [options] url [wget_options]
|
|
|
|
OPTIONS
|
|
-l
|
|
Convertir les liens pour consultation locale"
|
|
}
|
|
|
|
source "$(dirname "$0")/ulib/ulib" &&
|
|
urequire DEFAULTS ||
|
|
exit 1
|
|
|
|
local=
|
|
parse_opts + "${PRETTYOPTS[@]}" \
|
|
--help '$exit_with display_help' \
|
|
-l local=1 \
|
|
@ args -- "$@" && set -- "${args[@]}" || die "$args"
|
|
|
|
url="$1"; shift
|
|
[ -n "$url" ] || exit_with display_help
|
|
|
|
if ! ask_yesno -c "\
|
|
Voulez-vous télécharger et faire un mirroir du site${local:+ (les liens seront convertis pour consultation locale)}
|
|
'$url'?" O; then
|
|
exit 1
|
|
fi
|
|
|
|
args=(-m -p -np)
|
|
[ -n "$local" ] && args=("${args[@]}" -k -K)
|
|
wget "${args[@]}" "$@" "$url"
|