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

#Used to specify the start directory for finding acroread

setLangENU()
{
ST_LANG="ENU"
ST_LANG_SMALL="enu"
ST_READER_RPM_NAME="AdobeReader_enu"
ST_EXCHANGE_RPM_NAME="AdobeAcrobat_enu"
ST_COMMENT_WORD="Comment"
ST_DESCRIPTION_WORD="Description"
ST_COMMENT_RPM="Launch Adobe Reader 7.0"
ST_DES_RPM="Adobe Reader for Linux. An application that can view, navigate and print PDF documents."
ST_DES_TAG01="Adobe Reader can read documents in PDF format."
ST_DES_TAG02="Adobe Reader also allows you to search within PDF files,"
ST_DES_TAG03="search for PDF files on the internet and participate in collaborative document reviews."
ST_DES_TAG04="For details, please check www.adobe.com."
ST_THE_FILE="The file"
ST_FOR="for"
ST_YES="yes"
ST_NO="no"
ST_OR="or"
ST_SMALL_Y="y"
ST_SMALL_N="n"
ST_CAPS_Y="Y"
ST_CAPS_N="N"
ST_ACCEPT_CAPS="ACCEPT"
ST_DECLINE_CAPS="DECLINE"
ST_ACCEPT="accept"
ST_DECLINE="decline"
ST_VERSION="version"
ST_STATEMENT_ACCEPT_DECLINE="Please type \\\"accept\\\" to accept the terms and conditions of license agreement; Type \\\"decline\\\" to exit. "
ST_RESTATEMENT_ACCEPT_DECLINE="Invalid response, expected \\\"accept\\\" or \\\"decline\\\" ... try again ?"
ST_ER_INVALID_RESP1="ERROR: Invalid response, expected"
ST_ER_INVALID_RESP2="ERROR: Invalid response ... try again"
ST_ER_INVALID_RESP3="... try again ?"
ST_ER_NO_LIC_FILE="ERROR: Cannot find license file ... aborting"
ST_TO_ACCEPT="To accept the terms and conditions of this agreement enter"
ST_TO_DECLINE="To decline the terms and conditions of this agreement enter"
ST_REQ0101="Please type"
ST_REQ0102="to accept the terms and conditions of license agreement;"
ST_REQ0103="Type"
ST_REQ0104="to exit. "
ST_ER_LIC_NOT_ACCP="License agreement not accepted ... aborting installation"
ST_FREE_SPACE_INFO01="This installation requires"
ST_FREE_SPACE_INFO02="MB of free disk space."
ST_DONE_WORD="Done"
ST_ER_INSTALLING01="ERROR installing"
ST_ER_INSTALLING02="invalid product name"
ST_RES_INST_DIR="Enter installation directory for Adobe Reader"
ST_ER_SAME_FILE_NAME_AS_DIR="exists but is not a directory. Please specify a different location."
ST_DIR_INFO01="Directory"
ST_DIR_INFO02="does not exist."
ST_QUES_CREAT_DIR="Do you want to create it now? [y] "
ST_ER_EXIT="Exiting installation..."
ST_ER_DIR="ERROR: Cannot make directory"
ST_ER_WRITE="ERROR: Cannot write to directory"
ST_ER_NO_LIBCURL01="Not able to locate libcurl.so. Some of the functionality of Adobe Reader may be hampered."
ST_ER_NO_LIBCURL02="It is recommended to install curl ver."
ST_ER_NO_LIBCURL03="or any version later than ver."
ST_WARN_NO_LIBSSL01="WARNING: The libssl.so version on your machine is not compatible to libssl.so.0.9.6."
ST_WARN_NO_LIBSSL02="Please install libssl.so.0.9.6."
ST_WARN_LD_LIB01="exists in the directory"
ST_WARN_LD_LIB02="but this directory is not included in LD_LIBRARY_PATH."
ST_WARN_LD_LIB03="Please include the directory"
ST_WARN_LD_LIB04="in LD_LIBRARY_PATH"
ST_WARN_LD_LIB05="exists in the directory"
ST_ER_NO_CONFIG="ERROR: No configurations found ... aborting"
ST_WARN_NO_CONFIG="WARNING: The chosen configuration will not run on your current platform"
ST_QUE_CONT="Continue installation?"
ST_INFO_DEF_CONFIG1="Install default configuration"
ST_INFO_DEF_CONFIG2="The following configurations are available for installation:"
ST_QUE_CONFIG="Enter the configuration number to install: "
ST_EXIT_INFO="Exit Acrobat installation"
ST_PLAT_INDEP_FILES="Installing platform independent files ... "
ST_PLAT_DEP_FILES="Installing platform dependent files ... "
ST_RPM_CAN_NOT_DEL="could not be deleted as it has some extra file or files that were not installed by rpm"
ST_WEL_ALK="Welcome to the Asian Language Kit installation."
ST_INFO_ALK01="This installation will not work if you do not have the"
ST_INFO_ALK02="Unix Adobe Reader version 7.0 installed prior to this installation."
ST_INFO_ALK03="If you do not have Adobe Reader version 7.0 already installed on your"
ST_INFO_ALK04="system please do so before installing this Asian Language Kit."
ST_ER_ALK01="ERROR: directory must be an absolute path"
ST_ER_ALK02="ERROR: Directory "
ST_ER_ALK03="does not exist."
ST_ER_ALK04="ERROR: AcroVersion file does not exist."
ST_ER_ALK05="ERROR: Incorrect Acrobat version:"
ST_ER_ALK06="ERROR: Could not find distribution ... aborting"
ST_IF_ALK07="Enter the location where you installed the Adobe Reader"
ST_INFO_ALK_CMPLT="Installation completed."
ST_WEL_HLK="Welcome to the Extended Language Pack installation."
ST_INFO_HLK04="system please do so before installing this Extended Language Pack."
ST_INFO_HLK05="Installing Extended Language Pack Files ... "
ST_WEL_CLK="Welcome to the Central European Font Pack installation."
ST_INFO_CLK04="system please do so before installing this Central European Font Pack."
ST_INFO_CLK05="Installing Central European Language Pack Files ... "
ST_ER_AR01="ERROR: Cannot determine current directory."
ST_ER_AR02="ERROR: Cannot find installation directory."
ST_ER_AR03="ERROR: Cannot find"
ST_INFO_AR01="The OS named "
ST_INFO_AR02="is currently not installed."
ST_INFO_AR03="Try running on an installed platform and connecting to your display."
ST_INFO_AR04="Installed platform(s) include the following:"
ST_INFO_AR05="not installed for this configuration,"
ST_IBP_MISC_03="Mozilla"
ST_IBP_MISC_04="Firefox"
ST_IBP_MISC_05="Netscape"
ST_IBP_MISC_06="Quit"
ST_IBP_INFO_01="This will install the browser plugin for acroread."
ST_IBP_INFO_02="Perform global installation"
ST_IBP_INFO_03="Perform user-specific installation"
ST_IBP_INFO_04="Enter your choice"
ST_IBP_INFO_05="Do you want to install another browser ?"
ST_IBP_INFO_06="Enter the install directory for Adobe Reader 7.0"
ST_IBP_INFO_07="Enter the browser install directory"
ST_IBP_INFO_08="The plugin seems to be already installed. Are you sure you want to overwrite ?"
ST_IBP_INFO_09="Installation cancelled."
ST_IBP_INFO_10="Installation successful."
ST_IBP_INFO_11="This will enable the plugin for Mozilla, Firefox and Netscape."
ST_IBP_INFO_12="If you are facing any problem in getting the installation to work for your browser, please copy the following file to the plugin folder of the browser:"
ST_IBP_INFO_13="Acroread path specified"
ST_IBP_INFO_14="Press <Enter> to continue"
ST_IBP_INFO_15="In case of difficulties please refer to the documentation provided along with the browser for addition of new plugins."
ST_IBP_INFO_16="Installing plugin in"
ST_IBP_INFO_17="Do you want to perform automatic installation ?"
ST_IBP_INFO_18="Finished with automatic install."
ST_IBP_INFO_19="Do you want to perform manual installation ?"
ST_IBP_INFO_20="Do you want to install the browser plugin ?"
ST_IBP_INFO_21="Browser plugin installation skipped."
ST_IBP_INFO_22_1="Run"
ST_IBP_INFO_22_2="to install browser plugin."
ST_IBP_INFO_23="has been added."
ST_IBP_INFO_24="Trying to install plugin for browser"
ST_IBP_INFO_25="Installation failed"
ST_IBP_ERR_01="Could not find the browser plugin file"
ST_IBP_ERR_02="Could not find the browser plugins folder"
ST_IBP_ERR_03="Could not find the browser folder"
ST_IBP_ERR_04="Could not remove previous version of the plugin in"
ST_IBP_ERR_05_1="Could not copy the plugin file"
ST_IBP_ERR_05_2="to"
ST_IBP_ERR_06="Could not create the directory"
ST_IBP_ERR_07="Could not find browser plugin install script."
ST_IBP_ERR_08="already exists as a special file and cannot overwrite it."
ST_IBP_ERR_09="Unable to query HOME variable from the environment. Cannot find your home directory."
ST_IBP_ERR_10="Could not find the installation folder"
ST_IBP_ERR_11="INTERNAL ERROR ..... No matching OS name."
ST_SEP_INFO_01="Enter the install directory for Adobe Reader 7.0"
ST_SEP_INFO_02="INTERNAL ERROR ..... No matching OS name."
ST_SEP_INFO_03="Unable to find appropriate files in the installation path."
ST_SEP_INFO_04="Resetting old contexts"
ST_SEP_INFO_05="Setting new contexts for library files"
ST_SEP_INFO_06="This will try to update the library files to make them SELinux aware."
ST_SEP_INFO_07="Could not find the installation folder."
ST_SEP_INFO_08="Finished setting the contexts. You can check the log at"
ST_SEP_INFO_09="Failure in command"
ST_SEP_INFO_10="Patch might not have completed properly. You can check the log at"
ST_IOP_ERR1="OpenOffice PDF Plugin could not be registered. Please read the instructions in "
ST_IOP_ERR2="for manual installation."
ST_IOP_ERR3="OpenOffice >= 1.9 is required for OpenOffice PDF Plugin to run properly. Skipping registration of PDF Plugin."
ST_IOP_ERR4="OpenOffice binary soffice could not located in the specified directory."
ST_IOP_INFO_01="Please specify the directory where OpenOffice is installed: "
ST_IOP_INFO_02="Do you want to install the OpenOffice Plugin ?"
ST_IAP_ERR1="Adobe PDF Plugin could not be registered. Please follow the instructions in "
ST_IAP_INFO_01="Do you want to install the Adobe PDF plugin ?"
ST_IFE_INFO_01="Do you want to install the firefox extension ?"
ST_IFE_INFO_02="Please specify the path for Firefox executable : "
ST_IFE_ERR_01="Firefox exe not found or does not have executable permissions."
ST_IDI_INFO_01="Do you want to install the Distiller ?"
ST_MIME_INFO_01="Please login again for changes to MIME types and icons to take effect."
true
}

setLangENU
#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
