aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <andy@andydoestech.com>2018-06-15 20:18:17 +0000
committerroot <andy@andydoestech.com>2018-06-15 20:18:17 +0000
commit81359e4599ff7d53d6cbe91e559ca0e6d13ff8e5 (patch)
treef8952d02b4f39249c1a86a924b3bd8e2e43f95a1
parentdefd983003d785d11ac3ab7114470010e7a5f60b (diff)
updated config/Makefile
-rw-r--r--Makefile.pre34
-rwxr-xr-xconfigure13
-rwxr-xr-xmd2html.sh5
-rwxr-xr-xpretext.sh6
4 files changed, 41 insertions, 17 deletions
diff --git a/Makefile.pre b/Makefile.pre
new file mode 100644
index 0000000..2db2875
--- /dev/null
+++ b/Makefile.pre
@@ -0,0 +1,34 @@
+define getsetting
+$$(grep "^$(2)[ \t]*" $(1) | sed 's/^$(2)[ \t]*//g')
+endef
+
+all: build/cgitrc build/cgit.conf build/cgit.php build/filters
+ cp filters/* build/filters
+
+install:
+ mv $(call getsetting,tmp/settings.txt,CGITCONF) $(call getsetting,tmp/settings.txt,CGITCONF).old
+ cp build/cgit.conf $(call getsetting,tmp/settings.txt,CGITCONF)
+ [[ -f /etc/cgitrc ]] && mv /etc/cgitrc /etc/cgitrc.old
+ cp build/cgitrc/ /etc
+ mkdir -p /usr/local/bin
+ cp build/filters/* /usr/local/bin
+
+build/cgitrc: build
+ m4 -DCGITCSS="$(call getsetting,tmp/settings.txt,CGITCSS)" -DGITPATH="$(call getsetting,tmp/settings.txt,GITPATH)" cgitrc.m4 > build/cgitrc
+
+build/cgit.conf: build
+ echo "<Macro CgitPage \$$url>" > build/cgit.conf
+ sed 's/^ScriptAlias \([\/]*\)[a-z]\+\([\/]*\) \(.*\)$$/ScriptAlias \1$$url\2 \3/g;s/^RedirectMatch.*$$/RedirectMatch ^$$url$$ $$url\//g' $(call getsetting,tmp/settings.txt,CGITCONF) >> build/cgit.conf
+ echo "</Macro>" >> build/cgit.conf
+
+build/cgit.php: build
+ m4 -DCGITURL="$(call getsetting,tmp/settings.txt,CGITURL)" cgit.php.m4 > build/cgit.php
+
+build/filters: build
+ mkdir -p build/filters
+
+build:
+ mkdir -p build
+
+clean:
+ rm -rf build
diff --git a/configure b/configure
index 0e20627..a2f1d0e 100755
--- a/configure
+++ b/configure
@@ -49,7 +49,7 @@ checkcgit() {
if [ -f /etc/httpd/conf.d/cgit.conf ]; then
echo "ok"
echo "CGITCONF /etc/httpd/conf.d/cgit.conf" >> $1
- echo "CGITCSS cgit-data" >> $1
+ echo "CGITCSS /cgit-data" >> $1
else
echo "error"
exit
@@ -59,7 +59,7 @@ checkcgit() {
if [ -f /etc/apache2/conf-enabled/cgit.conf ]; then
echo "ok"
echo "CGITCONF /etc/apache2/conf-enabled/cgit.conf" >> $1
- echo "CGITCSS cgit-css" >> $1
+ echo "CGITCSS /cgit-css" >> $1
else
echo "error"
exit
@@ -78,10 +78,10 @@ checkbin() {
[[ $? -eq 0 ]] && echo "ok" || ( echo "error" ; exit)
}
-
+mkdir -p tmp
# Perform Checks
-checkbin pandock
+checkbin pandoc
checkfile /etc/cgitrc
checkdistro tmp/settings.txt
@@ -90,6 +90,7 @@ checkcgit tmp/settings.txt
# Save Settings
newsetting "Enter the path for git repositories" "GITPATH" "/opt/repos" tmp/settings.txt
-newsetting "Enter cgit URL" "GITURL" "http://localhost/git" tmp/settings.txt
+newsetting "Enter cgit URL" "CGITURL" "http://localhost/git/" tmp/settings.txt
+newsetting "Enter web root" "HTTPROOT" "/srv/www" tmp/settings.txt
-m4 -DFILTERLIST="$(find filters/ -type f | sed 's/^/build\//g' | tr '\n' ' ')" Makefile.m4 > Makefile
+cp Makefile.pre Makefile
diff --git a/md2html.sh b/md2html.sh
deleted file mode 100755
index dcad4d9..0000000
--- a/md2html.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-cat -| sed 's/</\&lt;/g;s/>/\&gt;/g' | pandoc -f markdown -t html
-
-echo "<br/><br/><a href="../tree">View Code</a>"
diff --git a/pretext.sh b/pretext.sh
deleted file mode 100755
index e5beaa3..0000000
--- a/pretext.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-
-echo "<pre style=\"width:100%;white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;\">"
-cat - | sed 's/</\&lt;/g;s/>/\&gt;/g'
-echo "</pre>"
-echo "<br/><br/><a href="../tree">View Code</a>"