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