#!/bin/sh
# Generic Installation script for LoginPrompt
# Created by Daniel Berrange. Copyright 1998,1999
#
# Idea from the Window Maker Install script by Alfredo K. Kojima
#
#

echo "+==========================================================+"
echo "     LoginPrompt Installation Script"
echo "+==========================================================+"
echo
echo "------------------------------------------------------------"
echo
echo "------------------------------------------------------------"
if [ $USER != "root" ]; then
  echo "You are not root be sure to specify a installation path"
  echo "where you have write permissions"
  PACKAGE_PREFIX="$HOME/usr"
else
  PACKAGE_PREFIX="/usr/local"
fi
echo
echo "Where do you want to install LoginPrompt?"
echo "Default location is $PACKAGE_PREFIX   [bin lib include html]"
echo -n "> "
read pingu

if [ "x$pingu" != "x" ]; then
  PACKAGE_PREFIX="$pingu"
fi
PACKAGE_CONFIG_OPT=" --prefix=$PACKAGE_PREFIX"


echo
echo "------------------------------------------------------------"
echo "Do you want debugging information?"
echo "<Y/y/N/n>  [n]"
echo -n "> "
read pingu

if [ "$pingu" = "y" -o "$pingu" = "Y" ]; then
  PACKAGE_CONFIG_OPT="$PACKAGE_CONFIG_OPT --enable-debug"
else
  PACKAGE_CONFIG_OPT="$PACKAGE_CONFIG_OPT --disable-debug"
fi


echo "------------------------------------------------------------"
echo "Configuring system..."
echo "./configure $PACKAGE_CONFIG_OPT"
./configure $PACKAGE_CONFIG_OPT || exit
echo "------------------------------------------------------------"
echo "Building LoginPrompt..."
echo "make"
make || exit
echo "------------------------------------------------------------"
echo "Installing LoginPrompt..."
echo "make install"
make install || exit
echo "------------------------------------------------------------"
echo "Generating Documentation index"
sdoci $PACKAGE_PREFIX/html || exit
echo "------------------------------------------------------------"
echo "Installation complete."
echo "+==========================================================+"
