X-Git-Url: https://git.plutz.net/?a=blobdiff_plain;f=index.cgi;h=a27a75dbdddd133b086b71b9a222434cf10a0811;hb=9684cabf3651df8369d71c7a60e9235730dbe978;hp=db4d749b7c179efde9b4fec43a5158c5e4dd4d21;hpb=24bbbd528bd30515e9c53d2223d0f68971b5805d;p=shellwiki diff --git a/index.cgi b/index.cgi index db4d749..a27a75d 100755 --- a/index.cgi +++ b/index.cgi @@ -6,8 +6,13 @@ . "${_EXEC}/tools.sh" . "${_EXEC}/acl.sh" -REV_ATTACHMENTS=${REV_ATTACHMENTS:-false} -WIKI_THEME="${WIKI_THEME:-default}" +export REV_PAGES=${REV_PAGES:-true} +export REV_ATTACHMENTS=${REV_ATTACHMENTS:-false} +export WIKI_THEME="${WIKI_THEME:-default}" + +which git >/dev/null || REV_PAGES=false +[ "$REV_PAGES" != true ] && REV_ATTACHMENTS=false + . "${_EXEC}/themes/${WIKI_THEME}.sh" # Renew session cookie, only if cookie already set @@ -23,25 +28,31 @@ wiki_text() { cat -- "$mdfile" } -if [ "$(which git)" -a ! -f "$_DATA/.gitignore" ]; then +if [ "$REV_PAGES" = true -a ! -f "$_DATA/.gitignore" ]; then cat >"$_DATA/.gitignore" <<-EOF users.db serverkey - $([ "$REV_ATTACHMENTS" = true ] || printf %s "**/#attachments/") **/#cache/ **/#page.lock **/#page.*.cache **/#page.*.cache.* + **/#page:*.*.cache + **/#page:*.*.cache.* EOF + [ "$REV_ATTACHMENTS" != true ] \ + && printf '**/#attachments/\n' >>"$_DATA/.gitignore" git init "$_DATA" git -C "$_DATA" add .gitignore + printf '%s\n' "" "[user]" \ + "email = \"shellwiki@localhost\"" \ + "name = \"Shellwiki\"" \ + >>"$_DATA/.git/config" git -C "$_DATA" commit -m 'initialization' -- .gitignore fi 1>&2 for handler in "$_EXEC"/handlers/*; do . "$handler" && break done - if [ $? != 0 ]; then export ERROR_MSG="The presented URL schema cannot be handled" theme_error 400