ly/Makefile: Sort variables
[sunny256-utils.git] / git-dl
blobfea3e2dfc43484dc13c4c9f34dbaf9985eea2392
1 #!/usr/bin/env bash
3 #=======================================================================
4 # git-dl
5 # File ID: a4693388-6575-11e1-96df-8000600fe800
6 # Clone to a remote repo, create bundle, and download it via rsync(1).
7 # Temporary solution until Git gets resumable clone/fetch.
8 # License: GNU General Public License version 2 or later.
9 #=======================================================================
11 login=sunny@sunbase.org
13 remote() {
14 ssh -A $login "$@"
17 clonename=$1
18 url=$2
19 if [ -z "$url" ]; then
20 echo Syntax: git-dl DIRNAME URL >&2
21 exit 1
23 dl_dir=/home/sunny/src/dl
24 bundle_dir=/home/sunny/dl/git-dl
26 remote "mkdir -p $dl_dir $bundle_dir"
27 echo Clone $url into $dl_dir/$clonename.git
28 remote "cd $dl_dir && git clone --bare $url $clonename.git"
29 echo Creating remote bundle $bundle_dir/$clonename.bundle
30 remote "cd $dl_dir/$clonename.git && git bundle create $bundle_dir/$clonename.bundle --all"
31 mkdir -p $bundle_dir
32 rsync -avP $login:$bundle_dir/$clonename.bundle $bundle_dir/