#!/bin/tcsh
#   /***************************************************************************
#   **                                                                        **
#   **  License                                                               **
#   **  =======                                                               **
#   **                                                                        **
#   **  This software program is released under the terms of a license        **
#   **  agreement between you ('Licensee') and Intel. Do not use or load this **
#   **  software or any associated materials (collectively, the 'Software')   **
#   **  until you have carefully read the full terms and conditions of the    **
#   **  LICENSE located in this software package. By loading or using the     **
#   **  Software, you agree to the terms of this Agreement. If you do not     **
#   **  agree with the terms of this Agreement, do not install or use the     **
#   **  Software.                                                             **
#   ***************************************************************************/
#
#   /***************************************************************************
#   **                                                                                                                                                                 **
#   ** INTEL CORPORATION                                                                                                                **
#   **                                                                                                                                                                 **
#   ** This software is supplied under the terms of the license included                                          **
#   ** above.  All use of this software must be in accordance with the terms                                  **
#   ** of that license.                                                                                                                                      **
#   **                                                                                                                                                                  **
#   **  Abstract:                                                                                                                                              **
#   **    Installation script for PROCfg                                                                                                      **
#   **                                                                                                                                                                 **
#   ***************************************************************************/

set installdir="/usr/sbin"
echo -n "installing procfg in $installdir... "
cp procfg $installdir || echo "failed" && exit 1
echo "OK"

set man_cfg=/etc/man.confg
set man_type=man1
set dirlist=`[ -e $man_cfg ] && grep -e "^MANPATH[^_]" $man_cfg | awk '{print $2}'`
if ("$dirlist" == "") then
    set dirlist="/usr/share/man /usr/man"
endif
# prune the list down to only values that exist
foreach dir ($dirlist)
    [ -e $dir/$man_type ] && set man_path = $dir && break
end
if ("$man_path" == "") then
    set man_path = /usr/man
endif
set man_path = $man_path/$man_type

echo -n "installing procfg man page (procfg.1) in $man_path..."gzip procfg.1
rm -f $man_path/procfg.1
cp procfg.1.gz $man_path || echo "failed" && exit 1
echo "OK"

# documentation installation
set docdir="/usr/share/doc/procfg-"1.4.28""
mkdir -p $docdir
echo -n "installing documentation in $docdir..."
cp README LICENSE* ldistrib.txt $docdir || echo "failed" && exit 1
echo "OK"
