summaryrefslogtreecommitdiff
path: root/mirror.sh
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-01-01 02:59:57 +0100
committerAki <please@ignore.pl>2024-01-01 02:59:57 +0100
commite86cd131bca23ecb8eb3433f8cb7b2878ab99f7d (patch)
treefb59e18ab0957f778b24b8a0a282c2dd5c0e427e /mirror.sh
parent1b5c9e71c96a8711b9b254a2025a19d2b5601ab0 (diff)
downloadmirror-e86cd131bca23ecb8eb3433f8cb7b2878ab99f7d.zip
mirror-e86cd131bca23ecb8eb3433f8cb7b2878ab99f7d.tar.gz
mirror-e86cd131bca23ecb8eb3433f8cb7b2878ab99f7d.tar.bz2
Added -n for dry run mode
Diffstat (limited to 'mirror.sh')
-rw-r--r--mirror.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/mirror.sh b/mirror.sh
index 88ed524..118d2a4 100644
--- a/mirror.sh
+++ b/mirror.sh
@@ -6,7 +6,7 @@ _version() {
_usage() {
- echo "Usage: $0 [-v] [repositories]"
+ echo "Usage: $0 [-vn] [repositories]"
exit 1
} >&2
@@ -53,17 +53,18 @@ _update() {
local path="$(_path ${repo})"
test -d "${path}" || git clone -q --mirror "${repo}" "${path}" || return 1 # TODO: Check if remotes are the same?
if git -C "${path}" fetch -q; then
- echo "Updated ${path}"
+ echo "Updated: ${path}"
else
- echo "Failed to update ${path}" >&2
+ echo "Failed to update: ${path}" >&2
return 1
fi
}
-while getopts :v opt; do
+while getopts :vn opt; do
case ${opt} in
v) _version;;
+ n) _update() { echo "Would update: $(_path $1)"; };;
?) _usage;;
esac
done