#!/bin/bash

. ${TOOLKIT}-functions.sh

module="srv-typemill"

# allowed ips
#
allowed=$(jtconf $module.allow) 

# pass lines to run-install script, as temporary defines in kusa-db,
# using local db $MODLOCALDB
(
	echo "[temp]"
	echo "  allow	^^BLOCK^^"
	case $allowed in
	  [Aa][Ll][Ll]*) ;;
	  *) echo "		$(apache2_add_deny All)"
	esac
	for ip in $allowed
	do
		echo "		$(apache2_add_allow $ip)"
	done
	echo "^^BLOCK^^"
	echo
) >>$MODLOCALDB

# the project where install typemill is ready?
#
instdir=$(jtconf $module.instdir)
prjdir=$(dirname "$instdir")

[ -d "$prjdir" ] || {
	exit_err 1 "you must create project dir '$prjdir' first"
}

exit 0
