#!/bin/sh
#
# Copyright (c) 1996-2005, Adobe Systems Incorporated
# All Rights Reserved
#

#Used to specify the start directory for finding acroread

setLangFRA()
{
ST_LANG="FRA"
ST_LANG_SMALL="fra"
ST_READER_RPM_NAME="AdobeReader_fra"
ST_EXCHANGE_RPM_NAME="AdobeAcrobat_fra"
ST_COMMENT_WORD="Commentaire"
ST_DESCRIPTION_WORD="Description"
ST_COMMENT_RPM="Lancer Adobe Reader 7.0"
ST_DES_RPM="Adobe Reader pour Linux. Une application permettant de visualiser, de parcourir et d'imprimer des documents PDF."
ST_DES_TAG01="Adobe Reader permet de lire les documents au format PDF."
ST_DES_TAG02="Adobe Reader vous permet galement d'effectuer des recherches dans des fichiers PDF,"
ST_DES_TAG03="de rechercher des fichiers PDF sur Internet et de participer  des rvisions collectives de documents."
ST_DES_TAG04="Pour plus de dtails, consultez le site Web www.adobe.fr."
ST_THE_FILE="Le fichier"
ST_FOR="for"
ST_YES="oui"
ST_NO="non"
ST_OR="ou"
ST_SMALL_Y="o"
ST_SMALL_N="n"
ST_CAPS_Y="O"
ST_CAPS_N="N"
ST_ACCEPT_CAPS="ACCEPTER"
ST_DECLINE_CAPS="REFUSER"
ST_ACCEPT="accepter"
ST_DECLINE="refuser"
ST_VERSION="version"
ST_STATEMENT_ACCEPT_DECLINE="Tapez \\\"accepter\\\" pour accepter les termes du contrat de licence ou \\\"refuser\\\" pour quitter. "
ST_RESTATEMENT_ACCEPT_DECLINE="Rponse incorrecte, \\\"accepter\\\" ou \\\"refuser\\\" attendu ... ressayer ?"
ST_ER_INVALID_RESP1="ERREUR : rponse incorrecte, attente de"
ST_ER_INVALID_RESP2="ERREUR : rponse incorrecte ... ressayez"
ST_ER_INVALID_RESP3="... voulez-vous ressayer ?"
ST_ER_NO_LIC_FILE="ERREUR : fichier de licence introuvable ... abandon"
ST_TO_ACCEPT="Pour accepter les conditions de ce contrat, saisissez"
ST_TO_DECLINE="Pour refuser les conditions de ce contrat, saisissez"
ST_REQ0101="Saisissez"
ST_REQ0102="pour accepter les conditions du contrat ;"
ST_REQ0103="Saisissez"
ST_REQ0104="pour quitter. "
ST_ER_LIC_NOT_ACCP="Contrat de licence non accept ... abandon de l'installation"
ST_FREE_SPACE_INFO01="L'installation ncessite"
ST_FREE_SPACE_INFO02="Mo d'espace disque."
ST_DONE_WORD="Terminer"
ST_ER_INSTALLING01="Erreur d'installation"
ST_ER_INSTALLING02="nom de produit incorrect"
ST_RES_INST_DIR="Saisir le rpertoire d'installation pour Adobe Reader"
ST_ER_SAME_FILE_NAME_AS_DIR="existe mais n'est pas un rpertoire. Spcifiez un autre emplacement."
ST_DIR_INFO01="Le rpertoire"
ST_DIR_INFO02="n'existe pas."
ST_QUES_CREAT_DIR="Voulez-vous le crer maintenant ? [o] "
ST_ER_EXIT="Fin de l'installation..."
ST_ER_DIR="ERREUR : impossible de crer le rpertoire"
ST_ER_WRITE="ERREUR : impossible d'crire dans le rpertoire"
ST_ER_NO_LIBCURL01="Fichier libcurl.so introuvable. Certaines fonctions d'Adobe Reader risquent d'tre entraves."
ST_ER_NO_LIBCURL02="Il est recommand d'installer curl ver."
ST_ER_NO_LIBCURL03="ou une version ultrieure  ver."
ST_WARN_NO_LIBSSL01="AVERTISSEMENT : la version de libssl.so sur votre ordinateur n'est pas compatible avec libssl.so.0.9.6."
ST_WARN_NO_LIBSSL02="Installez libssl.so.0.9.6."
ST_WARN_LD_LIB01="existe dans le rpertoire"
ST_WARN_LD_LIB02="mais le rpertoire n'est pas inclus dans LD_LIBRARY_PATH."
ST_WARN_LD_LIB03="Veuillez inclure le rpertoire"
ST_WARN_LD_LIB04="dans LD_LIBRARY_PATH"
ST_WARN_LD_LIB05="existe dans le rpertoire"
ST_ER_NO_CONFIG="ERREUR : aucune configuration dtecte ... abandon"
ST_WARN_NO_CONFIG="AVERTISSEMENT : l'excution de la configuration choisie est impossible sur la plate-forme active."
ST_QUE_CONT="Voulez-vous continuer l'installation ?"
ST_INFO_DEF_CONFIG1="Installer la configuration par dfaut"
ST_INFO_DEF_CONFIG2="Les configurations suivantes sont disponibles pour l'installation :"
ST_QUE_CONFIG="Saisir le numro de configuration  installer : "
ST_EXIT_INFO="Quitter le programme d'installation d'Acrobat"
ST_PLAT_INDEP_FILES="Installation des fichiers indpendants de la plate-forme... "
ST_PLAT_DEP_FILES="Installation des fichiers dpendants de la plate-forme... "
ST_RPM_CAN_NOT_DEL="suppression impossible, car des fichiers supplmentaires n'ont pas t installs par RPM"
ST_WEL_ALK="Bienvenue dans le programme d'installation du kit de langues asiatiques"
ST_INFO_ALK01="Cette installation ne fonctionne pas sans"
ST_INFO_ALK02="l'installation pralable d'Adobe Reader pour Unix version 7.0."
ST_INFO_ALK03="Si vous ne disposez pas d'Adobe Reader version 7.0 sur votre"
ST_INFO_ALK04="systme, installez-le avant de procder  l'installation du kit de langues asiatiques."
ST_ER_ALK01="ERREUR : le rpertoire doit tre un chemin absolu."
ST_ER_ALK02="ERREUR : le rpertoire "
ST_ER_ALK03="n'existe pas."
ST_ER_ALK04="ERREUR : le fichier AcroVersion n'existe pas."
ST_ER_ALK05="ERREUR : version d'Acrobat incorrecte :"
ST_ER_ALK06="ERREUR : distribution introuvable ... abandon"
ST_IF_ALK07="Saisir l'emplacement d'installation d'Adobe Reader"
ST_INFO_ALK_CMPLT="Installation termine."
ST_WEL_HLK="Programme d'installation du module tendu de prise en charge linguistique."
ST_INFO_HLK04="systme, installez-le avant de procder  l'installation du module tendu de prise en charge linguistique."
ST_INFO_HLK05="Installation des fichiers du module tendu de prise en charge linguistique... "
ST_WEL_CLK="Programme d'installation du module de prise en charge des polices de caractres d'Europe centrale."
ST_INFO_CLK04="systme, installez-le avant de procder  l'installation du module de prise en charge des polices de caractres d'Europe centrale."
ST_INFO_CLK05="Installation des fichiers du module de prise en charge linguistique d'Europe centrale... "
ST_ER_AR01="ERREUR : impossible de dterminer le rpertoire actuel"
ST_ER_AR02="ERREUR : rpertoire d'installation introuvable"
ST_ER_AR03="ERREUR : impossible de trouver"
ST_INFO_AR01="Le systme d'exploitation "
ST_INFO_AR02="n'est pas install."
ST_INFO_AR03="Essayez l'excution sur une plate-forme installe, puis tablissez une connexion  votre cran."
ST_INFO_AR04="Parmi les plate-formes installes figurent les suivantes :"
ST_INFO_AR05="n'est pas install pour cette configuration,"
ST_IBP_MISC_03="Mozilla"
ST_IBP_MISC_04="Firefox"
ST_IBP_MISC_05="Netscape"
ST_IBP_MISC_06="Quitter"
ST_IBP_INFO_01="L'installation du module externe de navigation pour acroread va s'effectuer."
ST_IBP_INFO_02="Effectuer l'installation globale"
ST_IBP_INFO_03="Effectuer l'installation spcifique  l'utilisateur"
ST_IBP_INFO_04="Saisir la slection voulue"
ST_IBP_INFO_05="Voulez-vous installer un autre navigateur ?"
ST_IBP_INFO_06="Entrer le rpertoire d'installation pour Adobe Reader 7.0"
ST_IBP_INFO_07="Entrer le rpertoire d'installation du navigateur"
ST_IBP_INFO_08="Le module externe est dj install. Voulez-vous vraiment le remplacer? "
ST_IBP_INFO_09="Installation annule"
ST_IBP_INFO_10="Installation russie."
ST_IBP_INFO_11="Cela va activer le module externe pour Mozilla, Firefox et Netscape."
ST_IBP_INFO_12="Si vous rencontrez un problme lors de l'installation pour votre navigateur, copiez le fichier suivant dans le dossier plugin du navigateur :"
ST_IBP_INFO_13="chemin Acroread spcifi"
ST_IBP_INFO_14="Appuyez sur Entre pour continuer"
ST_IBP_INFO_15="En cas de difficults, reportez-vous  la documentation accompagnant le navigateur pour des informations supplmentaires relatives aux nouveaux modules externes."
ST_IBP_INFO_16="Installation du module externe dans"
ST_IBP_INFO_17="Voulez-vous effectuer une installation automatique ?"
ST_IBP_INFO_18="Installation automatique termine."
ST_IBP_INFO_19="Voulez-vous effectuer une installation manuelle ?"
ST_IBP_INFO_20="Voulez-vous installer le module externe de navigation ?"
ST_IBP_INFO_21="Installation du module externe de navigation ignore."
ST_IBP_INFO_22_1="Excuter"
ST_IBP_INFO_22_2="pour installer le module externe de navigation."
ST_IBP_INFO_23="a t ajout."
ST_IBP_INFO_24="Tentative d'installation du module externe pour le navigateur"
ST_IBP_INFO_25="Echec de l'installation"
ST_IBP_ERR_01="Fichier du module externe de navigation introuvable"
ST_IBP_ERR_02="Dossier des modules externes de navigation introuvable"
ST_IBP_ERR_03="Dossier du navigateur introuvable"
ST_IBP_ERR_04="Impossible de supprimer la version prcdente du module externe de"
ST_IBP_ERR_05_1="Impossible de copier le fichier du module externe"
ST_IBP_ERR_05_2="vers"
ST_IBP_ERR_06="Impossible de crer le rpertoire"
ST_IBP_ERR_07="Script d'installation du module externe de navigation introuvable."
ST_IBP_ERR_08="existe dj comme fichier spcial et ne peut pas le remplacer."
ST_IBP_ERR_09="Impossible d'obtenir la variable HOME dans l'environnement. Rpertoire de base introuvable."
ST_IBP_ERR_10="Dossier d'installation introuvable"
ST_IBP_ERR_11="ERREUR INTERNE... Aucun nom de systme d'exploitation correspondant."
ST_SEP_INFO_01="Entrer le rpertoire d'installation pour Adobe Reader 7.0"
ST_SEP_INFO_02="ERREUR INTERNE... Aucun nom de systme d'exploitation correspondant."
ST_SEP_INFO_03="Fichiers appropris introuvables dans le chemin d'installation."
ST_SEP_INFO_04="Rinitialisation des anciens contextes"
ST_SEP_INFO_05="Dfinition de nouveaux contextes pour les fichiers de bibliothque"
ST_SEP_INFO_06="Les fichiers de bibliothque seront mis  jour pour les rendre compatibles avec SELinux."
ST_SEP_INFO_07="Dossier d'installation introuvable."
ST_SEP_INFO_08="Dfinition des contextes termine. Consultez le journal sur"
ST_SEP_INFO_09="Echec de la commande"
ST_SEP_INFO_10="Le correctif n'est peut-tre pas correctement install. Consultez le journal sur"
ST_IOP_ERR1="Le module externe OpenOffice PDF n'a pas pu tre enregistr. Lisez les instructions dans "
ST_IOP_ERR2="pour l'installation manuelle."
ST_IOP_ERR3="L'excution du module externe OpenOffice PDF requiert OpenOffice >= 1.9. Etape d'enregistrement du module ignore."
ST_IOP_ERR4="Le fichier binaire soffice d'OpenOffice est introuvable dans le rpertoire spcifi."
ST_IOP_INFO_01="Spcifiez le rpertoire d'installation d'OpenOffice : "
ST_IOP_INFO_02="Voulez-vous installer le module externe OpenOffice ?"
ST_IAP_ERR1="Le module externe Adobe PDF n'a pas pu tre enregistr. Rfrez-vous aux instructions dans "
ST_IAP_INFO_01="Voulez-vous installer le module externe Adobe PDF ?"
ST_IFE_INFO_01="Voulez-vous installer le module externe de l'extension Firefox ?"
ST_IFE_INFO_02="Indiquez le chemin d'accs du fichier d'excution de Firefox : "
ST_IFE_ERR_01="Le fichier d'excution de Firefox est introuvable ou ne dispose pas d'autorisations d'excution."
ST_IDI_INFO_01="Voulez-vous installer Distiller ?"
ST_MIME_INFO_01="Ouvrez une nouvelle session pour appliquer les modifications apportes aux types et icnes MIME."
true
}

