]> git.plutz.net Git - shellwiki/blobdiff - index.cgi
enable work without git revisioning
[shellwiki] / index.cgi
index 8479bd9dd492127e760f19865e14a659fdecef6e..61a8bb007c5d0807eaf9d6983d34637e74e583fc 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -6,8 +6,13 @@
 . "${_EXEC}/tools.sh"
 . "${_EXEC}/acl.sh"
 
+REV_PAGES=${REV_PAGES:-true}
 REV_ATTACHMENTS=${REV_ATTACHMENTS:-false}
 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,11 +28,10 @@ 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
@@ -35,6 +39,8 @@ if [ "$(which git)" -a ! -f "$_DATA/.gitignore" ]; then
        **/#page:*.*.cache
        **/#page:*.*.cache.*
        EOF
+  [ "$REV_ATTACHMENTS" != true ] \
+  && printf '**/#attachments/\n' >>"$_DATA/.gitignore"
   git init "$_DATA"
   git -C "$_DATA" add .gitignore
   git -C "$_DATA" commit -m 'initialization' -- .gitignore
@@ -43,7 +49,6 @@ 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