From 217d03a25d583fce1b565af061330f3be35d04fe Mon Sep 17 00:00:00 2001 From: Determinant Date: Fri, 27 Jul 2018 13:48:48 -0400 Subject: ... --- gen_conf.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'gen_conf.sh') diff --git a/gen_conf.sh b/gen_conf.sh index cea5592..db83988 100755 --- a/gen_conf.sh +++ b/gen_conf.sh @@ -4,12 +4,20 @@ if [[ ! "$#" -eq 1 ]]; then echo "please specify the virtual root, e.g. /git/" exit 1 fi -VIRT_ROOT=${1%/} + +function remove_slashes { + x="$1" + case "$x" in *[!/]*/) x="${x%"${x##*[!/]}"}";; esac + echo "$x" +} + +VIRT_ROOT=$(remove_slashes "${1%/}") +echo $VIRT_ROOT cat > theme.cgitrc << EOF css= logo= virtual-root=$VIRT_ROOT -header=${BASE_DIR}/header.html +head-include=${BASE_DIR}/head.html footer=${BASE_DIR}/footer.html source-filter=${BASE_DIR}/syntax-highlighting.py about-filter=${BASE_DIR}/about-formatting.sh @@ -26,3 +34,5 @@ location $VIRT_ROOT/assets { disable_symlinks off; } EOF + +sed "s=%VIRT_ROOT%=$VIRT_ROOT=g" head.html.template > head.html -- cgit v1.2.3