Initial Commit

This commit is contained in:
Oshgnacknak 2020-10-25 13:12:56 +01:00
commit 28d9eb6062
6 changed files with 177 additions and 0 deletions

4
README Normal file
View file

@ -0,0 +1,4 @@
oshgit
======
Shell scripts based on stagit to manage OSHs git repositories.

43
build.sh Executable file
View file

@ -0,0 +1,43 @@
#!/bin/bash
# - Makes index for repositories in a single directory.
# - Makes static pages for each repository directory.
#
# NOTE, things to do manually (once) before running this script:
# - copy style.css, logo.png and favicon.png manually, a style.css example
# is included.
#
# - write clone url, for example "git://git.codemadness.org/dir" to the "url"
# file for each repo.
# - write owner of repo to the "owner" file.
# - write description in "description" file.
here=$(realpath $(dirname $0))
repos=$(realpath $here)/../*.git/
output=/var/www/html
echo Building repository list to $output
stagit-index $repos > $output/index.html
cp $here/style.css $output/style.css
cp $here/logo.png $output/logo.png
ln -sf $output/logo.png $output/favicon.png
for repo in ${@:-$repos}; do
dir="$output/$(basename $repo .git)"
repo=$(realpath $repo)
mkdir -p $dir
pushd $dir
echo Building html for $repo to $dir
stagit -c ".cache" $repo
ln -sf log.html index.html
ln -sf $output/style.css style.css
ln -sf $output/logo.png logo.png
ln -sf $output/logo.png favicon.png
popd
done
chgrp www-data $output -R
chmod 770 $output -R

BIN
logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

21
new-repo.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh
set -e
cd $(dirname $0)
for name in $@; do
dir="../$name.git"
url="ssh://osh@192.168.2.6:/~/git/$name.git"
mkdir $dir
git -C $dir init --bare
echo "Oshgnacknak" > $dir/owner
echo $url > $dir/url
${EDITOR:-vi} $dir/description
ln -sr post-receive.sh $dir/hooks/post-receive
./build.sh $dir
echo "Clone: $url"
done

3
post-receive.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
../oshgit/build.sh $PWD

106
style.css Executable file
View file

@ -0,0 +1,106 @@
body {
color: #000;
background-color: #fff;
font-family: monospace;
}
h1, h2, h3, h4, h5, h6 {
font-size: 1em;
margin: 0;
}
img, h1, h2 {
vertical-align: middle;
}
img {
border: 0;
}
a:target {
background-color: #ccc;
}
a.d,
a.h,
a.i,
a.line {
text-decoration: none;
}
#blob a {
color: #777;
}
#blob a:hover {
color: blue;
text-decoration: none;
}
table thead td {
font-weight: bold;
}
table td {
padding: 0 0.4em;
}
#content table td {
vertical-align: top;
white-space: nowrap;
}
#branches tr:hover td,
#tags tr:hover td,
#index tr:hover td,
#log tr:hover td,
#files tr:hover td {
background-color: #eee;
}
#index tr td:nth-child(2),
#tags tr td:nth-child(3),
#branches tr td:nth-child(3),
#log tr td:nth-child(2) {
white-space: normal;
}
td.num {
text-align: right;
}
.desc {
color: #777;
}
hr {
border: 0;
border-top: 1px solid #777;
height: 1px;
}
pre {
font-family: monospace;
}
pre a.h {
color: #00a;
}
.A,
span.i,
pre a.i {
color: #070;
}
.D,
span.d,
pre a.d {
color: #e00;
}
pre a.h:hover,
pre a.i:hover,
pre a.d:hover {
text-decoration: none;
}