diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2022-11-20 23:31:40 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2022-11-20 23:31:40 +0100 |
| commit | 52b0be81663df26b56002533ec93f8008db04d1a (patch) | |
| tree | ad72ba13e6159d647b0bf2619c88c57924a19b82 | |
| download | git-hooks-52b0be81663df26b56002533ec93f8008db04d1a.tar.gz git-hooks-52b0be81663df26b56002533ec93f8008db04d1a.zip | |
First commit
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 9 | ||||
| -rw-r--r-- | README.md | 3 | ||||
| -rw-r--r-- | bottom.html | 17 | ||||
| -rw-r--r-- | favicon.png | bin | 0 -> 8829 bytes | |||
| -rw-r--r-- | logo.png | bin | 0 -> 3050 bytes | |||
| -rwxr-xr-x | post-receive-stagit | 89 | ||||
| -rw-r--r-- | style.css | 99 | ||||
| -rwxr-xr-x | update-all | 9 |
8 files changed, 226 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..68fff76 --- /dev/null +++ b/Makefile | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | push: | ||
| 2 | ssh git@tronto.net mkdir -p BIN FILES | ||
| 3 | scp post-receive-stagit update-all git@tronto.net:BIN/ | ||
| 4 | scp bottom.html favicon.png logo.png style.css git@tronto.net:FILES/ | ||
| 5 | |||
| 6 | clean: | ||
| 7 | ssh git@tronto.net rm -r FILES/* BIN/* | ||
| 8 | |||
| 9 | .PHONY: clean push | ||
diff --git a/README.md b/README.md new file mode 100644 index 0000000..feb9692 --- /dev/null +++ b/README.md | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | # Git hooks | ||
| 2 | |||
| 3 | Some scripts I use to update [my git website](https://git.tronto.net). | ||
diff --git a/bottom.html b/bottom.html new file mode 100644 index 0000000..0b3811d --- /dev/null +++ b/bottom.html | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | <hr class="line"> | ||
| 2 | <footer> | ||
| 3 | <table> | ||
| 4 | <tr> | ||
| 5 | <td class="contact"> | ||
| 6 | Back to | ||
| 7 | <a href="https://sebastiano.tronto.net"> | ||
| 8 | sebastiano.tronto.net | ||
| 9 | </a> | ||
| 10 | </td> | ||
| 11 | <td class="hosted"> | ||
| 12 | Generated with | ||
| 13 | <a href="https://codemadness.org/stagit.html">stagit</a> | ||
| 14 | </td> | ||
| 15 | </tr> | ||
| 16 | </table> | ||
| 17 | </footer> | ||
diff --git a/favicon.png b/favicon.png new file mode 100644 index 0000000..8a6b202 --- /dev/null +++ b/favicon.png | |||
| Binary files differ | |||
diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..59708dc --- /dev/null +++ b/logo.png | |||
| Binary files differ | |||
diff --git a/post-receive-stagit b/post-receive-stagit new file mode 100755 index 0000000..396eefd --- /dev/null +++ b/post-receive-stagit | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | repo="$PWD" | ||
| 4 | name="$(basename $repo .git)" | ||
| 5 | basedir="/var/www/htdocs/git.tronto.net" | ||
| 6 | htdir="$basedir/$name" | ||
| 7 | filesdir="/home/git/FILES" | ||
| 8 | |||
| 9 | setupinfo() { | ||
| 10 | echo "Sebastiano Tronto" > owner | ||
| 11 | echo "https://git.tronto.net/$name" > url | ||
| 12 | } | ||
| 13 | |||
| 14 | genstagit() { | ||
| 15 | rm -rf "$htdir" | ||
| 16 | mkdir -p "$basedir" | ||
| 17 | cp -r "$repo" "$htdir" | ||
| 18 | cd "$htdir" && \ | ||
| 19 | git update-server-info && \ | ||
| 20 | git archive HEAD --prefix="$name/" -o "$basedir/$name.zip" | ||
| 21 | stagit -l 100 "$repo" | ||
| 22 | git show master:README.md > file/README.md | ||
| 23 | } | ||
| 24 | |||
| 25 | cpindexfile() { | ||
| 26 | cp "$htdir/files.html" "$htdir/index.html" | ||
| 27 | } | ||
| 28 | |||
| 29 | cpstylefiles() { | ||
| 30 | cp $filesdir/favicon.png "$1" | ||
| 31 | cp $filesdir/logo.png "$1" | ||
| 32 | cp $filesdir/style.css "$1" | ||
| 33 | } | ||
| 34 | |||
| 35 | formatreadme() { | ||
| 36 | printf '%s\n' \ | ||
| 37 | g/class=\"line\"/d \ | ||
| 38 | "/<pre id=\"blob\">" d d i "$(lowdown file/README.md)" . w \ | ||
| 39 | | ed -s file/README.md.html > /dev/null | ||
| 40 | } | ||
| 41 | |||
| 42 | adddownloadbutton() { | ||
| 43 | printf '%s\n' \ | ||
| 44 | "/log\.html\">Log<\/a>" i \ | ||
| 45 | "<a href=\"../$name.zip\">Download</a> |" . w \ | ||
| 46 | | ed -s "$1" > /dev/null | ||
| 47 | } | ||
| 48 | |||
| 49 | addbottombar() { | ||
| 50 | printf '%s\n' \ | ||
| 51 | "/<\/body>" i "$(cat $filesdir/bottom.html)" . w \ | ||
| 52 | | ed -s "$1" > /dev/null | ||
| 53 | } | ||
| 54 | |||
| 55 | changeindextitlestyle() { | ||
| 56 | printf '%s\n' \ | ||
| 57 | "/<td><span class=\"desc\">Repositories" c \ | ||
| 58 | "<td><h1>Repositories</h1></td></tr><tr><td></td><td>" . w \ | ||
| 59 | | ed -s "$basedir/index.html" > /dev/null | ||
| 60 | } | ||
| 61 | |||
| 62 | genstagitindex() { | ||
| 63 | stagit-index /home/git/*.git | \ | ||
| 64 | sed 's|/log\.html||g' > "$basedir/index.html" | ||
| 65 | } | ||
| 66 | |||
| 67 | mkpage() { | ||
| 68 | echo "Updating stagit page for $name" | ||
| 69 | setupinfo | ||
| 70 | genstagit | ||
| 71 | cpindexfile | ||
| 72 | cpstylefiles "./" | ||
| 73 | [ -e file/README.md ] && formatreadme | ||
| 74 | for f in $(find "$htdir" -name "*.html"); do | ||
| 75 | adddownloadbutton $f | ||
| 76 | addbottombar $f | ||
| 77 | done | ||
| 78 | } | ||
| 79 | |||
| 80 | mkindex() { | ||
| 81 | echo "Updating stagit index page" | ||
| 82 | genstagitindex | ||
| 83 | cpstylefiles "$basedir/" | ||
| 84 | addbottombar "$basedir/index.html" | ||
| 85 | changeindextitlestyle | ||
| 86 | } | ||
| 87 | |||
| 88 | mkpage | ||
| 89 | mkindex | ||
diff --git a/style.css b/style.css new file mode 100644 index 0000000..567ef26 --- /dev/null +++ b/style.css | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | .menu { | ||
| 2 | width: 100%; | ||
| 3 | } | ||
| 4 | |||
| 5 | .links { | ||
| 6 | text-align: right; | ||
| 7 | font-weight: bold; | ||
| 8 | } | ||
| 9 | |||
| 10 | footer table { | ||
| 11 | font-style: italic; | ||
| 12 | width: 100%; | ||
| 13 | } | ||
| 14 | |||
| 15 | .hosted { | ||
| 16 | text-align: right; | ||
| 17 | } | ||
| 18 | |||
| 19 | body { | ||
| 20 | margin: auto 8px 20px 8px; | ||
| 21 | } | ||
| 22 | |||
| 23 | img { | ||
| 24 | display: block; | ||
| 25 | margin-left: auto; | ||
| 26 | margin-right: auto; | ||
| 27 | max-width: 100%; | ||
| 28 | } | ||
| 29 | |||
| 30 | pre, code { | ||
| 31 | background-color: #eeeeee; | ||
| 32 | } | ||
| 33 | |||
| 34 | pre { | ||
| 35 | border: 2px solid; | ||
| 36 | padding: 6px; | ||
| 37 | } | ||
| 38 | |||
| 39 | #blob { | ||
| 40 | background: #ffffff; | ||
| 41 | border: none; | ||
| 42 | } | ||
| 43 | |||
| 44 | a { | ||
| 45 | color: #0f2899; | ||
| 46 | text-decoration: none; | ||
| 47 | } | ||
| 48 | |||
| 49 | .links a { | ||
| 50 | font-weight: bold; | ||
| 51 | color: black; | ||
| 52 | } | ||
| 53 | |||
| 54 | .hosted a, | ||
| 55 | .contact a { | ||
| 56 | font-weight: bold; | ||
| 57 | } | ||
| 58 | |||
| 59 | a:hover { | ||
| 60 | text-decoration: underline; | ||
| 61 | } | ||
| 62 | |||
| 63 | html { | ||
| 64 | margin: 1em auto; | ||
| 65 | max-width: 42em; | ||
| 66 | } | ||
| 67 | |||
| 68 | h1 { | ||
| 69 | text-align: center; | ||
| 70 | } | ||
| 71 | |||
| 72 | td h1 { | ||
| 73 | text-align: left; | ||
| 74 | font-size: 1.5em; | ||
| 75 | } | ||
| 76 | |||
| 77 | table { | ||
| 78 | width: 100%; | ||
| 79 | } | ||
| 80 | |||
| 81 | #files td { | ||
| 82 | font-family: monospace; | ||
| 83 | font-size: 1.2em; | ||
| 84 | min-width: 7em; | ||
| 85 | } | ||
| 86 | |||
| 87 | #log tr:hover td, | ||
| 88 | #files tr:hover td, | ||
| 89 | #index tr:hover td { | ||
| 90 | background-color: #eeeeee; | ||
| 91 | } | ||
| 92 | |||
| 93 | .url td { | ||
| 94 | font-family: monospace; | ||
| 95 | } | ||
| 96 | |||
| 97 | table tr td a img { | ||
| 98 | min-width: 33px; | ||
| 99 | } | ||
diff --git a/update-all b/update-all new file mode 100755 index 0000000..890a1f5 --- /dev/null +++ b/update-all | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | for g in *.git; do | ||
| 4 | cd $g | ||
| 5 | printf '#!/bin/sh\n\n/home/git/BIN/post-receive-stagit\n' >> \ | ||
| 6 | hooks/post-receive | ||
| 7 | /home/git/BIN/post-receive-stagit | ||
| 8 | cd | ||
| 9 | done | ||
