#!/bin/csh -f

echo "Do NOT run these commands as a script : read the comments and choose the options carefully"
echo "The examples below are appropriate for the 2021.07.22 installation on ipp117 for user 'ipp'"
exit 2

# below are commands to configure ippMonitor

# we have moved all user/password info into config.dat (see config.dat.in for an example)

# --site defines the location of the ipp configuration site-specific information
# note that we have a special version for ippmonitor without $PSCONFIG/$PSCONFDIR values:
# --site ~/ippconfig/ippmonitor.config

# Set psconfig to use a different build from the standard ops tag.
# This allows testing of those parts of ippMonitor which depend on IPP
# code without modifying the operational installation

# The choice of psconfig also depends on which user account is used to
# build/install ippMonitor, so be careful when doing a new check-out
# of the code for a different user.

# The value also needs to match the PATH entry in ~/ippconfig/ippmonitor.config

# Choose an appropriate psconfig (must exist and match PATH in ~/ippconfig/ippmonitor.config)
# It also must be built for the same O/S as the install machine
# for example:
psconfig ipp-20210708-gentoo

# Copy these files and modify them.
# config.dat is used to generate the site.php file installed in the htdocs location
cp config.dat.in config.dat

# czarconfig.xml is used by czarpool.pl
cp czartool/czarconfig.xml.in czartool/czarconfig.xml

# run psconfigure to generate Makefile and raw/site.php 
# DO NOT check site.php into the svn tree 
# $CZARPLOTDIR and $METRICSPLOTDIR will be generated as links in the same folder as ippMonitor  
# the structure of the names for these two directories are defined in Makefile.in a

# pltdir is for ippMetrics and czartool_plots hyperlinked from /export/ipp113.0/ipp/ in /var/www/localhost/htdocs/ippMonitor
# pltdir in ipp117 is /var/www/localhost/htdocs/ippMonitor
# ippMetrics -> /export/ipp113.0/ipp/ippMetrics/
# czartool_plots -> /export/ipp113.0/ipp/czartool_plots/
# --usePDO selects a modern PHP/mysql interface
#psconfigure --htdocs /var/www/localhost/htdocs --wwwbin /var/www/localhost/wwwbin --pltdir /var/www/localhost/htdocs/ippMonitor --site ~/ippconfig/ippmonitor.config --usePDO
# for ippm@grens1
psconfigure --htdocs /var/www/html --wwwbin /var/www/html/wwwbin --pltdir /var/www/html/ippMonitor --site ~/ippconfig/ippmonitor.config --usePDO

# note that modern php requires the use of PDO, the older MDB2 and DB mysql interfaces have been deprecated

## NOTES:
## psconfigure defines the --prefix and related options based on the psconfig system
## The --wwwbin option sets the location of the ippMonitor scripts.  
## If not specified here, this defaults to $prefix/wwwbin.  
## In order to keep the development and operational systems distinct, it is useful to assign the wwwbin under /var/www
## For an initial installation, you may need to create /var/www/localhost/wwwbin

# install the php code:
# czartool_plots and ippMetrics will be linked to different path in different hostnames 
make

# czarpoll.pl and roboczar.pl should be launched within 'screen' processes, traditionally
# named CzarPoll and Roboczar
 
