+ mkdir "${FREESIDE_EXPORT}/export.${DATASOURCE}"
+ chown freeside "${FREESIDE_EXPORT}/export.${DATASOURCE}"
+
+ #install this for freeside-setup
+ install -d $(DIST_CONF)
+ #install conf/[a-z]* $(DEFAULT_CONF)
+ #CVS is not [a-z]
+ install `ls -d conf/[a-z]* | grep -v CVS | grep -v '^conf/registries'` $(DIST_CONF)
+
+ # Install interfaces
+ $(MAKE) -e DESTDIR=$(TMP)-webui install-docs
+
+ # Install tex
+ install -d ${TEXMF_PATH}
+ install -o freeside -m 444 etc/*.sty ${TEXMF_PATH}
+
+ # Create Apache configurations
+ install -d $(APACHE_CONF)
+ $(MAKE) -e DESTDIR=$(APACHE_CONF) install-apache
+ install -o root -m 755 init.d/insserv-override-apache2 $(TMP)-webui/etc/insserv/overrides/apache2
+
+ #Hack the build dir out of apache config
+
+ perl -p -i -e "\
+ s'${TMP}(-webui)?''g;\
+ " $(APACHE_CONF)/*
+
+ # Install init
+ $(MAKE) -e DESTDIR=$(TMP) install-init
+
+ #hack the build dir out of Freeside too. oh yeah, sucky.
+ perl -p -i -e "\
+ s'${TMP}(-webui)?''g;\
+ " ${TMP}/usr/local/etc/freeside/handler.pl \
+ ${TMP}/usr/share/perl5/FS/* \
+ ${TMP}/usr/share/perl5/FS/*/* \
+ ${TMP}/usr/bin/*
+
+ #hack the build dur out of lib
+ perl -p -i -e "\
+ s'${TMP}-lib?''g;\
+ s'${TMP}(-webui)?''g;\
+ " ${TMP}/usr/local/etc/freeside/handler.pl \
+ ${TMP}-lib/usr/share/perl5/FS/*.pm \
+ ${TMP}-lib/usr/share/perl5/FS/*/*.pm
+
+ #hack the build dir out of Freeside binaries
+
+ perl -p -i -e "\
+ s'${TMP}?''g;\
+ " ${TMP}-lib/usr/bin/* \
+ ${TMP}-webui/usr/local/etc/freeside/handler.pl
+
+ # Self-service
+
+ ( cd fs_selfservice/FS-SelfService/; $(MAKE) -e DESTDIR=${TMP}-selfservice-lib install )
+ install -d -o freeside -g freeside ${TMP}-selfservice-lib/usr/local/freeside
+ touch ${TMP}-selfservice-lib/usr/local/freeside/selfservice_socket
+ chown -R freeside ${TMP}-selfservice-lib/usr/local/freeside
+ chmod 600 ${TMP}-selfservice-lib/usr/local/freeside/selfservice_socket
+
+ install -d -o freeside -g freeside ${TMP}-selfservice-ui$(APACHE_DOCUMENT_ROOT)/
+ cp -R fs_selfservice/FS-SelfService/cgi ${TMP}-selfservice-ui$(APACHE_DOCUMENT_ROOT)/selfservice-DIST
+ chown freeside.freeside ${TMP}-selfservice-ui$(APACHE_DOCUMENT_ROOT)/selfservice-DIST/*.cgi ${TMP}-selfservice-ui$(APACHE_DOCUMENT_ROOT)/selfservice-DIST/*/*.cgi;
+ chmod 755 ${TMP}-selfservice-ui$(APACHE_DOCUMENT_ROOT)/selfservice-DIST/*.cgi ${TMP}-selfservice-ui$(APACHE_DOCUMENT_ROOT)/selfservice-DIST/*/*.cgi
+
+ # NG-selfservice
+
+ install -d ${TMP}-ng-selfservice$(APACHE_DOCUMENT_ROOT)/
+ cp -R ng_selfservice ${TMP}-ng-selfservice$(APACHE_DOCUMENT_ROOT)/ng_selfservice-DIST/
+
+ # Torrus
+
+ install -d ${TORRUS_CONF}
+ install -o root -m 755 htetc/freeside-torrus.conf $(TORRUS_CONF)/
+
+ ( cd torrus; \
+ torrus_user=freeside var_user=freeside var_group=freeside ./configure; \
+ $(MAKE) -e DESTDIR=${TMP}-torrus/; \
+ $(MAKE) -e DESTDIR=${TMP}-torrus/ install; \
+ perl -p -i -e "\
+ s'%%%FREESIDE_URL%%%'${FREESIDE_URL}'g;\
+ " ${TMP}-torrus/usr/local/etc/torrus/conf/torrus-siteconfig.pl )
+
+ #RT Config
+
+ ( cd rt; \
+ cp config.layout.in config.layout; \
+ perl -p -i -e "\
+ s'%%%FREESIDE_DOCUMENT_ROOT%%%'${FREESIDE_DOCUMENT_ROOT}'g;\
+ s'%%%MASONDATA%%%'${FREESIDE_CACHE}/masondata'g;\
+ " config.layout; \
+ ./configure --prefix=${RT_PATH} \
+ --enable-layout=Freeside \
+ --with-db-type=Pg \
+ --with-db-dba=freeside \
+ --with-db-database=freeside \
+ --with-db-rt-user=freeside \
+ --with-db-rt-pass="" \
+ --with-web-user=freeside \
+ --with-web-group=freeside \
+ --with-rt-group=freeside \
+ --with-web-handler=modperl2 )
+
+ ##(create-rt)
+ #$(MAKE) -e DESTDIR=${TMP}-lib create-rt
+ install -d $(RT_PATH)
+ install -d $(RT_PATH)/share
+
+ ( cd rt; $(MAKE) config-install dirs files-install fixperms instruct )
+ cp -r ${RT_PATH}/share/static/images ${FREESIDE_DOCUMENT_ROOT}/rt/NoAuth/
+
+ ##hack the build dir out of RT. yeah, sucky.
+
+ perl -p -i -e "\
+ s'${TMP}(-webui)''g;\
+ s'${TMP}''g;\
+ " ${TMP}/opt/rt3/etc/*.pm \
+ ${TMP}/opt/rt3/lib/*.pm \
+ ${TMP}/opt/rt3/lib/RT/*.pm \
+ ${TMP}/opt/rt3/etc/upgrade/* \
+ ${TMP}/opt/rt3/sbin/* \
+ ${TMP}/opt/rt3/bin/* \
+
+ # Default RT Settings
+ perl -p -i -e "\
+ s'%%%RT_DOMAIN%%%'${RT_DOMAIN}'g;\
+ s'%%%RT_TIMEZONE%%%'${RT_TIMEZONE}'g;\
+ s'%%%FREESIDE_URL%%%'${FREESIDE_URL}'g;\
+ " ${RT_PATH}/etc/RT_SiteConfig.pm
+
+ dh_install
+
+ #touch $@
+
+binary-arch:
+# We have nothing to do here for an architecture-independent package