diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-07-05 12:26:04 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-07-05 12:26:04 +0200 |
commit | e8030f5237cf018b1ae34245508acdd39ad01e0f (patch) | |
tree | eaa9c16a06ae55f7f061714f2f5e9d930099a5de |
Import
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rwxr-xr-x | mirrorit | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mirrorit b/mirrorit new file mode 100755 index 0000000..bb1bd9c --- /dev/null +++ b/mirrorit @@ -0,0 +1,18 @@ +#!/nix/store/9ywr69qi622lrmx5nn88gk8jpmihy0dz-bash-4.4-p23/bin/bash + +repository_url="$1" +repository_destination="$2" + +fail() { + echo >&2 "$*" + exit 1 +} + +if [ -d "$repository_destination" ]; then + cd "$repository_destination" || fail "could not cd to $repository_destination" + + git fetch +else + git clone --mirror "$repository_url" "$repository_destination" +fi + |