setLangFRA
#Used to specify the start directory for finding acroread
SCRIPT_PATH=

#Contains the install directory path for acroread
ACROREAD_DIR=

#Contains the complete path of the browser plugin
NPPDF_FILE=

#Maintains whether we need to continue with the installation and repeat it for more browsers
INSTALL_MORE="y"


#This function gets the complete path of this script.
GetScriptPath()
{
	CURRENT_PATH=`pwd`
	SCRIPT_PATH=`dirname "$0"`
	COMPLETE_PATH="${SCRIPT_PATH}/../"
	cd "$COMPLETE_PATH"
	SCRIPT_PATH=`pwd`
	cd "$CURRENT_PATH"
}


#This function installs the plugin for a specific installation of the browser.
#If the installation is successful, then whenever the browser (specified in the browser install path) is run, for any user, it will have the plugin enabled.
#The way to achieve this is to look for the 'plugins' folder in the browser install path (specified by the user), and copy our plugin file to this location.
#If the plugin already exists, we prompt the user whether to overwrite or not, and proceed accordingly.
#This mechanism has been tested for Mozilla and Firefox. In both these browsers, the app searches for extensions/plugins in the 'plugins' folder.
InstallBrowserGlobal()
{
    if [ -z "$NPPDF_FILE" ]
	then
	return 1
    fi

    #Fetch the browser location
    if [ $# -eq 0 ]
	then
	BROWSER_DIR=""
	while [ -z "$BROWSER_DIR" ]
	  do
	  printf "$ST_IBP_INFO_07 - \n"
	  read BROWSER_DIR
	done
    else
	BROWSER_DIR=$1
    fi
	
    #Check existence of browser folder
    if [ ! -d "$BROWSER_DIR" ]
	then
	echo "$ST_IBP_ERR_03 ${BROWSER_DIR}"
	return 1
    fi

    #Check existence of 'plugin' folder in the browser folder
    BROWSER_PLUGIN_DIR="${BROWSER_DIR}/plugins"
    if [ ! -d "$BROWSER_PLUGIN_DIR" ]
	then
	echo "$ST_IBP_ERR_02 ${BROWSER_PLUGIN_DIR}"
	return 1
    fi

    #Check whether plugin already exists
    if [ "$OSNAME" = "HP-UX" ]
        then
	BROWSER_PLUGIN_FILE="${BROWSER_PLUGIN_DIR}/nppdf.sl"
    else
	BROWSER_PLUGIN_FILE="${BROWSER_PLUGIN_DIR}/nppdf.so"
    fi

    if [ -f "$BROWSER_PLUGIN_FILE" ] || [ -h "$BROWSER_PLUGIN_FILE" ]
	then
	while :
	  do
	  printf "$ST_IBP_INFO_08 [$ST_SMALL_Y/$ST_SMALL_N] \n"
	  read USER_CHOICE
	  
	  if [ "$USER_CHOICE" = "$ST_SMALL_Y" ] || [ "$USER_CHOICE" = "$ST_CAPS_Y" ] || [ -z "$USER_CHOICE" ]
	      then
	      rm -f "$BROWSER_PLUGIN_FILE"
	      if [ $? -ne 0 ]
		  then
		  echo "$ST_IBP_ERR_04 ${BROWSER_PLUGIN_DIR}"
		  return 1
	      fi
	      break
	  elif [ "$USER_CHOICE" = "$ST_SMALL_N" ] || [ "$USER_CHOICE" = "$ST_CAPS_N" ]
	      then
	      echo "$ST_IBP_INFO_09"
	      return 0
	      break
	  fi
	done
    elif [ -b "$BROWSER_PLUGIN_FILE" ] || [ -c "$BROWSER_PLUGIN_FILE" ] || [ -d "$BROWSER_PLUGIN_FILE" ]
	then
	echo "$BROWSER_PLUGIN_FILE $ST_IBP_ERR_08"
	return 1
    fi
    
    #Copy the browser plugin file to the correct location
    cp "$NPPDF_FILE" "$BROWSER_PLUGIN_FILE"
    if [ $? -ne 0 ]
	then
	echo "$ST_IBP_ERR_05_1 ${NPPDF_FILE} $ST_IBP_ERR_05_2 ${BROWSER_PLUGIN_FILE}"
	return 1
    else
	echo "$ST_IBP_INFO_10 ${BROWSER_PLUGIN_FILE}"
	return 0
    fi
}


#This function installs the plugin for the current user only.
#If the installation is successful, then whenever Mozilla or Firefox is run, from anywhere, it will have the plugin enabled.
#The way to achieve this is to copy our plugin file in the .mozilla/plugins folder in the users' home directory.
#If the folder does not exist, we create it, and if the plugin already exists, we prompt the user whether to overwrite or not, and proceed accordingly.
#This mechanism has been tested for Mozilla and Firefox. In both these browsers, the app searches for extensions/plugins in ~/.mozilla/plugins folder.
InstallBrowserUser()
{
    if [ -z "$NPPDF_FILE" ]
	then
	return 1
    fi
    
    if [ -d "$HOME" ]
	then
	USER_DIR="$HOME"
    else
	echo "$ST_IBP_ERR_09"
	return 1
    fi

    #Create the .mozilla & plugins folders if required
    BROWSER_DIR="$USER_DIR/.mozilla"
    if [ ! -d "$BROWSER_DIR" ]
	then
	mkdir "$BROWSER_DIR"
	if [ $? -ne 0 ]
	    then
	    echo "$ST_IBP_ERR_06 ${BROWSER_DIR}"
	    return 1
	fi
    fi
    
    BROWSER_PLUGIN_DIR="${BROWSER_DIR}/plugins"
    if [ ! -d "$BROWSER_PLUGIN_DIR" ]
	then
	mkdir "$BROWSER_PLUGIN_DIR"
	if [ $? -ne 0 ]
	    then
	    echo "$ST_IBP_ERR_06 ${BROWSER_PLUGIN_DIR}"
	    return 1
	fi
    fi
    
    #Check whether the plugin already exists
    if [ "$OSNAME" = "HP-UX" ]
        then
	BROWSER_PLUGIN_FILE="${BROWSER_PLUGIN_DIR}/nppdf.sl"
    else
	BROWSER_PLUGIN_FILE="${BROWSER_PLUGIN_DIR}/nppdf.so"
    fi

    if [ -f "$BROWSER_PLUGIN_FILE" ] || [ -h "$BROWSER_PLUGIN_FILE" ]
	then
	while :
	  do
	  printf "$ST_IBP_INFO_08 [$ST_SMALL_Y/$ST_SMALL_N] \n"
	  read USER_CHOICE
	  
	  if [ "$USER_CHOICE" = "$ST_SMALL_Y" ] || [ "$USER_CHOICE" = "$ST_CAPS_Y" ] || [ -z "$USER_CHOICE" ]
	      then
	      rm -f "$BROWSER_PLUGIN_FILE"
	      if [ $? -ne 0 ]
		  then
		  echo "$ST_IBP_ERR_04 ${BROWSER_PLUGIN_DIR}"
		  return 1
	      fi
	      break
	  elif [ "$USER_CHOICE" = "$ST_SMALL_N" ] || [ "$USER_CHOICE" = "$ST_CAPS_N" ]
	      then
	      echo "$ST_IBP_INFO_09"
	      return 0
	      break
	  fi
	done
    elif [ -b "$BROWSER_PLUGIN_FILE" ] || [ -c "$BROWSER_PLUGIN_FILE" ] || [ -d "$BROWSER_PLUGIN_FILE" ]
	then
	echo "$BROWSER_PLUGIN_FILE $ST_IBP_ERR_08"
	return 1
    fi
    
    #Copy the browser plugin file to the correct location
    cp "$NPPDF_FILE" "$BROWSER_PLUGIN_FILE"
    if [ $? -ne 0 ]
	then
	echo "$ST_IBP_ERR_05_1 ${NPPDF_FILE} $ST_IBP_ERR_05_2 ${BROWSER_PLUGIN_FILE}"
	return 1
    fi
    
    echo "$ST_IBP_INFO_10"
    echo "${BROWSER_PLUGIN_FILE} $ST_IBP_INFO_23"
    echo "$ST_IBP_INFO_11"
}


#
# Check a given file in given path
# 1 imples file exists and 0 implies file does not exist
#
check_file_in_named_path()
{
    if [ -x "$2/$1" ]
	then
 	return 1
    fi
    
    return 0
}


#
# Check a given file in $PATH
# 1 imples file exists and 0 implies file does not exist
#
check_file_in_path()
{
    OLD_IFS=$IFS
    IFS=":"
    FOUND_PATH=""

    if [ -n "$PATH" ]
	then
 	for i in $PATH
	  do
	  if [ -d "$i" ]
	      then
	      check_file_in_named_path "$1" "$i"
	      if [ $? -eq 1 ]
		  then
		  FOUND_PATH="${i}/$1"
		  IFS=$OLD_IFS
		  return 1
	      fi
	  fi
 	done
    fi
    
    IFS=$OLD_IFS
    return 0
}


GetAbsoluteFile()
{
    if [ -h "$1" ]
	then
	CURRENT_PATH=`pwd`
	cd `dirname $1`
	COMPLETE_PATH=`ls -l $1 | awk '{ print $NF }'`
	COMPLETE_PATH_DIR=`dirname $COMPLETE_PATH`
	COMPLETE_PATH_FILE=`basename $COMPLETE_PATH`
	cd $COMPLETE_PATH_DIR
	COMPLETE_PATH_DIR=`pwd`
	cd "$CURRENT_PATH"
	GetAbsoluteFile ${COMPLETE_PATH_DIR}/${COMPLETE_PATH_FILE}
    else
	echo "$1"
	return 0
    fi
}


AutoInstallBrowser()
{
    echo "$ST_IBP_INFO_24 - $1"
    check_file_in_path $1
    if [ $? -eq 1 ]
	then
	FOUND_PATH=`GetAbsoluteFile $FOUND_PATH`
	echo "$ST_IBP_INFO_16 $FOUND_PATH"
	InstallBrowserGlobal `dirname $FOUND_PATH`
	if [ $? -eq 0 ]
	    then
	    return 0
	else
	    echo "$ST_IBP_INFO_25"
	    return 1
	fi
    else
	echo "$ST_IBP_INFO_25"
	return 1
    fi
}


AutoInstall()
{
    AUTO_INSTALL_SUCCESS=0

    while :
      do
      printf "$ST_IBP_INFO_17 [$ST_SMALL_Y/$ST_SMALL_N] \n"
      read USER_CHOICE
      
      if [ "$USER_CHOICE" = "$ST_SMALL_Y" ] || [ "$USER_CHOICE" = "$ST_CAPS_Y" ] || [ -z "$USER_CHOICE" ]
	  then
	  break
      elif [ "$USER_CHOICE" = "$ST_SMALL_N" ] || [ "$USER_CHOICE" = "$ST_CAPS_N" ]
	  then
	  return 0
	  break
      fi
    done
    
    echo ""
    echo ""
    AutoInstallBrowser "firefox"
    if [ $? -eq 0 ]
	then
	AUTO_INSTALL_SUCCESS=1
    fi

    echo ""
    echo ""
    AutoInstallBrowser "mozilla"
    if [ $? -eq 0 ]
	then
	AUTO_INSTALL_SUCCESS=1
    fi

    echo ""
    echo ""
    if [ $AUTO_INSTALL_SUCCESS -eq 1 ]
	then
	echo "$ST_IBP_INFO_18"
	return 0
    else
	return 0
    fi
}


#This function fetches the installation path if not specified and validates the existance of the plugin file.
GetAcroreadInfo()
{
    #Prompt the user for acroread's installation path if not specified on the command prompt
    if [ -z "$1" ]
	then
	GetScriptPath
	printf "$ST_IBP_INFO_06 [${SCRIPT_PATH}] \n"
	read ACROREAD_DIR
	if [ -z "$ACROREAD_DIR" ]
	    then
	    ACROREAD_DIR="$SCRIPT_PATH"
	fi
    else
	ACROREAD_DIR="$1"
    fi

    OSNAME=`uname -s`
    if [ "$OSNAME" = "Linux" ]
	then
	CONFIG_FOLDER="intellinux"
    elif [ "$OSNAME" = "SunOS" ]
	then
	CONFIG_FOLDER="sparcsolaris"
    elif [ "$OSNAME" = "AIX" ]
        then
	CONFIG_FOLDER="rs6000aix"
    elif [ "$OSNAME" = "HP-UX" ]
        then
	CONFIG_FOLDER="hppahpux"
    else
	echo "$ST_IBP_ERR_11"
	return 1
    fi

    #Check for the plugin file
    if [ "$OSNAME" = "HP-UX" ]
        then
	NPPDF_FILE="${ACROREAD_DIR}/Browser/${CONFIG_FOLDER}/nppdf.sl"
    else
	NPPDF_FILE="${ACROREAD_DIR}/Browser/${CONFIG_FOLDER}/nppdf.so"
    fi

    if [ ! -f "$NPPDF_FILE" ]
	then
	echo "$ST_IBP_ERR_01 ${NPPDF_FILE}"
	return 1
    fi
}


Init()
{
    clear
    echo "$ST_IBP_INFO_01"
    echo ""
    GetAcroreadInfo "$1"
    if [ $? -ne 0 ]
	then
	return 1
    fi

    if [ ! -d "$ACROREAD_DIR" ]
	then
	echo "$ST_IBP_ERR_10 - $ACROREAD_DIR"
	return 1
    fi

    AutoInstall
    if [ $? -eq 1 ]
	then
	return 0
    fi

    while :
      do
      printf "$ST_IBP_INFO_19 [$ST_SMALL_Y/$ST_SMALL_N] \n"
      read USER_CHOICE
      
      if [ "$USER_CHOICE" = "$ST_SMALL_Y" ] || [ "$USER_CHOICE" = "$ST_CAPS_Y" ] || [ -z "$USER_CHOICE" ]
	  then
	  break
      elif [ "$USER_CHOICE" = "$ST_SMALL_N" ] || [ "$USER_CHOICE" = "$ST_CAPS_N" ]
	  then
	  return 0
	  break
      fi
    done

    while :
      do
      clear
      echo "$ST_IBP_INFO_13 - $ACROREAD_DIR"
      echo ""
      echo "1. $ST_IBP_INFO_02"
      echo "2. $ST_IBP_INFO_03 ($ST_IBP_MISC_03/$ST_IBP_MISC_04/$ST_IBP_MISC_05)"
      echo "3. $ST_IBP_MISC_06"
      printf "$ST_IBP_INFO_04 [1/2/3] \n"
      read INSTALL_CHOICE
    
      if [ -n "$INSTALL_CHOICE" ]
	  then
	  if [ $INSTALL_CHOICE -eq 1 ]
	      then
	      echo ""
	      echo ""
	      InstallBrowserGlobal
	      printf "$ST_IBP_INFO_14 ... \n"
	      read DUMMY
	  elif [ $INSTALL_CHOICE -eq 2 ]
	      then
	      echo ""
	      echo ""
	      InstallBrowserUser
	      printf "$ST_IBP_INFO_14 ... \n"
	      read DUMMY
	  elif [ $INSTALL_CHOICE -eq 3 ]
	      then
	      return 0
	  fi
      fi
    done

    return 0
}

EndingMessage()
{
    echo ""
    echo ""
    echo "$ST_IBP_INFO_12"
    echo "${NPPDF_FILE}"
    echo ""
    echo "$ST_IBP_INFO_15"
}

trap 'EndingMessage; exit 0' 2
Init "$1"
EndingMessage
