###############################################################################
# This file is part of the IPCop Firewall.                                    #
#                                                                             #
# IPCop is free software; you can redistribute it and/or modify               #
# it under the terms of the GNU General Public License as published by        #
# the Free Software Foundation; either version 2 of the License, or           #
# (at your option) any later version.                                         #
#                                                                             #
# IPCop is distributed in the hope that it will be useful,                    #
# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
# GNU General Public License for more details.                                #
#                                                                             #
# You should have received a copy of the GNU General Public License           #
# along with IPCop; if not, write to the Free Software                        #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA    #
#                                                                             #
# Makefiles are based on LFSMake, which is                                    #
# Copyright (C) 2002 Rod Roard <rod@sunsetsystems.com>                        #
#                                                                             #
# Modifications by:                                                           #
# ??-12-2003 Mark Wormgoor < mark@wormgoor.com>                               #
#          - Modified Makefile for IPCop build                                #
#                                                                             #
# $Id: ipcop-gui 5960 2011-10-18 05:20:45Z dotzball $
#                                                                             #
###############################################################################

###############################################################################
# Definitions
###############################################################################

include Config

PKG_NAME   = ipcop-gui
HOST_ARCH  = all
OTHER_SRC  = no

THISAPP    = ipcop-gui
DIR_APP    = $(DIR_SRC)/$(THISAPP)
TARGET     = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(PKG_NAME)

###############################################################################
# Top-level Rules
###############################################################################

install : $(TARGET)

check :

download :

md5 :

###############################################################################
# Installation Details
###############################################################################

$(TARGET) : $(firstword $(MAKEFILE_LIST)) $(DIR_SRC)/html/cgi-bin/* $(DIR_SRC)/html/html/* $(DIR_SRC)/html/html/images/* $(DIR_SRC)/html/html/include/*
	@$(PREBUILD)

	mkdir -p /home/httpd
	# Copy all html/cgi-bin files
	cp -aR $(DIR_SRC)/html/* /home/httpd
	find /home/httpd -name .svn -print | xargs --no-run-if-empty rm -rf

	# Additional directories for RRD graphs and Squid graphs
	mkdir -p /home/httpd/html/graphs
	mkdir -p /home/httpd/html/sgraph

	chown -R root:root /home/httpd
	chmod -R 755 /home/httpd/cgi-bin
	chmod -R 644 /home/httpd/html
	chmod 755 /home/httpd/html /home/httpd/html/{index.cgi,graphs,images,include,sgraph}

	# backup directory needs nobody:nobody permissions
	mkdir -p /home/httpd/html/backup
	chown nobody:nobody /home/httpd/html/backup
	chmod 744 /home/httpd/html/backup

	# repository directory for urlfilter
	mkdir -p /home/httpd/vhost81/html/repository

	# vhost81 directories need nobody:nobody permissions
	mkdir -p /home/httpd/vhost81/cgi-bin
	chown -R nobody:nobody /home/httpd/vhost81/*
	chmod -R 755 /home/httpd/vhost81/cgi-bin
	chmod -R 644 /home/httpd/vhost81/html
	chmod 755 /home/httpd/vhost81/html /home/httpd/vhost81/html/images

	@$(POSTBUILD)
