drist

custom modules for drist configuration tool
git clone git://git.pyratebeard.net/drist.git
Log | Files | Refs | README

commit f8ef75116852bca7c9529939b4ccef9ec79b7a54
parent 471f168574cde27ef6b93a5fc7dd9a1df5a6eb65
Author: pyratebeard <root@pyratebeard.net>
Date:   Fri,  6 Aug 2021 17:14:10 +0100

don't need this

Diffstat:
Dstagit/files/post-receive.html | 103-------------------------------------------------------------------------------
1 file changed, 0 insertions(+), 103 deletions(-)

diff --git a/stagit/files/post-receive.html b/stagit/files/post-receive.html @@ -1,103 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<meta name="viewport" content="width=device-width, initial-scale=1" /> -<title>post-receive - stagit-scripts - Static git repository setup scripts -</title> -<link rel="icon" type="image/png" href="../favicon.png" /> -<link rel="alternate" type="application/atom+xml" title="stagit-scripts Atom Feed" href="../atom.xml" /> -<link rel="alternate" type="application/atom+xml" title="stagit-scripts Atom Feed (tags)" href="../tags.xml" /> -<link rel="stylesheet" type="text/css" href="../style.css" /> -</head> -<body> -<table><tr><td><a href="../../"><img src="../logo.png" alt="" width="32" height="32" /></a></td><td><h1>stagit-scripts</h1><span class="desc">Static git repository setup scripts -</span></td></tr><tr class="url"><td></td><td>git clone <a href="https://www.brianlane.com/git/stagit-scripts">https://www.brianlane.com/git/stagit-scripts</a></td></tr><tr><td></td><td> -<a href="../log.html">Log</a> | <a href="../files.html">Files</a> | <a href="../refs.html">Refs</a> | <a href="../file/README.md.html">README</a></td></tr></table> -<hr/> -<div id="content"> -<p> post-receive (1846B)</p><hr/><pre id="blob"> -<a href="#l1" class="line" id="l1"> 1</a> #!/bin/sh -<a href="#l2" class="line" id="l2"> 2</a> # generic git post-receive hook. -<a href="#l3" class="line" id="l3"> 3</a> # change the config options below and call this script in your post-receive -<a href="#l4" class="line" id="l4"> 4</a> # hook or symlink it. -<a href="#l5" class="line" id="l5"> 5</a> # -<a href="#l6" class="line" id="l6"> 6</a> # usage: $0 [name] -<a href="#l7" class="line" id="l7"> 7</a> # -<a href="#l8" class="line" id="l8"> 8</a> # if name is not set the basename of the current directory is used, -<a href="#l9" class="line" id="l9"> 9</a> # this is the directory of the repo when called from the post-receive script. -<a href="#l10" class="line" id="l10"> 10</a> -<a href="#l11" class="line" id="l11"> 11</a> # NOTE: needs to be set for correct locale (expects UTF-8) otherwise the -<a href="#l12" class="line" id="l12"> 12</a> # default is LC_CTYPE=&quot;POSIX&quot;. -<a href="#l13" class="line" id="l13"> 13</a> export LC_CTYPE=&quot;en_US.UTF-8&quot; -<a href="#l14" class="line" id="l14"> 14</a> -<a href="#l15" class="line" id="l15"> 15</a> name=&quot;$1&quot; -<a href="#l16" class="line" id="l16"> 16</a> if test &quot;${name}&quot; = &quot;&quot;; then -<a href="#l17" class="line" id="l17"> 17</a> name=$(basename &quot;$(pwd)&quot;) -<a href="#l18" class="line" id="l18"> 18</a> fi -<a href="#l19" class="line" id="l19"> 19</a> -<a href="#l20" class="line" id="l20"> 20</a> # config -<a href="#l21" class="line" id="l21"> 21</a> # paths must be absolute. -<a href="#l22" class="line" id="l22"> 22</a> BASEURL=&quot;https://www.yourhost.com/git&quot; -<a href="#l23" class="line" id="l23"> 23</a> RSYNC_DEST=&quot;yourhost.com:public_html/git/&quot; -<a href="#l24" class="line" id="l24"> 24</a> reposdir=&quot;$HOME/stagit-repos&quot; -<a href="#l25" class="line" id="l25"> 25</a> -<a href="#l26" class="line" id="l26"> 26</a> dir=&quot;${reposdir}/${name}&quot; -<a href="#l27" class="line" id="l27"> 27</a> htmldir=&quot;${reposdir}&quot; -<a href="#l28" class="line" id="l28"> 28</a> stagitdir=&quot;/&quot; -<a href="#l29" class="line" id="l29"> 29</a> destdir=&quot;${htmldir}${stagitdir}&quot; -<a href="#l30" class="line" id="l30"> 30</a> cachefile=&quot;.htmlcache&quot; -<a href="#l31" class="line" id="l31"> 31</a> # /config -<a href="#l32" class="line" id="l32"> 32</a> -<a href="#l33" class="line" id="l33"> 33</a> if ! test -d &quot;${dir}&quot;; then -<a href="#l34" class="line" id="l34"> 34</a> echo &quot;${dir} does not exist&quot; &gt;&amp;2 -<a href="#l35" class="line" id="l35"> 35</a> exit 1 -<a href="#l36" class="line" id="l36"> 36</a> fi -<a href="#l37" class="line" id="l37"> 37</a> cd &quot;${dir}&quot; || exit 1 -<a href="#l38" class="line" id="l38"> 38</a> -<a href="#l39" class="line" id="l39"> 39</a> # detect git push -f -<a href="#l40" class="line" id="l40"> 40</a> force=0 -<a href="#l41" class="line" id="l41"> 41</a> while read -r old new ref; do -<a href="#l42" class="line" id="l42"> 42</a> test &quot;${old}&quot; = &quot;0000000000000000000000000000000000000000&quot; &amp;&amp; continue -<a href="#l43" class="line" id="l43"> 43</a> test &quot;${new}&quot; = &quot;0000000000000000000000000000000000000000&quot; &amp;&amp; continue -<a href="#l44" class="line" id="l44"> 44</a> -<a href="#l45" class="line" id="l45"> 45</a> hasrevs=$(git rev-list &quot;${old}&quot; &quot;^${new}&quot; | sed 1q) -<a href="#l46" class="line" id="l46"> 46</a> if test -n &quot;${hasrevs}&quot;; then -<a href="#l47" class="line" id="l47"> 47</a> force=1 -<a href="#l48" class="line" id="l48"> 48</a> break -<a href="#l49" class="line" id="l49"> 49</a> fi -<a href="#l50" class="line" id="l50"> 50</a> done -<a href="#l51" class="line" id="l51"> 51</a> -<a href="#l52" class="line" id="l52"> 52</a> printf &quot;[%s] stagit HTML pages... &quot; &quot;${name}&quot; -<a href="#l53" class="line" id="l53"> 53</a> -<a href="#l54" class="line" id="l54"> 54</a> mkdir -p &quot;${destdir}/${name}&quot; -<a href="#l55" class="line" id="l55"> 55</a> cd &quot;${destdir}/${name}&quot; || exit 1 -<a href="#l56" class="line" id="l56"> 56</a> -<a href="#l57" class="line" id="l57"> 57</a> # remove commits and ${cachefile} on git push -f, this recreated later on. -<a href="#l58" class="line" id="l58"> 58</a> if test &quot;${force}&quot; = &quot;1&quot;; then -<a href="#l59" class="line" id="l59"> 59</a> rm -f &quot;${cachefile}&quot; -<a href="#l60" class="line" id="l60"> 60</a> rm -rf &quot;commit&quot; -<a href="#l61" class="line" id="l61"> 61</a> fi -<a href="#l62" class="line" id="l62"> 62</a> -<a href="#l63" class="line" id="l63"> 63</a> # make index. -<a href="#l64" class="line" id="l64"> 64</a> stagit-index &quot;${reposdir}/&quot;*/ &gt; &quot;${destdir}/index.html&quot; -<a href="#l65" class="line" id="l65"> 65</a> -<a href="#l66" class="line" id="l66"> 66</a> # Create the URL for clone -<a href="#l67" class="line" id="l67"> 67</a> echo &quot;${BASEURL}/${name}&quot; &gt; url -<a href="#l68" class="line" id="l68"> 68</a> git update-server-info -<a href="#l69" class="line" id="l69"> 69</a> -<a href="#l70" class="line" id="l70"> 70</a> # make pages. -<a href="#l71" class="line" id="l71"> 71</a> stagit -c &quot;${cachefile}&quot; &quot;${reposdir}/${name}&quot; -<a href="#l72" class="line" id="l72"> 72</a> -<a href="#l73" class="line" id="l73"> 73</a> ln -sf log.html index.html -<a href="#l74" class="line" id="l74"> 74</a> ln -sf ../style.css style.css -<a href="#l75" class="line" id="l75"> 75</a> ln -sf ../logo.png logo.png -<a href="#l76" class="line" id="l76"> 76</a> -<a href="#l77" class="line" id="l77"> 77</a> # Update the server -<a href="#l78" class="line" id="l78"> 78</a> rsync -a &quot;${destdir}/&quot; &quot;${RSYNC_DEST}&quot; -<a href="#l79" class="line" id="l79"> 79</a> -<a href="#l80" class="line" id="l80"> 80</a> echo &quot;done&quot; -</pre> -</div> -</body> -</html>