]> git.phdru.name Git - git-scripts.git/blob - publish2web
Add cloned repository to the list of repos to process
[git-scripts.git] / publish2web
1 #! /bin/sh
2
3 if [ -z "$1" ]; then
4    echo "Usage: $0 repoistory [directories]" >&2
5    exit 1
6 fi
7
8 umask 022 &&
9 cd "$1" && source_dir="`pwd`" &&
10
11 if [ ! -d ".git" ]; then
12    echo "$source_dir is not a repoistory (.git isn't found)" >&2
13    exit 1
14 fi &&
15
16 cd "$HOME"/tmp &&
17 dest_dir="`basename \"$source_dir\"`".git &&
18 git clone --bare --config core.sharedRepository=0644 "$source_dir" "$dest_dir" &&
19
20 cd "$dest_dir" &&
21 pwd >> "`dirname \"$0\"`"/locate-all.list &&
22 git gc --aggressive &&
23 git repack -a -d -f --depth=20 --window=250 &&
24 git fsck --strict &&
25 git config receive.updateserverinfo true && git update-server-info &&
26 cp -p "$HOME"/Internet/WWW/htdocs/git.phdru.name/phdru.name/phdru.name.git/git-daemon-export-ok . &&
27 if [ "`cat \"$source_dir\"/.git/description`" = \
28    "Unnamed repository; edit this file 'description' to name the repository." ]
29 then
30    `git var GIT_EDITOR` "$source_dir"/.git/description description
31 else
32    cp -p "$source_dir"/.git/description . && chmod a+r description
33 fi &&
34 if [ -f "$source_dir"/README.html ]; then
35    cp -p "$source_dir"/README.html . && chmod a+r README.html
36 fi &&
37
38 cd "$HOME"/Internet/WWW/htdocs/git.phdru.name &&
39 directories="$2" &&
40 if [ -n "$directories" ]; then
41    mkdir -p "$directories"
42 fi &&
43
44 cd "$HOME"/tmp &&
45 mv "$dest_dir" "$HOME"/Internet/WWW/htdocs/git.phdru.name/"$directories" &&
46
47 umask 077 &&
48 cd "$source_dir" &&
49 if [ -n "$directories" ]; then
50    dest_dir="$directories/$dest_dir"
51 fi &&
52 git remote add web "$HOME"/Internet/WWW/htdocs/git.phdru.name/"$dest_dir" &&
53 exec git push --set-upstream web master