Girocco::Project: Allow empty project password
[girocco/mytab.git] / mirroring / clone.sh
blobfbc73d4dd497c6607b0ae308d41247315a8dd2ba
1 #!/bin/bash
3 # Invoked from mirroring/cloned.pl
5 . @basedir@/shlib.sh
7 set -e
9 projdir="$1"
10 proj="${projdir%.git}"
12 cd "$cfg_reporoot/$projdir"
13 trap "echo '@OVER@'; touch .clone_failed" EXIT
14 url="$(cat base_url)"
15 mail="$(cat owner)"
17 # Configure
18 echo "Configuring repository..."
19 git config --bool mirror.allowed true
21 # Initial mirror
22 echo "Initiating mirroring..."
23 case "$url" in
24 svn://*)
25 GIT_DIR=. git svn init -s "$url"
26 GIT_DIR=. git svn fetch
27 # Neat Trick suggested by Miklos Vajna
28 GIT_DIR=. git config remote.origin.url .
29 GIT_DIR=. git config remote.origin.fetch +refs/remotes/heads/*:refs/heads/*
30 GIT_DIR=. git config remote.origin.fetch +refs/remotes/trunk:refs/heads/master
31 GIT_DIR=. git config remote.origin.fetch +refs/remotes/tags/*:refs/tags/*
32 GIT_DIR=. git fetch
34 *) git mirror "$url";;
35 esac
37 # The rest
38 echo "Final touches..."
39 git update-server-info
40 trap "" EXIT
41 mail -s "[$cfg_name] $proj clone completed" "$mail,$cfg_admin" <<EOT
42 Congratulations! The clone of project $proj just completed.
44 * Source URL: $url
45 * GitWeb interface: $cfg_gitweburl/$projdir
46 * Project settings: $cfg_webadmurl/editproj.cgi?name=$proj
48 Have a lot of fun.
49 EOT
51 echo "Mirroring finished successfuly!"
52 rm .clone_in_progress
53 echo "@OVER@"