3 export PATH
=/home
/pasky
/bin
:$PATH
10 log
="$(mktemp -t repomgr-XXXXXX)"
15 if ! "$@" >>"$log" 2>&1; then
17 echo "$* failed with error code $?"
20 } |
mail -s "[repo.or.cz] $proj clone failed" "$mail",pasky@ucw.cz
22 # This removes any remnants from /srv/git/$proj.git _and_ gets rid
23 # of the group record.
24 perl
-I/home
/repo
/repomgr
/cgi
-MGit::RepoCGI
-e 'Git::RepoCGI::Project->ghost('"'$proj'"')->delete;'
25 cd "$basedir" && rm -r "$proj"/* && rmdir -p "$proj"
32 if [ -s objects
/info
/alternates
]; then
33 ref
=(--reference "$(cat objects/info/alternates | sed 's/\.\.\/\.\.\/\.\./\/srv\/git/;s/objects$//')")
35 bang git clone
"${ref[@]}" --bare "$url" repodir
36 ! [ -d /srv
/git
/"$proj".git
]
37 lproj
="$(echo "$proj" | sed 's/^\(.*\/\)\(.*\)/\1/')"
38 if [ z
"$lproj" != z
"$proj" ]; then
39 bang mkdir
-m 0775 -p /srv
/git
/"$lproj"
41 bang
mv repodir
/srv
/git
/"$proj".git
42 bang
chmod g
+w base_url owner description homepage README.html
43 bang
mv base_url owner description homepage README.html
/srv
/git
/"$proj".git
/
44 #bang mv objects/info/alternates /srv/git/"$proj".git/objects/info/alternates # git clone should've set up that for us
45 GIT_DIR
=/srv
/git
/"$proj".git bang git config
--bool --add mirror.allowed true
46 GIT_DIR
=/srv
/git
/"$proj".git bang git update-server-info
47 cd "$basedir" && rm -r "$proj"/* && rmdir -p "$proj"
48 # NO bang AT THIS POINT! rm -r depends on cwd.
49 echo "Congratulations! You can adjust the project settings in the future at http://repo.or.cz/m/p/editproj.cgi." |
mail -s "[repo.or.cz] $proj clone completed" "$mail",pasky@ucw.cz
55 if [ -f "$proj"/base_url
]; then
59 # a collection of subprojects
60 find "$proj" -name base_url |
61 sed -e 's/\/base_url$//' |
63 (cd "$proj" && clone_project
) ||
: