#!/bin/csh -f
#*******************************************************************************
#*                                                                             *
#*  install-acroread - Linux Fedora Installer for Adobe Acrobat Reader 9.5.5-1 *
#*                                                                             *
#*******************************************************************************
#
# 

onintr CLEAN_UP

set DEBUG       = 0
set NO_DIR      = "NO_DIR_4776540"
set INSTALL_DIR = "${NO_DIR}"

@ VERBOSE = 0

set REMOVE_INSTALL_DIR = 0

# ---------------------------------------- #
# Check the shell input and output sources #
# ---------------------------------------- #

# ------------------------------------------------------------------------
# https://www.tutorialspoint.com/unix/unix-basic-operators.htm
# https://stackoverflow.com/questions/911168/how-to-detect-if-my-shell-script-is-running-through-a-pipe
# ------------------------------------------------------------------------

/bin/test -t 0 ; set TERM_STDIN  = $status
/bin/test -t 1 ; set TERM_STDOUT = $status

/bin/test -p /dev/stdin  ; set PIPE_STDIN  = $status
/bin/test -p /dev/stdout ; set PIPE_STDOUT = $status

# ----------------------------------------------------------
if ( -t 0 ) then
	set INPUT_SRC = TERM
	if ( ( $TERM_STDIN != 0 ) || ( $PIPE_STDIN == 0 ) ) then
		echo ""
		echo "*** WARNING: Could not determine the shell input source."
		echo "Assuming the shell input source is a terminal."
		echo ""
	endif
else
	set INPUT_SRC = PIPE
	if ( ( $TERM_STDIN == 0 ) || ( $PIPE_STDIN != 0 ) ) then
		echo ""
		echo "*** WARNING: Could not determine the shell input source."
		echo "Assuming the shell input source is a pipe or a file."
		echo ""
	endif
endif

# ------------------------------------------------------------
if ( -t 1 ) then
	set OUTPUT_DST = TERM
	if ( ( $TERM_STDOUT != 0 ) || ( $PIPE_STDOUT == 0 ) ) then
		echo ""
		echo "*** WARNING: Could not determine the shell output destination."
		echo "Assuming the shell output destination is a terminal."
		echo ""
	endif
else
	set OUTPUT_DST = PIPE
	if ( ( $TERM_STDOUT == 0 ) || ( $PIPE_STDOUT != 0 ) ) then
		echo ""
		echo "*** WARNING: Could not determine the shell output destination."
		echo "Assuming the shell output destination is a pipe or a file."
		echo ""
	endif
endif

if ( "${INPUT_SRC}" == "TERM" ) then
	set INTERACTIVE = 1
	set ECHO_N = 'echo -n'
else
	set INTERACTIVE = 0
	set ECHO_N = 'echo'
endif

set MY_RELEASE_DATE = "2021-05-21"
set MY_AUTHOR       = "Freddy Jensen (https://www.linkedin.com/in/freddyjensen/)"
set MY_VERSION      = "Linux Fedora Installer 2021-05-21-Version-1.0.3 for Adobe Acrobat Reader 9.5.5-1"

if ($DEBUG == 1) then
	echo ""
	echo Release Date: ${MY_RELEASE_DATE}
	echo ""
	echo Author: ${MY_AUTHOR}
	echo ""
	echo Release Vers: ${MY_VERSION}
	echo ""
	echo "INPUT  = " $INPUT_SRC
	echo "OUTPUT = " $OUTPUT_DST
endif

set TMP_DIR  = /tmp/Acroread_47_tmp_dir.$$
set TMP_FILE = /tmp/Acroread_47_tmp_file.$$

if ( $#argv >= 1 ) then

	if ( ( "${argv[1]}" == "-usage" ) || ( "${argv[1]}" == "-help" ) ) then
		#
		# install-acroread -usage
		# install-acroread -usage a b c
		#
		goto USAGE
	endif

	if ( "${argv[1]}" == "-history" ) then
		#
		# install-acroread -history
		# install-acroread -history a b c
		#
		goto HISTORY
	endif

endif

if ( $#argv >= 1 ) then
	#
	# install-acroread [ -v | -vv ]
	# install-acroread [ -v | -vv ] dir
	# install-acroread dir
	#
	if ( ( "${argv[1]}" == "-v" ) || ( "${argv[1]}" == "-vv" ) ) then
		#
		# install-acroread [ -v | -vv ]
		# install-acroread [ -v | -vv ] dir
		# install-acroread [ -v | -vv ] -abc
		# install-acroread [ -v | -vv ] -abc dir
		#
		if ( "${argv[1]}" == "-v" ) then
			@ VERBOSE = 1
		else
			@ VERBOSE = 2
		endif

		shift # shift all arguments left

		if ( $#argv >= 1 ) then
			#
			# install-acroread [ -v | -vv ] dir
			# install-acroread [ -v | -vv ] -abc
			# install-acroread [ -v | -vv ] -abc dir
			#
			# Check if it is an option.
			#
			echo "${argv[1]}" | grep "^-" >& /dev/null
			if ( $status == 0 ) then
				#
				# install-acroread [ -v | -vv ]
				# install-acroread [ -v | -vv ] [ -v | -vv ] -abc
				# install-acroread [ -v | -vv ]-abc dir
				#
				goto TOO_MANY_OPTIONS
			else
				set INSTALL_DIR = "${argv[1]}"
				shift # shift all arguments left
				if ( $#argv >= 1 ) then
					#
					# install-acroread [ -v | -vv ] abc -x
					# install-acroread [ -v | -vv ] abc def
					#
					goto TOO_MANY_OPTIONS
				endif
			endif
		else
			#
			# install-acroread [ -v | -vv ]
			#
		endif
	else
		#
		# install-acroread dir1
		# install-acroread dir1 dir2
		# install-acroread -abc
		# install-acroread -abc dir
		#
		# Check if it is an option.
		#
		echo "${argv[1]}" | grep "^-" >& /dev/null
		if ( $status == 0 ) then
			#
			# install-acroread -abc
			# install-acroread -abc dir
			#
			goto INVALID_OPTION
		else
			#
			# install-acroread dir1
			# install-acroread dir1 dir2
			#
			set INSTALL_DIR = "${argv[1]}"
			shift # shift all arguments left
			if ( $#argv >= 1 ) then
				#
				# install-acroread dir1 dir2
				#
				goto TOO_MANY_OPTIONS
			else
				#
				# install-acroread dir1
				#
			endif
		endif
	endif
else
	#
	# install-acroread
	#
endif

if ($DEBUG == 1) then
	echo ""
	echo "VERBOSE       =" "${VERBOSE}"
	echo "INSTALL_DIR_1 =" "${INSTALL_DIR}"
	echo ""
endif

if ( $VERBOSE == 2 ) then

	set UPDATE_MIME = "/bin/update-mime-database -V"
	set TAR_CREATE  = "/bin/tar --no-same-owner -cvf"
	set TAR_EXTRACT = "/bin/tar --no-same-owner -xvf"
	set DNF_INSTALL = "/bin/dnf -y -v install"

else if ( $VERBOSE == 1 ) then

	set UPDATE_MIME = "/bin/update-mime-database"
	set TAR_CREATE  = "/bin/tar --no-same-owner -cf"
	set TAR_EXTRACT = "/bin/tar --no-same-owner -xf"
	set DNF_INSTALL = "/bin/dnf -y install"

else

	set UPDATE_MIME = "/bin/update-mime-database"
	set TAR_CREATE  = "/bin/tar --no-same-owner -cf"
	set TAR_EXTRACT = "/bin/tar --no-same-owner -xf"
	set DNF_INSTALL = "/bin/dnf -y -q install"

endif

# ---------------------------------------- #
# Check the presence of all required tools #
# ---------------------------------------- #

# ------------------------- #
set TOOLS_LIST = (			\
							\
	awk						\
	cat						\
	chmod					\
	cksum					\
	cp						\
	diff					\
	dnf						\
	echo					\
	grep					\
	ln						\
	mkdir					\
	rm						\
	rmdir					\
	rpm2archive				\
	sed						\
	sleep					\
	tar						\
	touch					\
	tr						\
	uname					\
	update-mime-database	\
	wc						\
	whoami					\
							)
# ------------------------- #

foreach command ( ${TOOLS_LIST} )
	if ( ( ! -x /bin/${command} ) && ( ! -x /usr/bin/${command} ) ) then
		echo ""
		echo "*** ERROR: Could not find the command: '${command}'"
		echo "Please install '${command}'. Then try again."
		echo ""
		echo "Installation cancelled."
		goto CANCEL
	endif
end

set TAR_FILE = acroread.tar

set HERE = `pwd`

umask 022

alias check_yes 'if ($ANSWER == y || $ANSWER == Y || $ANSWER == yes || $ANSWER == YES) set ANSWER = y'
alias check_no  'if ($ANSWER == n || $ANSWER == N || $ANSWER == no  || $ANSWER == NO ) set ANSWER = n'

alias check_answer 'check_yes ; check_no'

# --------------------------------------------------- #
# First make sure we are running this script as root. #
# --------------------------------------------------- #

if ( -x /bin/whoami ) then
	if ( `/bin/whoami` != "root" ) then
		echo ""
		echo "*** ERROR: You must be root to run this script."
		echo "Please change your user id to root. Then try again."
		goto CANCEL
	endif
else
	echo ""
	echo "*** ERROR: Could not find the command: /bin/whoami"
	echo "Please install /bin/whoami. Then try again."
	goto CANCEL
endif

# ------------------------------------------------------ #
# We expect the tar file to be in the current directory. #
# ------------------------------------------------------ #

if ( ! -e ${TAR_FILE} ) then
	echo ""
	echo "*** ERROR: Could not find the tar file ($TAR_FILE)."
	echo "The installer expects the tar file to be in the current"
	echo 'directory. Please use the "cd" command to go to the'
	echo "directory where ${TAR_FILE} is located. Then type:"
	echo ""
	echo "./install-acroread"
	goto CANCEL
endif

# -------------------------------------------- #
# Check which operating system we are running. #
# -------------------------------------------- #

set OS_NAME       = "Unknown OS Name"
set OS_VERSION    = "Unknown OS Version"
set OS_VERSION_ID = "Unknown OS Version ID"

if ( -x /bin/uname ) then

	if ( `/bin/uname -s` == "Linux" ) then

		if ( -e /etc/os-release ) then

			# ---------------------------------------------------
			# /etc/os-release (Fedora):
			#
			#		ID=fedora
			#		NAME=Fedora
			#		VERSION="30 (Workstation Edition)"
			#		VERSION_ID=30
			#
			#		PRETTY_NAME="Fedora 30 (Workstation Edition)"
			#
			# ---------------------------------------------------
			# /etc/os-release (Centos):
			#
			#		ID="centos"
			#		NAME="CentOS Linux"
			#		VERSION="8 (Core)"
			#		VERSION_ID="8"
			#
			#		PRETTY_NAME="CentOS Linux 8 (Core)"
			#
			# ---------------------------------------------------

			/bin/grep "^NAME=" < /etc/os-release >& /dev/null
			if ( $status == 0 ) then

				/bin/grep "^NAME=" < /etc/os-release | /bin/sed -e "s/NAME=//g" > $TMP_FILE
				set OS_NAME = `/bin/sed -e 's/"//g' < $TMP_FILE`

				# -----------------------------------------------------------------------------------
				/bin/grep "^VERSION=" < /etc/os-release >& /dev/null
				if ( $status == 0 ) then
					/bin/grep "^VERSION=" < /etc/os-release | /bin/sed -e "s/VERSION=//g" > $TMP_FILE
					set OS_VERSION = `/bin/sed -e 's/"//g' < $TMP_FILE`
					echo ""
					echo "You are running this script on: $OS_NAME $OS_VERSION" 
					echo ""
					set ANSWER = x
					while ($ANSWER != y && $ANSWER != n)
						${ECHO_N} "Do you want to continue (y/n)? "
						set ANSWER = $<
						check_answer
					end
					if ($ANSWER == n) then
						echo ""
						echo "OK. Installation cancelled."
						goto CANCEL
					endif
				else
					echo ""
					echo "*** WARNING: Could not determine which version of $OS_NAME you are"
					echo "running because 'VERSION=' is missing in the file /etc/os-release."
					echo ""
					set ANSWER = x
					while ($ANSWER != y && $ANSWER != n)
						${ECHO_N} "Do you still want to continue (y/n)? "
						set ANSWER = $<
						check_answer
					end
					if ($ANSWER == n) then
						echo ""
						echo "OK. Installation cancelled."
						goto CANCEL
					endif
				endif

				# -----------------------------------------------------------------------------------
				/bin/grep "^VERSION_ID=" < /etc/os-release >& /dev/null
				if ( $status == 0 ) then
					/bin/grep "^VERSION_ID=" < /etc/os-release | /bin/sed -e "s/VERSION_ID=//g" > $TMP_FILE
					set OS_VERSION_ID = `/bin/sed -e 's/"//g' < $TMP_FILE`
				else
					echo ""
					echo "*** WARNING: Could not determine which version of $OS_NAME you are"
					echo "running because 'VERSION_ID=' is missing in the file /etc/os-release."
					echo ""
					set ANSWER = x
					while ($ANSWER != y && $ANSWER != n)
						${ECHO_N} "Do you still want to continue (y/n)? "
						set ANSWER = $<
						check_answer
					end
					if ($ANSWER == n) then
						echo ""
						echo "OK. Installation cancelled."
						goto CANCEL
					endif
				endif

			else
				echo ""
				echo "*** WARNING: Could not determine which flavor of Linux you are"
				echo "running because 'NAME=' is missing in the file /etc/os-release."
				echo ""
				set ANSWER = x
				while ($ANSWER != y && $ANSWER != n)
					${ECHO_N} "Do you still want to continue (y/n)? "
					set ANSWER = $<
					check_answer
				end
				if ($ANSWER == n) then
					echo ""
					echo "OK. Installation cancelled."
					goto CANCEL
				endif
			endif
		else
			echo ""
			echo "*** WARNING: Could not determine which flavor of Linux you"
			echo "are running because the file /etc/os-release is missing."
			echo ""
			set ANSWER = x
			while ($ANSWER != y && $ANSWER != n)
				${ECHO_N} "Do you still want to continue (y/n)? "
				set ANSWER = $<
				check_answer
			end
			if ($ANSWER == n) then
				echo ""
				echo "OK. Installation cancelled."
				goto CANCEL
			endif
		endif
	else
		echo ""
		echo "*** ERROR: It does not look like you are running this script on"
		echo "a Linux system. The command '/bin/uname -s' did not return"
		echo "'Linux'. Please login to a Linux system. Then try again."
		goto CANCEL
	endif
else
	echo ""
	echo "*** ERROR: Could not find the command: /bin/uname"
	echo "Please install /bin/uname. Then try again."
	goto CANCEL
endif

if ( $INTERACTIVE == 1 ) then
	#
	# Get terminal width
	#
	@ TERM_WIDTH = `stty size | cut -f2 -d ' '`
else
	@ TERM_WIDTH = 0
endif

if ($DEBUG == 1) then
	echo ""
	echo TERM_WIDTH = $TERM_WIDTH
	echo ""
endif

cd "${HERE}"
rm -f    $TMP_FILE >& /dev/null
rm -f -r $TMP_DIR  >& /dev/null
mkdir    $TMP_DIR  >& /dev/null
cd       $TMP_DIR

echo ""
echo "Welcome to Adobe Acrobat Reader 9.5.5-1 for Linux. You will now be guided"
echo "through the installation  process.  This  installation  script  will  not"
echo "overwrite any files on your  computer  without  a  positive  confirmation"
echo "from you."

CHOOSE_INSTALL_DIR:

if ( ( $INTERACTIVE == 1 ) && ( "${INSTALL_DIR}" == "${NO_DIR}" ) ) then

	# -----------------------------------------------------------------------------
	echo ""
	echo "Please enter the full pathname to the directory where you want to install"
	echo "Acrobat Reader, for example:  /opt/Adobe/Acrobat.  A  subdirectory  named"
	echo "'Reader9' will be created  in the  install  directory  you  specify.  The"
	echo "install directory must have at least 200 MBytes  of free  disk space. The"
	echo "pathname must not contain embedded spaces or other characters  that  have"
	echo "special meaning to the shell (C-shell)."
	echo ""
	set ANSWER = ""
	while ("$ANSWER" == "")
		${ECHO_N} "Install directory: "
		# set ANSWER = $<
		set ANSWER = ` /bin/echo $< `
		if ($status != 0) then
			set ANSWER = ""
		endif
	end

	set INSTALL_DIR = "${ANSWER}"

else

	if ( "${INSTALL_DIR}" == "${NO_DIR}" ) then
		echo ""
		echo "*** ERROR: You must specify an installation directory"
		echo "*** when running the installer in non-interactive mode."
		echo ""
		echo "Please use the -usage option for more information"
		echo ""
		sleep 1
		goto ERROR_EXIT
	endif

endif

if ($DEBUG == 1) then
	echo ""
	echo "INSTALL_DIR_2 =" "${INSTALL_DIR}"
	echo ""
endif

# ------------------------ #
# Validate the install_dir #
# ------------------------ #

# '*' '[' '\' '`' "'"  '~' '?' 

foreach char ( ' ' '"' '\!' '{' '\$' '%' '&' '(' ')' ',' ';' '<' '>' ']' '\^' '|' '}' )
	echo "${INSTALL_DIR}" |& grep "${char}" 
	if ($status == 0) then
		echo ""
		if ( "${char}" == ' ' ) then
			echo "*** ERROR: Embedded spaces are not allowed in the install directory pathname."
		else
			echo "*** ERROR: This character --> '${char}' is not allowed in the install directory pathname."
		endif
		sleep 1
		if ( $INTERACTIVE == 1 ) then
			set INSTALL_DIR = "${NO_DIR}"
			goto CHOOSE_INSTALL_DIR
		else
			goto INVALID_INSTALL_DIR
		endif
	endif
end

echo "${INSTALL_DIR}" |& grep '\.\.' >& /dev/null
if ($status == 0) then
	echo ""
	echo "*** ERROR: References to parent directories (..) are not"
	echo "*** allowed in the install directory pathname."
	sleep 1
	if ( $INTERACTIVE == 1 ) then
		set INSTALL_DIR = "${NO_DIR}"
		goto CHOOSE_INSTALL_DIR
	else
		goto INVALID_INSTALL_DIR
	endif
endif

echo "${INSTALL_DIR}" |& grep '^/' >& /dev/null
if ($status != 0) then
	echo ""
	echo "*** ERROR: The install directory pathname must start with a forward slash --> /"
	sleep 1
	if ( $INTERACTIVE == 1 ) then
		set INSTALL_DIR = "${NO_DIR}"
		goto CHOOSE_INSTALL_DIR
	else
		goto INVALID_INSTALL_DIR
	endif
endif

echo "${INSTALL_DIR}" |& grep '/$' >& /dev/null
if ($status == 0) then
	echo ""
	echo "*** ERROR: The install directory pathname must not end with a forward slash --> /"
	sleep 1
	if ( $INTERACTIVE == 1 ) then
		set INSTALL_DIR = "${NO_DIR}"
		goto CHOOSE_INSTALL_DIR
	else
		goto INVALID_INSTALL_DIR
	endif
endif

echo "${INSTALL_DIR}" > /tmp/Acrobat-install-dir.$$

if (`wc -c < /tmp/Acrobat-install-dir.$$` > 201) then
	rm -f /tmp/Acrobat-install-dir.$$
	echo ""
	echo "*** ERROR: The pathname is too long. The limit is 200 characters."
	sleep 1
	if ( $INTERACTIVE == 1 ) then
		set INSTALL_DIR = "${NO_DIR}"
		goto CHOOSE_INSTALL_DIR
	else
		goto INVALID_INSTALL_DIR
	endif
endif
rm -f /tmp/Acrobat-install-dir.$$

cd "${HERE}"
chmod 777 $TMP_DIR >& /dev/null
rm -f -r  $TMP_DIR >& /dev/null

# -----------------------------------------------------------------------------
if ( ! -e "${INSTALL_DIR}" ) then
	echo ""
	set ANSWER = x
	while ($ANSWER != y && $ANSWER != n)
		${ECHO_N} "$INSTALL_DIR does not exist. Create it (y/n)? "
		set ANSWER = $<
		check_answer
	end
	if ($ANSWER == n) then
		echo ""
		echo "OK. Installation cancelled."
		goto CANCEL
	endif
	mkdir  -p "${INSTALL_DIR}"
	if ( ! -d "${INSTALL_DIR}" ) then
		echo ""
		echo "*** ERROR: Could not create the install directory $INSTALL_DIR"
		echo "Please check the permissions of the install directory, then try again."
		echo ""
		echo "Installation cancelled."
		goto CANCEL
	endif
	chmod 755 "${INSTALL_DIR}"
	#
	# install_dir was created by this script so
	# we can remove it if install is cancelled.
	#
	set REMOVE_INSTALL_DIR = 1
endif

# -----------------------------------------------------------------------------
if ( ( -e "${INSTALL_DIR}" ) && ( ! -d "${INSTALL_DIR}" ) ) then
	echo ""
	echo "*** ERROR: ${INSTALL_DIR} already exists as a plain file (not a directory)."
	echo "Please remove it, then try again."
	echo ""
	echo "Installation cancelled."
	goto CANCEL
endif

# -----------------------------------------------------------------------------
echo ""
echo "Acrobat Reader will be installed in ${INSTALL_DIR}/Reader9"
echo ""

set ANSWER = x
while ($ANSWER != y && $ANSWER != n)
	${ECHO_N} "Continue (y/n)? "
	set ANSWER = $<
	check_answer
end
if ($ANSWER == n) then
	echo ""
	echo "OK. Installation cancelled."
	goto CANCEL
endif

# -----------------------------------------------------------------------------
mkdir  -p "${INSTALL_DIR}/tmp.tmp.$$" >& /dev/null
if ( ! -d "${INSTALL_DIR}/tmp.tmp.$$" ) then
	echo ""
	echo "*** ERROR: Could not create directories inside ${INSTALL_DIR}"
	echo "Please check the permissions of the install directory, then try again."
	echo ""
	echo "Installation cancelled."
	goto CANCEL
endif
rmdir "${INSTALL_DIR}/tmp.tmp.$$"

# ------------------------------------------ #
# At this point $INSTALL_DIR exists and      #
# $INSTALL_DIR/Reader9 may or may not exist. #
# ------------------------------------------ #

# -----------------------------------------------------------------------------
if ( -e "${INSTALL_DIR}/Reader9" ) then

	set ANSWER = x
	while ($ANSWER != y && $ANSWER != n)
		echo ""
		echo "$INSTALL_DIR/Reader9 already exists."
		echo ""
		${ECHO_N} "Do you want to overwrite it (y/n)? "
		set ANSWER = $<
		check_answer
	end
	if ($ANSWER == n) then
		echo ""
		echo "OK. Installation cancelled."
		goto CANCEL
	endif

	if ( $VERBOSE == 2 ) then
		echo ""
		echo "OK. Removing ${INSTALL_DIR}/Reader9 ..."
	endif

	# ---------------------------------------------------------
	chmod 777 ${INSTALL_DIR}/Reader9               >& /dev/null
	chmod 777 ${INSTALL_DIR}/Reader9/*             >& /dev/null
	chmod 777 ${INSTALL_DIR}/Reader9/*/*           >& /dev/null
	chmod 777 ${INSTALL_DIR}/Reader9/*/*/*         >& /dev/null
	chmod 777 ${INSTALL_DIR}/Reader9/*/*/*/*       >& /dev/null
	chmod 777 ${INSTALL_DIR}/Reader9/*/*/*/*/*     >& /dev/null
	chmod 777 ${INSTALL_DIR}/Reader9/*/*/*/*/*/*   >& /dev/null
	chmod 777 ${INSTALL_DIR}/Reader9/*/*/*/*/*/*/* >& /dev/null
	rm -f -r  ${INSTALL_DIR}/Reader9
	# ---------------------------------------------------------
	if ( -e ${INSTALL_DIR}/Reader9 ) then
		echo ""
		echo "*** ERROR: Could not remove ${INSTALL_DIR}/Reader9"
		echo "Please check the permissions of the directory, then try again."
		echo ""
		echo "Installation cancelled."
		goto CANCEL
	endif
endif

# ----------------------- #
# Do the installation now #
# ----------------------- #

cd "${HERE}"

echo ""
# *****************************************************************
echo "===> Step 01: Installing Reader9 in $INSTALL_DIR/Reader9 ..."
# *****************************************************************
#
# ${HERE}/opt/Adobe/Reader9/* --> ${INSTALL_DIR}/Reader9/*
#

#et INSTALLER_SCRIPT   = "install-acroread"
set UNINSTALLER_SCRIPT = "uninstall-acroread"

set RPM_FILE      = AdbeRdr9.5.5-1_i486linux_enu.rpm
set FEDORA_30_FIX = "Fedora-30-Fix"
set CENTOS_RPMS   = "Centos-rpm-packages"

rm -f -r ./${UNINSTALLER_SCRIPT} ./${RPM_FILE} ./${FEDORA_30_FIX} ./${CENTOS_RPMS}

if ( $VERBOSE >= 1 ) then
	echo ""
	echo "     Extracting files from ${TAR_FILE} ..."
endif

if ( $VERBOSE == 2) then
	echo "     ${TAR_EXTRACT} ${TAR_FILE} ./${UNINSTALLER_SCRIPT} ./${RPM_FILE} ./${FEDORA_30_FIX} ./${CENTOS_RPMS} ..."
	#
	# insert 5 blank spaces at beginning of each line (make page offset)
	# awk '{sub(/^/, "     ");print}'
	#
	${TAR_EXTRACT} ${TAR_FILE} ./${UNINSTALLER_SCRIPT} ./${RPM_FILE} ./${FEDORA_30_FIX} ./${CENTOS_RPMS} | awk '{sub(/^/, "     ");print}'
else
	${TAR_EXTRACT} ${TAR_FILE} ./${UNINSTALLER_SCRIPT} ./${RPM_FILE} ./${FEDORA_30_FIX} ./${CENTOS_RPMS}
endif

# ---------------------------#
# Validate rpm file checksum #
# ---------------------------#

cksum ${RPM_FILE} > ${RPM_FILE}.cksum.1

echo "687594232 60118961 ${RPM_FILE}" > ${RPM_FILE}.cksum.2

diff ${RPM_FILE}.cksum.1 ${RPM_FILE}.cksum.2 >& /dev/null
if ( $status != 0 ) then
	echo ""
	echo "*** ERROR: Incorrect checksum for file: ${RPM_FILE}."
	echo "It looks like ${TAR_FILE} is corrupted. Please re-download the tar file."
	echo "Then try again."
	echo ""
	echo "The checksum should be:"
	echo ""
	cat ${RPM_FILE}.cksum.2
	echo ""
	echo "But the checksum is:"
	echo ""
	cat ${RPM_FILE}.cksum.1
	echo ""
	echo "Installation cancelled."
	rm ${RPM_FILE}.cksum.1
	rm ${RPM_FILE}.cksum.2
	goto CANCEL
endif

rm ${RPM_FILE}.cksum.1
rm ${RPM_FILE}.cksum.2

# ------------------------------------- #
# At this point $INSTALL_DIR exists and #
# $INSTALL_DIR/Reader9 does not exist.  #
# ------------------------------------- #

mkdir  -p "${INSTALL_DIR}/Reader9"
if ( ! -d "${INSTALL_DIR}/Reader9" ) then
	echo ""
	echo "*** ERROR: Could not create ${INSTALL_DIR}/Reader9"
	echo "Please check the permissions of the install directory, then try again."
	echo ""
	echo "Installation cancelled."
	goto CANCEL
endif
chmod 755 "${INSTALL_DIR}/Reader9"

# ------------------------------- #
# At this point both $INSTALL_DIR #
# and $INSTALL_DIR/Reader9 exist. #
# ------------------------------- #

if ($DEBUG == 1) then
	echo ""
	echo PWD = ${HERE}
	echo PWD = `pwd`
	echo ""
endif

if ( $VERBOSE == 2 ) then
	echo ""
endif

if ( $VERBOSE >= 1 ) then
	echo "     Converting the rpm file to a tar file ..."
endif

rm -f tmp.tar

if ( $VERBOSE == 2 ) then
	echo "     rpm2archive - < ${RPM_FILE} > tmp.tar ..."
endif

rpm2archive - < ${RPM_FILE} > tmp.tar

if ( $VERBOSE == 2 ) then
	echo ""
endif

if ( $VERBOSE >= 1 ) then
	echo "     Unpacking the tar file ..."
endif

if ( $VERBOSE == 2) then
	echo "     ${TAR_EXTRACT} tmp.tar ..."
	#
	# insert 5 blank spaces at beginning of each line (make page offset)
	# awk '{sub(/^/, "     ");print}'
	#
	${TAR_EXTRACT} tmp.tar | awk '{sub(/^/, "     ");print}'
else
	${TAR_EXTRACT} tmp.tar
endif

rm -f tmp.tar

if ( ! -d ./opt/Adobe/Reader9 ) then
	echo ""
	echo "*** ERROR: Could not unpack the rpm file: ${RPM_FILE}."
	echo "Expected to find the directory: ${HERE}/opt/Adobe/Reader9 but it was"
	echo "not there."
	echo ""
	echo "Installation cancelled."
	goto CANCEL
endif

cd ./opt/Adobe/Reader9
if ( `pwd` != "${HERE}/opt/Adobe/Reader9" ) then
	echo ""
	echo "*** ERROR: Could not descend into the directory:"
	echo "${HERE}/opt/Adobe/Reader9"
	echo ""
	echo "Installation cancelled."
	goto CANCEL
endif

if ( $VERBOSE == 2 ) then
	echo ""
endif

if ( $VERBOSE >= 1 ) then
    echo "     Copying the install files from ${HERE}/opt/Adobe/Reader9 to ${INSTALL_DIR}/Reader9 ..."
endif

tar cf - * | ( cd "${INSTALL_DIR}/Reader9" ; tar xf - )
cd ${HERE}

# Validate the files
#
diff -r ${HERE}/opt/Adobe/Reader9 ${INSTALL_DIR}/Reader9
if ( $status != 0 ) then
	echo ""
	echo "*** ERROR: Could not copy the install files"
	echo "From: ${HERE}/opt/Adobe/Reader9"
	echo "To:   ${INSTALL_DIR}/Reader9"
	echo ""
	echo "Installation cancelled."
	goto CANCEL
endif

rm -f -r ${HERE}/opt
if ( -e ${HERE}/opt ) then
	echo ""
	echo "*** ERROR: Could not remove directory: ${HERE}/opt"
	echo ""
	echo "Installation cancelled."
	goto CANCEL
endif

chmod -R 755 "${INSTALL_DIR}/Reader9"

if ( $VERBOSE >= 1 ) then
	echo "     Creating symbolic link: /usr/bin/acroread -> ${INSTALL_DIR}/Reader9/bin/acroread ..."
	echo ""
endif

rm -f /usr/bin/acroread
ln -s  ${INSTALL_DIR}/Reader9/bin/acroread /usr/bin/acroread

if ( ! -e /usr/bin/acroread ) then
	echo ""
	echo "*** ERROR: Could not create symbolic link:"
	echo "/usr/bin/acroread -> ${INSTALL_DIR}/Reader9/bin/acroread"
	echo ""
	echo "Installation cancelled."
	goto CANCEL
endif
chmod 755 /usr/bin/acroread

# ------------- #
# Steps 2+3+4+5 #
# ------------- #

foreach step ( 2 3 4 5 )

	cd "${HERE}"

	switch ( $step )

		case 2:
			#
			# ${HERE}/Fedora-30-Fix/usr-bin/gvfs-* --> /usr/bin/gvfs-*
			#
			# ****************************************************************************
			echo "===> Step 0${step}: Installing 'gvfs' commands in /usr/bin (gvfs-*) ..."
			# ****************************************************************************
			set SRC_DIR = "${HERE}/Fedora-30-Fix/usr-bin"
			set DST_DIR = "/usr/bin"
			breaksw

		case 3:
			#
			# ${HERE}/Fedora-30-Fix/usr-local-share-applications/defaults.list --> /usr/local/share/applications/
			#
			# **********************************************************************************************
			echo "===> Step 0${step}: Installing files in /usr/local/share/applications (defaults.list) ..."
			# **********************************************************************************************
			set SRC_DIR = "${HERE}/Fedora-30-Fix/usr-local-share-applications"
			set DST_DIR = "/usr/local/share/applications"
			breaksw

		case 4:
			#
			# ${HERE}/Fedora-30-Fix/usr-share-mime-application/vnd.adobe.pdx.xml     --> /usr/share/mime/application/
			# ${HERE}/Fedora-30-Fix/usr-share-mime-application/vnd.adobe.xdp+xml.xml --> /usr/share/mime/application/
			# ${HERE}/Fedora-30-Fix/usr-share-mime-application/vnd.adobe.xfdf.xml    --> /usr/share/mime/application/
			# ${HERE}/Fedora-30-Fix/usr-share-mime-application/vnd.fdf.xml           --> /usr/share/mime/application/
			#
			# ********************************************************************************************
			echo "===> Step 0${step}: Installing xml files in /usr/share/mime/application (vnd.*.xml) ..."
			# ********************************************************************************************
			set SRC_DIR = "${HERE}/Fedora-30-Fix/usr-share-mime-application"
			set DST_DIR = "/usr/share/mime/application"
			breaksw

		case 5:
			#
			# ${HERE}/Fedora-30-Fix/usr-share-mime-packages/AdobeReader.xml --> /usr/share/mime/packages/
			#
			# ***********************************************************************************************
			echo "===> Step 0${step}: Installing xml files in /usr/share/mime/packages (AdobeReader.xml) ..."
			# ***********************************************************************************************
			set SRC_DIR = "${HERE}/Fedora-30-Fix/usr-share-mime-packages"
			set DST_DIR = "/usr/share/mime/packages"
			breaksw

		default:
			echo "*** INTERNAL ERROR 1 ***"
			echo ""
			echo "Installation cancelled."
			exit 1

	endsw

	cd "${SRC_DIR}"
	#
	# This has to do with mount points: SRC_DIR must be identical
	# to `pwd` because we used `pwd` to set the value of ${HERE}
	#
	if ( "`pwd`" != "${SRC_DIR}" ) then
		echo ""
		echo "*** ERROR: Could not change current directory to: ${SRC_DIR}"
		echo ""
		echo "Installation cancelled."
		goto CANCEL
	endif

	mkdir  -p "${DST_DIR}"
	if ( ! -d "${DST_DIR}" ) then
		echo ""
		echo "*** ERROR: Could not create directory: ${SRC_DIR}"
		echo ""
		echo "Installation cancelled."
		goto CANCEL
	endif
	chmod 755 "${DST_DIR}"

	if ( ( $step == 3 ) && ( -e "${DST_DIR}/defaults.list" ) ) then
		#
		# We need to handle step 3 separately:
		#
		# set SRC_DIR = "${HERE}/Fedora-30-Fix/usr-local-share-applications"
		# set DST_DIR = "/usr/local/share/applications"
		# File = defaults.list
		#
		# If defaults.list already exists, then do a diff.
		# If they are identical, then OK, else print a
		# warning that the file was not installed.
		#
		# Here we know that we are in step 3 and ${DST_DIR}/defaults.list exists
		#
		diff "${SRC_DIR}/defaults.list" "${DST_DIR}/defaults.list" >& /dev/null
		if ( $status != 0 ) then
			#
			# status is zero if the files are identical
			#
			echo ""
			echo "     *** WARNING:"
			echo ""
			echo "     Could not install file: ${DST_DIR}/defaults.list"
			echo ""
			echo "     From: ${SRC_DIR}/defaults.list"
			echo "     To:   ${DST_DIR}/defaults.list"
			echo ""
			echo "     Ignoring problem and continuing ..."
			echo ""
			echo "     Please report this problem to:"
			echo ""
			echo "     ${MY_AUTHOR}"
			echo ""
			echo "     Please also send me the content of this file:"
			echo ""
			echo "    ${DST_DIR}/defaults.list"
			echo ""
		endif
	else
		foreach file ( * )
			set SRC = "${SRC_DIR}/${file}"
			set DST = "${DST_DIR}/${file}"

			if ( -e "${DST}" ) then
				rm -f "${DST}"
			endif

			if ( -e "${DST}" ) then
				echo ""
				echo "*** ERROR: Could not remove file: ${DST}"
				echo ""
				echo "Installation cancelled."
				goto CANCEL
			endif

			cp   "${SRC}" "${DST}"
			diff "${SRC}" "${DST}"
			if ( $status != 0 ) then
				echo ""
				echo "*** ERROR: Could not copy file"
				echo "From: ${SRC}"
				echo "To:   ${DST}"
				echo ""
				echo "Installation cancelled."
				goto CANCEL
			endif
			chmod 755 "${DST}"
		end
	endif

end

# --------- #
# Steps 6+7 #
# --------- #

foreach step ( 6 7 )

	cd "${HERE}"

	switch ( $step )

		case 6:
			# *********************************************************************************
			echo "===> Step 0${step}: Adding Adobe Reader entries to /usr/share/mime/types ..."
			# *********************************************************************************
			set TARGET_FILE = /usr/share/mime/types

			# --------------------------------- #
			set ENTRY_LIST = (					\
												\
				'application/vnd.fdf'			\
				'application/vnd.adobe.pdx'		\
				'application/vnd.adobe.xdp+xml'	\
				'application/vnd.adobe.xfdf'	\
												)
			# --------------------------------- #

			breaksw

		case 7:
			if ( $VERBOSE == 2 ) then
				echo ""
			endif
			# ***********************************************************************************
			echo "===> Step 0${step}: Adding Adobe Reader entries to /usr/share/mime/aliases ..."
			# ***********************************************************************************
			set TARGET_FILE = /usr/share/mime/aliases

			# ------------------------------------------------- #
			set ENTRY_LIST = (									\
																\
				'application/fdf application/vnd.fdf'			\
				'application/pdx application/vnd.adobe.pdx'		\
				'application/xdp application/vnd.adobe.xdp+xml'	\
				'application/xfdf application/vnd.adobe.xfdf'	\
				'application/acrobat application/pdf'			\
																)
			# ------------------------------------------------- #

			breaksw

		default:
			echo "*** INTERNAL ERROR 2 ***"
			echo ""
			echo "Installation cancelled."
			exit 1

	endsw

	chmod 644 ${TARGET_FILE}

	# -------------------------------------------------------------------------------
	# Here we need to use the :q variable modifier to be able to handle an entry_list
	# with embedded spaces inside each entry. We could of course put a marker instead
	# of a space, for example: 'application/fdf_SECRET_MARKER_application/vnd.fdf',
	# and then use 'sed' to replace it with space inside the foreach loop. But using
	# the :q # modifier is much simpler. See this article:
	#
	# https://stackoverflow.com/questions/30849512/
	# cshell-cannot-set-array-of-strings-with-spaces
	# -------------------------------------------------------------------------------

	if ( $VERBOSE == 2 ) then
		echo ""
	endif

	foreach entry ( $ENTRY_LIST:q )

		# Notice: Curly braces would not work: '${ENTRY_LIST}:q'

		grep "${entry}" ${TARGET_FILE} >& /dev/null

		if ( $status != 0 ) then
			if ( $VERBOSE == 2 ) then
				echo "     Appending ${entry} to ${TARGET_FILE}"
			endif
			echo "${entry}" >> ${TARGET_FILE}
		else
			if ( $VERBOSE == 2 ) then
				echo "     ${entry} is already present in ${TARGET_FILE}"
			endif
		endif

		grep "${entry}" ${TARGET_FILE} >& /dev/null

		if ( $status != 0 ) then
			echo ""
			echo "*** ERROR: Could not append entry ${entry} to ${TARGET_FILE}"
			echo ""
			echo "Installation cancelled."
			goto CANCEL
		endif

	end

end

if ( $VERBOSE == 2 ) then
	echo ""
endif

# ****************************************************************************************
echo "===> Step 08: Rebuilding the Shared MIME-Info database cache in /usr/share/mime ..."
# ****************************************************************************************

if ( $VERBOSE == 2 ) then
	echo ""
endif

if ( $VERBOSE == 2) then
	#
	# insert 5 blank spaces at beginning of each line (make page offset)
	# awk '{sub(/^/, "     ");print}'
	#
	${UPDATE_MIME} /usr/share/mime | awk '{sub(/^/, "     ");print}'
	echo ""
else
	${UPDATE_MIME} /usr/share/mime
endif

# *****************************************************
echo "===> Step 09: Installing PDF Browser plugins ..."
# *****************************************************
#
# ${INSTALL_DIR}/Reader9/Browser/intellinux/nppdf.so --> /usr/lib/mozilla/plugins
# ${INSTALL_DIR}/Reader9/Browser/intellinux/nppdf.so --> /usr/lib64/mozilla/plugins
# ${INSTALL_DIR}/Reader9/Browser/intellinux/nppdf.so --> /usr/lib/opera/plugins

# --------------------------------- #
set PLUGIN_DIRS = (					\
									\
	'/usr/lib/mozilla/plugins'		\
	'/usr/lib64/mozilla/plugins'	\
	'/usr/lib/opera/plugins'		\
									)
# --------------------------------- #

cd "${INSTALL_DIR}/Reader9/Browser/intellinux"

if ( $VERBOSE >= 1 ) then
	echo ""
endif

foreach plugin_dir ( $PLUGIN_DIRS )

	mkdir  -p "${plugin_dir}"
	if ( ! -d "${plugin_dir}" ) then
		echo ""
		echo "*** ERROR: Could not create directory: ${plugin_dir}"
		echo ""
		echo "Installation cancelled."
		goto CANCEL
	endif
	chmod 755 "${plugin_dir}"

	if ( $VERBOSE >= 1 ) then
		echo "     Copying nppdf.so from ${INSTALL_DIR}/Reader9/Browser/intellinux to ${plugin_dir} ..."
	endif

	cp   nppdf.so "${plugin_dir}/nppdf.so"
	diff nppdf.so "${plugin_dir}/nppdf.so"
	if ( $status != 0 ) then
		echo ""
		echo "*** ERROR: Could not copy file"
		echo "From: ${INSTALL_DIR}/Reader9/Browser/intellinux/nppdf.so"
		echo "To:   ${plugin_dir}/nppdf.so"
		echo ""
		echo "Installation cancelled."
		goto CANCEL
	endif

end

# ************************************************************************
foreach step ( 10 11 12 13 )

	cd "${HERE}"

	if ( $VERBOSE >= 1 ) then
		echo ""
	endif

	switch ( $step )

		case 10:
			#
			# ${INSTALL_DIR}/Reader9/Resource/Shell/acroread_tab          --> /etc/bash_completion.d/acroread.sh
			#
			# *************************************************************************
			echo "===> Step ${step}: Installing /etc/bash_completion.d/acroread.sh ..."
			# *************************************************************************

			set SRC_DIR  = ${INSTALL_DIR}/Reader9/Resource/Shell
			set DST_DIR  = /etc/bash_completion.d

			set SRC_FILE = acroread_tab
			set DST_FILE = acroread.sh

			breaksw

		case 11:
			#
			# ${INSTALL_DIR}/Reader9/Resource/Shell/acroread.1.gz         --> /usr/share/man/man1/acroread.1.gz
			#
			# ************************************************************************
			echo "===> Step ${step}: Installing /usr/share/man/man1/acroread.1.gz ..."
			# ************************************************************************

			set SRC_DIR  = ${INSTALL_DIR}/Reader9/Resource/Shell
			set DST_DIR  = /usr/share/man/man1

			set SRC_FILE = acroread.1.gz
			set DST_FILE = acroread.1.gz

			breaksw

		case 12:
			#
			# ${INSTALL_DIR}/Reader9/Resource/Support/AdobeReader.desktop --> /root/Desktop/AdobeReader.desktop
			#
			# ************************************************************************
			echo "===> Step ${step}: Installing /root/Desktop/AdobeReader.desktop ..."
			# ************************************************************************

			set SRC_DIR  = ${INSTALL_DIR}/Reader9/Resource/Support
			set DST_DIR  = /root/Desktop

			set SRC_FILE = AdobeReader.desktop
			set DST_FILE = AdobeReader.desktop

			breaksw

		case 13:
			#
			# ${INSTALL_DIR}/Reader9/Resource/Support/AdobeReader.desktop --> /usr/local/share/applications/AdobeReader.desktop
			#
			# ****************************************************************************************
			echo "===> Step ${step}: Installing /usr/local/share/applications/AdobeReader.desktop ..."
			# ****************************************************************************************

			set SRC_DIR  = ${INSTALL_DIR}/Reader9/Resource/Support
			set DST_DIR  = /usr/local/share/applications

			set SRC_FILE = AdobeReader.desktop
			set DST_FILE = AdobeReader.desktop

			breaksw

		default:
			echo "*** INTERNAL ERROR 3 ***"
			echo ""
			echo "Installation cancelled."
			exit 1

	endsw

	mkdir  -p ${DST_DIR}
	if ( ! -d ${DST_DIR} ) then
		echo ""
		echo "*** ERROR: Could not create directory: ${DST_DIR}"
		echo ""
		echo "Installation cancelled."
		goto CANCEL
	endif
	chmod 755 ${DST_DIR}

	cd ${SRC_DIR}

	if ( $VERBOSE >= 1 ) then
		echo ""
		echo "     Copying ${SRC_FILE} from ${SRC_DIR} to ${DST_DIR}/${DST_FILE} ..."
	endif

	cp   ${SRC_FILE} ${DST_DIR}/${DST_FILE}
	diff ${SRC_FILE} ${DST_DIR}/${DST_FILE}
	if ( $status != 0 ) then
		echo ""
		echo "*** ERROR: Could not copy file"
		echo "From: ${SRC_DIR}/${SRC_FILE}"
		echo "To:   ${DST_DIR}/${DST_FILE}"
		echo ""
		echo "Installation cancelled."
		goto CANCEL
	endif

end

if ( $VERBOSE >= 1 ) then
	echo ""
endif

# ***********************************************************************
echo "===> Step 14: Installing png files in /usr/share/icons/hicolor/..."
# ***********************************************************************
#
# ${INSTALL_DIR}/Reader9/Resource/Icons/${res}x${res}/* --> /usr/share/icons/hicolor/${res}x${res}/*
#

cd "${HERE}"

if ( $VERBOSE == 2 ) then
	echo ""
endif

# --------------------------------------------------------
# The following dirs are present on a base Fedora install:
#
#
# 16 22 24 32 36 48 64 72 96 128 192 256 512
# 
# So this installer adds "20" to the base install
#

foreach res ( 16 20 22 24 32 36 48 64 96 128 192 )

	set SRC_DIR = ${INSTALL_DIR}/Reader9/Resource/Icons/${res}x${res}
	set DST_DIR = /usr/share/icons/hicolor/${res}x${res}

	if ( $VERBOSE == 2 ) then
		echo "     Installing files in /usr/share/icons/hicolor/${res}x${res} ..."
	endif

	mkdir  -p "${DST_DIR}/apps"
	if ( ! -d "${DST_DIR}/apps" ) then
		echo ""
		echo "*** ERROR: Could not create directory: ${DST_DIR}/apps"
		echo ""
		echo "Installation cancelled."
		goto CANCEL
	endif
	chmod 755 "${DST_DIR}/apps"

	mkdir  -p "${DST_DIR}/mimetypes"
	if ( ! -d "${DST_DIR}/mimetypes" ) then
		echo ""
		echo "*** ERROR: Could not create directory: ${DST_DIR}/mimetypes"
		echo ""
		echo "Installation cancelled."
		goto CANCEL
	endif
	chmod 755 "${DST_DIR}/mimetypes"


	foreach file ( ${SRC_DIR}/* )
		set leaf = $file:t
		cp ${SRC_DIR}/$leaf ${DST_DIR}/apps/$leaf
	end

	# This diff command checks that all files in src_dir were copied to dst_dir. In other
	# words, there can be files in dest_dir that are not present in src_dir, but there
	# cannot be files in src_dir that are not present in dst_dir.
	#
	diff -t -r ${SRC_DIR} ${DST_DIR}/apps |& grep -v "Only in /usr/share/icons/hicolor/${res}x${res}"

	cp ${SRC_DIR}/vnd.fdf.png           ${DST_DIR}/mimetypes/application-fdf.png
	cp ${SRC_DIR}/adobe.pdf.png         ${DST_DIR}/mimetypes/application-pdf.png
	cp ${SRC_DIR}/vnd.adobe.pdx.png     ${DST_DIR}/mimetypes/application-pdx.png
	cp ${SRC_DIR}/vnd.adobe.xdp+xml.png ${DST_DIR}/mimetypes/application-xdp+xml.png
	cp ${SRC_DIR}/vnd.adobe.xfdf.png    ${DST_DIR}/mimetypes/application-xfdf.png


	if ( ! -e ${DST_DIR}/mimetypes/gnome-mime-application-fdf.png ) then
		ln -s ${DST_DIR}/mimetypes/application-fdf.png ${DST_DIR}/mimetypes/gnome-mime-application-fdf.png
	endif

	if ( ! -e ${DST_DIR}/mimetypes/gnome-mime-application-pdf.png ) then
		ln -s ${DST_DIR}/mimetypes/application-pdf.png ${DST_DIR}/mimetypes/gnome-mime-application-pdf.png
	endif

	if ( ! -e ${DST_DIR}/mimetypes/gnome-mime-application-pdx.png ) then
		ln -s ${DST_DIR}/mimetypes/application-pdx.png ${DST_DIR}/mimetypes/gnome-mime-application-pdx.png
	endif

	if ( ! -e ${DST_DIR}/mimetypes/gnome-mime-application-xdp+xml.png ) then
		ln -s ${DST_DIR}/mimetypes/application-xdp+xml.png ${DST_DIR}/mimetypes/gnome-mime-application-xdp+xml.png
	endif

	if ( ! -e ${DST_DIR}/mimetypes/gnome-mime-application-xfdf.png ) then
		ln -s ${DST_DIR}/mimetypes/application-xfdf.png ${DST_DIR}/mimetypes/gnome-mime-application-xfdf.png
	endif

end

cd "${HERE}"

if ( $VERBOSE == 2 ) then
	echo ""
endif

# ***********************************************************
echo "===> Step 15: Installing prerequisite rpm packages ..."
# ***********************************************************
echo ""
echo "This step will take several minutes because many  prerequisite"
echo "packages will be installed. If you have already installed  all"
echo "the prerequisite packages, you can skip this step by answering"
echo "'n' to the next question:"
echo ""

set ANSWER = x
while ($ANSWER != y && $ANSWER != n)
	${ECHO_N} "Do you want to install the prerequisite rpm packages (y/n)? "
	set ANSWER = $<
	check_answer
end
if ($ANSWER == n) then
	echo ""
	echo "OK. Skipping installation of the prerequisite rpm packages."
	echo ""
	goto CREATE_UNINSTALLER
endif

echo ""

# PACKAGE_LIST_TEST was used
# during development only.
#
# ----------------------------- #
set PACKAGE_LIST_TEST = (		\
								\
	x47------atk.i686			\
	libcanberra-gtk2.i686		\
	cairo.i686					\
	cups-libs.i686				\
								)
# ----------------------------- #

# -------------------------------------------- #
# These packages fail to install on Centos-8:
#
# ===> NO FAILURES <===
#
# -------------------------------------------- #

# -------------------------------------------- #
# These packages fail to install on Fedora-28:
#
# fribidi.i686
# gtk2.i686
# libidn.i686
# libthai.i686
# pango.i686
#
# Acrobat runs fine, even with the rpm failures.
#
# This is not a problem, because the original
# Adobe rpm package installs fine on Fedora-28.
#
# -------------------------------------------- #

# -------------------------------------------- #
# These packages fail to install on Fedora-29:
#
# cairo.i686
# expat.i686
# fontconfig.i686
# gdk-pixbuf2.i686
# gtk2.i686
# libSM.i686
# pango.i686
#
# Acrobat runs fine, even with the rpm failures.
#
# -------------------------------------------- #

# -------------------------------------------- #
# These packages fail to install on Fedora-30:
#
# gdk-pixbuf2.i686
# gtk2.i686
# harfbuzz.i686
# libxml2.i686
# pango.i686
#
# Acrobat runs fine, even with the rpm failures.
#
# -------------------------------------------- #

# -------------------------------------------- #
# These packages fail to install on Fedora-31:
#
# gtk2.i686
# libxml2.i686
# pango.i686
#
# Acrobat runs fine, even with the rpm failures.
#
# -------------------------------------------- #

# -------------------------------------------- #
# These packages fail to install on Fedora-32:
#
# libxcrypt.i686
#
# Acrobat runs fine, even with the rpm failures.
#
# -------------------------------------------- #

# -------------------------------------------- #
# These packages fail to install on Fedora-33:
#
# pangox-compat.i686
# pangox-compat.x86_64
# PackageKit-gtk3-module.i686
#
# Acrobat runs fine, even with the rpm failures.
#
# -------------------------------------------- #

# -------------------------------------------- #
# These packages fail to install on Fedora-34:
#
# gdk-pixbuf2.i686
# pangox-compat.i686
# pangox-compat.x86_64
# PackageKit-gtk3-module.i686
#
# Acrobat runs fine, even with the rpm failures.
#
# -------------------------------------------- #

# ----------------------------------------------------------------- #
set PACKAGE_LIST_CENTOS = (											\
																	\
	./Centos-rpm-packages/gdk-pixbuf2-xlib-2.36.12-5.el8.i686.rpm	\
	./Centos-rpm-packages/gdk-pixbuf2-xlib-2.36.12-5.el8.x86_64.rpm	\
	./Centos-rpm-packages/pangox-compat-0.0.2-2.el7.i686.rpm		\
	./Centos-rpm-packages/pangox-compat-0.0.2-2.el7.x86_64.rpm		\
																	)
# ----------------------------------------------------------------- #

# ----------------------------- #
set PACKAGE_LIST = (			\
								\
	atk.i686					\
	avahi-libs.i686				\
	bzip2-libs.i686				\
	cairo.i686					\
	cups-libs.i686				\
	dbus-libs.i686				\
	expat.i686					\
	fontconfig.i686				\
	freetype.i686				\
	fribidi.i686				\
	gdk-pixbuf2.i686			\
	gdk-pixbuf2-modules.i686	\
	gdk-pixbuf2-xlib.i686		\
	gdk-pixbuf2-xlib.x86_64		\
	glib2.i686					\
	glibc.i686					\
	gmp.i686					\
	gnutls.i686					\
	gtk2.i686					\
	harfbuzz.i686				\
	jasper-libs.i686			\
	jbigkit-libs.i686			\
	keyutils-libs.i686			\
	krb5-libs.i686				\
	libICE.i686					\
	libSM.i686					\
	libX11.i686					\
	libX11-xcb.i686				\
	libXau.i686					\
	libXcomposite.i686			\
	libXcursor.i686				\
	libXdamage.i686				\
	libXext.i686				\
	libXfixes.i686				\
	libXft.i686					\
	libXi.i686					\
	libXinerama.i686			\
	libXrandr.i686				\
	libXrender.i686				\
	libXxf86vm.i686				\
	libblkid.i686				\
	libcap.i686					\
	libcom_err.i686				\
	libdatrie.i686				\
	libffi.i686					\
	libgcc.i686					\
	libgcrypt.i686				\
	libglvnd.i686				\
	libglvnd-glx.i686			\
	libgpg-error.i686			\
	libidn.i686					\
	libidn2.i686				\
	'libidn*'					\
	libjpeg-turbo.i686			\
	libmount.i686				\
	libpciaccess.i686			\
	libpng.i686					\
	libselinux.i686				\
	libsepol.i686				\
	libstdc++.i686				\
	libtasn1.i686				\
	libthai.i686				\
	libtiff.i686				\
	libunistring.i686			\
	libuuid.i686				\
	libverto.i686				\
	libxcb.i686					\
	libxml2.i686				\
	libxshmfence.i686			\
	lz4-libs.i686				\
	mesa-libGL.i686				\
	mesa-libGLU.i686			\
	mesa-libGLU.x86_64			\
	mesa-libglapi.i686			\
	nettle.i686					\
	openssl-libs.i686			\
	p11-kit.i686				\
	pango.i686					\
	pangox-compat.i686			\
	pangox-compat.x86_64		\
	pcre.i686					\
	pcre2.i686					\
	pixman.i686					\
	systemd-libs.i686			\
	xz-libs.i686				\
	zlib.i686					\
	openssl-pkcs11.i686			\
	libcanberra-gtk2.i686		\
	adwaita-gtk2-theme.i686		\
	PackageKit-gtk3-module.i686	\
	graphite2.i686				\
	libdrm.i686					\
	libxcrypt.i686				\
								)
# ----------------------------- #

@ PACKAGE_NUM = 0

# -------------------------------------------------------------------
# Here we need to use the :q variable modifier to be able to handle a
# package_list with wild cards, like: 'libidn*'. See this article:
#
# https://stackoverflow.com/questions/30849512/
# cshell-cannot-set-array-of-strings-with-spaces
# -------------------------------------------------------------------

# foreach package ( $PACKAGE_LIST_TEST:q )

foreach package ( $PACKAGE_LIST_CENTOS:q $PACKAGE_LIST:q )

	echo "${package}" | /bin/grep 'Centos-rpm-packages' >& /dev/null
	set myStatus = $status
	if ( $myStatus == 0 ) then
		set PACKAGE_IS_LOCAL_RPM_FILE = 1
	else
		set PACKAGE_IS_LOCAL_RPM_FILE = 0
	endif

	set SKIP_PACKAGE = 0

	if ( "${OS_NAME}" == "Fedora" ) then

		# ----------------------------------------------------------------------------------------------------------- #
		if ( ( "${OS_VERSION_ID}" == "28" ) && ( "${package}" == 'fribidi.i686'                ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "28" ) && ( "${package}" == 'gtk2.i686'                   ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "28" ) && ( "${package}" == 'libidn.i686'                 ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "28" ) && ( "${package}" == 'libthai.i686'                ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "28" ) && ( "${package}" == 'pango.i686'                  ) ) set SKIP_PACKAGE = 1

		# ----------------------------------------------------------------------------------------------------------- #
		if ( ( "${OS_VERSION_ID}" == "29" ) && ( "${package}" == 'cairo.i686'                  ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "29" ) && ( "${package}" == 'expat.i686'                  ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "29" ) && ( "${package}" == 'fontconfig.i686'             ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "29" ) && ( "${package}" == 'gdk-pixbuf2.i686'            ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "29" ) && ( "${package}" == 'gtk2.i686'                   ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "29" ) && ( "${package}" == 'libSM.i686'                  ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "29" ) && ( "${package}" == 'pango.i686'                  ) ) set SKIP_PACKAGE = 1

		# ----------------------------------------------------------------------------------------------------------- #
		if ( ( "${OS_VERSION_ID}" == "30" ) && ( "${package}" == 'gdk-pixbuf2.i686'            ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "30" ) && ( "${package}" == 'gtk2.i686'                   ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "30" ) && ( "${package}" == 'harfbuzz.i686'               ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "30" ) && ( "${package}" == 'libxml2.i686'                ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "30" ) && ( "${package}" == 'pango.i686'                  ) ) set SKIP_PACKAGE = 1

		# ----------------------------------------------------------------------------------------------------------- #
		if ( ( "${OS_VERSION_ID}" == "31" ) && ( "${package}" == 'gtk2.i686'                   ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "31" ) && ( "${package}" == 'libxml2.i686'                ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "31" ) && ( "${package}" == 'pango.i686'                  ) ) set SKIP_PACKAGE = 1

		# ----------------------------------------------------------------------------------------------------------- #
		if ( ( "${OS_VERSION_ID}" == "32" ) && ( "${package}" == 'libxcrypt.i686'              ) ) set SKIP_PACKAGE = 1

		# ----------------------------------------------------------------------------------------------------------- #
		if ( ( "${OS_VERSION_ID}" == "33" ) && ( "${package}" == 'pangox-compat.i686'          ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "33" ) && ( "${package}" == 'pangox-compat.x86_64'        ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "33" ) && ( "${package}" == 'PackageKit-gtk3-module.i686' ) ) set SKIP_PACKAGE = 1

		# ----------------------------------------------------------------------------------------------------------- #
		if ( ( "${OS_VERSION_ID}" == "34" ) && ( "${package}" == 'gdk-pixbuf2.i686'            ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "34" ) && ( "${package}" == 'pangox-compat.i686'          ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "34" ) && ( "${package}" == 'pangox-compat.x86_64'        ) ) set SKIP_PACKAGE = 1
		if ( ( "${OS_VERSION_ID}" == "34" ) && ( "${package}" == 'PackageKit-gtk3-module.i686' ) ) set SKIP_PACKAGE = 1

	endif

	# Install package if OS is Centos or package is *not* a local rpm file.
	# Skip package if OS is Fedora and package *is* a local rpm file.
	#
	# ----------------------------------------------------- #
	if (													\
			( $SKIP_PACKAGE == 0 ) &&						\
			(												\
				( "${OS_NAME}" == "CentOS Linux"    ) ||	\
				( ${PACKAGE_IS_LOCAL_RPM_FILE} == 0 )		\
			)												\
		) then

		@ PACKAGE_NUM = $PACKAGE_NUM + 1

		if ( ${PACKAGE_NUM} < 10 ) then
			echo "===> Step 15-00${PACKAGE_NUM}: Executing" '"'"${DNF_INSTALL} ${package}"'"' ...
		else
			echo "===> Step 15-0${PACKAGE_NUM}: Executing" '"'"${DNF_INSTALL} ${package}"'"' ...
		endif
		if ( $VERBOSE >= 1 ) then
			echo ""
		endif
		#
		# We also need to enclose ${package} in quotation marks => " xxx "
		# when we execute the dnf command, otherwise the shell tries to
		# expand the "*" character (which will fail).
		#
		# Need to insert 5 blank spaces at beginning of each line (create indentation)
		# awk '{sub(/^/, "     ");print}'
		#
		# ${DNF_INSTALL} "${package}" |& awk '{sub(/^/, "     ");print}' |& tee $TMP_FILE
		# But we cannot use awk here because it suppresses the dnf interactive questions.
		# It is because both awk and sed don't process the commandline until they see a
		# 'lf' character.
		#
		# Instead we need to use the 'tr' command to translate 'lf' to 'lf'
		# followed by 5 spaces.

		${DNF_INSTALL} "${package}"
		set myStatus = $status
		if ( $myStatus != 0 ) then
			echo ""
			echo "*** WARNING: Could not install package: ${package}"
			echo "Ignoring problem and continuing ..."
			if ( $VERBOSE < 1 ) then
				echo ""
			endif
		else
			# Check if the package got installed. Only check
			# if it is not a local Centos rpm package.

			if ( ${PACKAGE_IS_LOCAL_RPM_FILE} == 0 ) then
				# Package is for Fedora
				/bin/dnf list installed "${package}" >& /dev/null
				set myStatus = $status
				if ( $myStatus != 0 ) then
					echo ""
					echo "*** WARNING: Could not install package: ${package}"
					echo "Ignoring problem and continuing ..."
					if ( $VERBOSE < 1 ) then
						echo ""
					endif
				endif
			endif
		endif

		if ( ! -z $TMP_FILE ) then
			if ( $VERBOSE >= 1 ) then
				echo ""
			endif
		endif

	endif

end

if ( -z $TMP_FILE ) then
	echo ""
endif
rm -f $TMP_FILE

CREATE_UNINSTALLER:

if ( $VERBOSE < 1 ) then
	echo ""
endif

cd "${HERE}"

# ***********************************************
echo "===> Step 16: Creating the uninstaller ..."
# ***********************************************

set SRC_DIR = ${HERE}
set DST_DIR = ${INSTALL_DIR}

if ( $VERBOSE >= 1 ) then
	echo ""
	echo "     Copying ${UNINSTALLER_SCRIPT} from ${SRC_DIR} to ${DST_DIR} ..."
	echo ""
endif

cp   ${SRC_DIR}/${UNINSTALLER_SCRIPT} ${DST_DIR}/${UNINSTALLER_SCRIPT}
diff ${SRC_DIR}/${UNINSTALLER_SCRIPT} ${DST_DIR}/${UNINSTALLER_SCRIPT}

if ( $status != 0 ) then
	echo ""
	echo "*** ERROR: Could not copy file: ${UNINSTALLER_SCRIPT}"
	echo "From: ${SRC_DIR}"
	echo "To:   ${DST_DIR}"
	echo ""
	echo "Installation cancelled."
	goto CANCEL
endif
chmod 755 ${DST_DIR}/${UNINSTALLER_SCRIPT}

# Need to put the install directory into the uninstaller script:
# Need to use # sign as replace delimiter for sed, because path
# includes forward slash.
#
sed -e "s#M_INSTALL_DIR#${DST_DIR}#g" < ${DST_DIR}/${UNINSTALLER_SCRIPT} > ${TMP_FILE}
mv ${TMP_FILE} ${DST_DIR}/${UNINSTALLER_SCRIPT}
chmod 755      ${DST_DIR}/${UNINSTALLER_SCRIPT}

DONE:

# Test it:
#
TEST_IT:

cd "${HERE}"

# ***********************************************
echo "===> Step 17: Testing the installation ..."
# ***********************************************

set TEST_LOG = /tmp/acroread-test.log.$$

if ( $VERBOSE >= 1 ) then
	echo ""
	echo '     Running simple test: "/usr/bin/acroread -help" ...'
endif
sleep 1

(/usr/bin/acroread -help) >& $TEST_LOG

grep "to see a full list of available command line options" $TEST_LOG >& /dev/null
if ( $status == 0 ) then
	rm -f $TEST_LOG
else
	echo ""
	echo '*** ERROR: "/usr/bin/acroread -help" failed.'
	echo "Here is the output from the command:"
	echo ""
	echo "------------------------------------------------------------"
	cat $TEST_LOG
	echo "------------------------------------------------------------"
	echo ""
	echo "Installation cancelled."
	echo ""
	echo " To uninstall Adobe Acrobat Reader 9.5.5-1 type this command:"
	echo ""
	echo " ${INSTALL_DIR}/uninstall-acroread"
	echo ""
	rm -f $TEST_LOG
	#
	# We were able to finish the install, but the reader would not
	# launch so we cancel the install but leave the installed files
	# so the user can debug the problem (REMOVE_INSTALL_DIR = 0).
	#
	set REMOVE_INSTALL_DIR = 0
	goto CANCEL
endif

CONGRATS:

	# ---------------------------------------------------------------------------
	echo ""
	echo 'Congratulations\!'
	echo ""
	echo "The installation of Adobe Acrobat Reader for Linux was successful."
	echo ""
	echo " How to run Adobe Acrobat Reader 9.5.5-1"
	echo " ---------------------------------------"
	echo ""
	echo " After the installation process has finished,  Acrobat Reader  can  be"
	echo " launched from the command line by  typing  /usr/bin/acroread  or  via"
	echo ' the GUI by clicking on the "Adobe Reader 9" icon in  the  application'
	echo " panel/menu or double clicking on a PDF file in  the  File Manager  or"
	echo ' right-clicking on an PDF file and select: "Open with Adobe Reader 9".'
	echo ""
	echo " Run 'acroread -usage' to see a short usage message."
	echo " Run 'acroread -help'  to see a full list of command line options."
	echo " Run 'man acroread'    to see the manpage for Acrobat Reader."
	echo ""
	echo " How to uninstall Adobe Acrobat Reader 9.5.5-1"
	echo " ---------------------------------------------"
	echo ""
	echo " The uninstaller does *not* uninstall all  the  prerequisite  packages"
	echo " that the installer installs. It only uninstalls Acrobat Reader itself."
	echo ""
	echo " To uninstall Adobe Acrobat Reader 9.5.5-1 type this command:"
	echo ""
	echo " ${INSTALL_DIR}/uninstall-acroread"
	#
	# ---------------------------------------------------------------------------

	foreach file ( ${HERE}/$TAR_FILE ${HERE}/install-acroread )

		set ANSWER = x
		while ($ANSWER != y && $ANSWER != n)
			echo ""
			echo "Do you want to remove:"
			echo ""
			${ECHO_N} "${file} (y/n)? "
			set ANSWER = $<
			check_answer
		end

		if ($ANSWER == y) then
			if (-e "${file}") then
				echo ""
				echo "Removing ${file} ..."
				rm -f "${file}"
			else
				echo "*** ERROR: Could not find ${file}"
				exit 1
			endif
		endif
	
	end

	rm -f     ${HERE}/${UNINSTALLER_SCRIPT}
	rm -f     ${HERE}/${RPM_FILE}

	chmod 777 ${HERE}/${FEDORA_30_FIX}     >& /dev/null
	chmod 777 ${HERE}/${FEDORA_30_FIX}/*   >& /dev/null
	chmod 777 ${HERE}/${FEDORA_30_FIX}/*/* >& /dev/null
	rm -f -r  ${HERE}/${FEDORA_30_FIX}
  
	chmod 777 ${HERE}/${CENTOS_RPMS}     >& /dev/null
	chmod 777 ${HERE}/${CENTOS_RPMS}/*   >& /dev/null
	rm -f -r  ${HERE}/${CENTOS_RPMS}
  
REALLY_DONE:

	echo ""
	echo "Done."
	echo ""
	exit 0

INVALID_INSTALL_DIR:

	echo ""
	echo "*** ERROR: Invalid install directory -->" "${INSTALL_DIR}"
	echo ""
	echo "Please use the -usage option for more information"
	echo ""
	goto ERROR_EXIT


TOO_MANY_OPTIONS:

	echo ""
	echo "*** ERROR: Too many options -->" "${argv[1]}"
	echo ""
	echo "Please use the -usage option for more information"
	echo ""
	goto ERROR_EXIT

INVALID_OPTION:

	echo ""
	echo "*** ERROR: Invalid option -->" "${argv[1]}"
	echo ""
	echo "Please use the -usage option for more information"
	echo ""
	goto ERROR_EXIT

# Error Exit:
#
ERROR_EXIT:

	cd /
	chmod 777 $TMP_DIR  >& /dev/null
	rm -f -r  $TMP_DIR  >& /dev/null

	chmod 777 $TMP_FILE >& /dev/null
	rm -f     $TMP_FILE >& /dev/null

	exit 1

CLEAN_UP:

	echo ""
	echo "Received interrupt, cleaning up ..."
	echo ""

CANCEL:

	if ($REMOVE_INSTALL_DIR == 1) then
		echo "Removing ${INSTALL_DIR} ..."
		chmod -R 777   ${INSTALL_DIR}
		rm -f -r       ${INSTALL_DIR}
	endif

	cd /
	chmod 777 $TMP_DIR  >& /dev/null
	rm -f -r  $TMP_DIR  >& /dev/null

	chmod 777 $TMP_FILE >& /dev/null
	rm -f     $TMP_FILE >& /dev/null

	echo ""
	exit 1

# ---------------------------------------------------------------------------
HISTORY:

more <<EOF

Acroread Linux Installer Release History:

 Date:      | Version:      | Changes:
------------+---------------+------------------------------------------------
 2020-09-08 | Version-1.0.0 | First version. Support for Centos-8, Fedora-28
            |               | through Fedora-31.
------------+---------------+------------------------------------------------
 2020-11-25 | Version-1.0.1 | Added support for Fedora-32 and Fedora-33.
------------+---------------+------------------------------------------------
 2020-12-27 | Version-1.0.2 | Added support for the -history command option.
------------+---------------+------------------------------------------------
 2021-05-21 | Version-1.0.3 | Added support for Fedora-34
------------+---------------+------------------------------------------------

EOF

exit 0

# ---------------------------------------------------------------------------
USAGE:

more <<EOF

INSTALL-ACROREAD(1)             USER COMMANDS              INSTALL-ACROREAD(1)

NAME

    install-acroread - Linux Fedora Installer for Adobe Acrobat Reader 9.5.5-1

SYNOPSYS

    ./install-acroread [ -usage ]
    ./install-acroread [ -history ]
    ./install-acroread [ -v | -vv ] [ install_dir ]

DESCRIPTION

    This is the Linux Fedora Installer for Adobe Acrobat Reader. It installs
    Acrobat Reader 9.5.5-1 in the given install_dir. If the  install_dir  is
    not provided, then the installer prompts you for an  install  directory.
    The recommended install_dir  is:  "/opt/Adobe/Acrobat".  A  subdirectory
    named 'Reader9' will be created in the install  directory  you  specify.
    The install directory must have at least 200 MBytes of free disk  space.
    The pathname must not contain embedded spaces or other  characters  that
    have special meaning to the shell (C-shell). To  run  the  installer  in
    non-interactive mode,  specify the install_dir on the command  line  and
    use the "yes" command (/usr/bin/yes)  to  confirm  all  questions,  like
    this:

    yes | ./install-acroread [ -v | -vv ] /opt/Adobe/Acrobat
 
OPTIONS

    -usage
        Print this usage message to stdout.

    -history
        Print the release history to stdout.

    -v
        Install verbosely. The installer prints detailed  progress
        information to stdout during the installation.

    -vv
        Install more verbosely. The installer prints very detailed
        progress information to stdout during the installation.

VERSION

    ${MY_VERSION}

BUILD DATE

    ${MY_RELEASE_DATE}

AUTHOR

    ${MY_AUTHOR}

NOTES

    If you want to record the installer output to  a  log-file,  use  the
    "tee" command (/usr/bin/tee), like this:

    ./install-acroread [ -v | -vv ] /opt/Adobe/Acrobat |& tee install.log

    Do NOT pipe the installer output directly to the log-file like this:

    ./install-acroread [ -v | -vv ] /opt/Adobe/Acrobat >& install.log

    because it will disrupt your interaction with the installer during
    the installation.

EOF

exit 0
          
# === End of install-acroread

