#!/bin/sh

if [ "$2" = "INSTALL" ]; then
   if [ ! -d /var/log/groonga ]; then
      mkdir -p /var/log/groonga
   fi
   if [ ! -d /var/log/groonga/httpd ]; then
      mkdir -p /var/log/groonga/httpd
   fi
   if [ ! -d /var/run/groonga ]; then
       mkdir -p /var/run/groonga
   fi
fi

if [ "$2" = "POST-DEINSTALL" ]; then
   rmdir /var/run/groonga 2>/dev/null || true
   rmdir /var/log/groonga/httpd 2>/dev/null || true
   rmdir /var/log/groonga 2>/dev/null || true
fi
