diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-12-17 14:05:18 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-12-17 14:05:18 +0800 |
commit | 5713eb4bfd465beef627f0c89b996d090f593603 (patch) | |
tree | 1ae3d3b3417e94128b7f9496f1df7dda00d7f8ee /git/archive/stagit.sh | |
parent | ee9c98c4017702c839d1ed07eaa6a4166ca28f95 (diff) |
git: update
Diffstat (limited to 'git/archive/stagit.sh')
-rwxr-xr-x | git/archive/stagit.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/git/archive/stagit.sh b/git/archive/stagit.sh new file mode 100755 index 0000000..f2f4227 --- /dev/null +++ b/git/archive/stagit.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} | ||