diff options
Diffstat (limited to 'git')
-rw-r--r-- | git/README.md | 9 | ||||
-rwxr-xr-x | git/create.sh | 53 | ||||
-rwxr-xr-x | git/daemon.sh | 7 | ||||
-rw-r--r-- | git/git-daemon.service | 21 |
4 files changed, 90 insertions, 0 deletions
diff --git a/git/README.md b/git/README.md new file mode 100644 index 0000000..5637f06 --- /dev/null +++ b/git/README.md | |||
@@ -0,0 +1,9 @@ | |||
1 | ## For Git Daemon | ||
2 | |||
3 | read https://git-scm.com/book/be/v2/Git-on-the-Server-Git-Daemon | ||
4 | |||
5 | ## For Http Files for Git | ||
6 | |||
7 | refs: | ||
8 | - https://mtkn.jp/computer/git_server.html | ||
9 | - https://codemadness.org/stagit.html | ||
diff --git a/git/create.sh b/git/create.sh new file mode 100755 index 0000000..f2f4227 --- /dev/null +++ b/git/create.sh | |||
@@ -0,0 +1,53 @@ | |||
1 | #!/bin/bash | ||
2 | # - Makes index for repositories in a single directory. | ||
3 | # - Makes static pages for each repository directory. | ||
4 | # | ||
5 | # NOTE, things to do manually (once) before running this script: | ||
6 | # - copy style.css, logo.png and favicon.png manually, a style.css example | ||
7 | # is included. | ||
8 | # | ||
9 | # - write clone URL, for example "git://git.codemadness.org/dir" to the "url" | ||
10 | # file for each repo. | ||
11 | # - write owner of repo to the "owner" file. | ||
12 | # - write description in "description" file. | ||
13 | # | ||
14 | # Usage: | ||
15 | # - mkdir -p htmldir && cd htmldir | ||
16 | # - sh example_create.sh | ||
17 | |||
18 | ORIG_DIR=`pwd` | ||
19 | |||
20 | # path must be absolute. | ||
21 | reposdir="/srv/git" | ||
22 | curdir="/srv/git/www" | ||
23 | |||
24 | cd ${curdir} | ||
25 | |||
26 | # make files per repo. | ||
27 | for dir in "${reposdir}/"*/; do | ||
28 | # strip .git suffix. | ||
29 | r=$(basename "${dir}") | ||
30 | d=$(basename "${dir}" ".git") | ||
31 | printf "%s... " "${d}" | ||
32 | |||
33 | mkdir -p "${curdir}/${d}" | ||
34 | cd "${curdir}/${d}" || continue | ||
35 | |||
36 | test -f ${dir}/owner || echo `whoami` >${dir}/owner | ||
37 | test -f ${dir}/url || echo git://git.topo.tw/${d} >${dir}/url | ||
38 | |||
39 | stagit -c ".cache" -u "https://git.codemadness.nl/$d/" "${reposdir}/${r}" | ||
40 | |||
41 | # symlinks | ||
42 | ln -sf log.html index.html | ||
43 | ln -sf ../style.css style.css | ||
44 | ln -sf ../logo.png logo.png | ||
45 | ln -sf ../favicon.png favicon.png | ||
46 | |||
47 | echo "done" | ||
48 | done | ||
49 | |||
50 | # make index. | ||
51 | stagit-index "${reposdir}/"*/ > "${curdir}/index.html" | ||
52 | |||
53 | cd ${ORIG_DIR} | ||
diff --git a/git/daemon.sh b/git/daemon.sh new file mode 100755 index 0000000..3cfac1b --- /dev/null +++ b/git/daemon.sh | |||
@@ -0,0 +1,7 @@ | |||
1 | #! /bin/bash | ||
2 | |||
3 | git daemon \ | ||
4 | --export-all \ | ||
5 | --enable=upload-archive \ | ||
6 | --verbose --base-path=`pwd` \ | ||
7 | -- `pwd`/* | ||
diff --git a/git/git-daemon.service b/git/git-daemon.service new file mode 100644 index 0000000..4641aea --- /dev/null +++ b/git/git-daemon.service | |||
@@ -0,0 +1,21 @@ | |||
1 | [Unit] | ||
2 | Description=Start Git Daemon | ||
3 | Requires=network-online.target | ||
4 | After=network-online.target | ||
5 | |||
6 | [Service] | ||
7 | ExecStart=/home/pham/git/vps/git/daemon.sh | ||
8 | WorkingDirectory=/srv/git | ||
9 | |||
10 | Restart=always | ||
11 | RestartSec=500ms | ||
12 | |||
13 | StandardOutput=syslog | ||
14 | StandardError=syslog | ||
15 | SyslogIdentifier=git-daemon | ||
16 | |||
17 | User=pham | ||
18 | Group=pham | ||
19 | |||
20 | [Install] | ||
21 | WantedBy=multi-user.target | ||