From 04eddbe0a09570a5ed9b8f397913b43fe251e156 Mon Sep 17 00:00:00 2001 From: maintenance team Date: Wed, 10 Dec 2008 11:17:21 +0000 Subject: [PATCH] Finding pdf reader has been added --- config_files/release_notes.sh | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/config_files/release_notes.sh b/config_files/release_notes.sh index 42ad401..9b3f3b0 100755 --- a/config_files/release_notes.sh +++ b/config_files/release_notes.sh @@ -16,10 +16,18 @@ # Returns 0 in success and 1 if any error occurs. check_enabled() { - ROOT_DIR=`(cd ${SRC_DIR}\.. ; pwd)`; + ROOT_DIR=`(cd ${SCRIPT_DIR}/.. ; pwd)`; + # 1. check if there is appropriate PDF files viewer + for r in acroread kpdf kghostview xpdf ; do + reader=`which $r 2>/dev/null` + if [ "$?" == "0" ] ; then + break; + fi + done + # 2. check if Release Notes file is available if [ "${ROOT_DIR}" != "" ] ; then - rn_files=`find ${ROOT_DIR} -name "*Release_Notes.pdf"` - if [ "$?" == "0" ] && [ "$rn_files" != "" ] ; then + rn_files=`find ${ROOT_DIR} -maxdepth 1 -name "*Release_Notes.pdf"` + if [ "$?" == "0" ] && [ "$rn_files" != "" ] && [ "$reader" != "" ] ; then return 0; fi fi @@ -30,15 +38,20 @@ check_enabled() # Returns 0 in success and 1 if any error occurs. execute() { - ROOT_DIR=`(cd ${SRC_DIR}\.. ; pwd)`; + ROOT_DIR=`(cd ${SCRIPT_DIR}/.. ; pwd)`; + # 1. find appropriate PDF files viewer + for r in acroread kpdf kghostview xpdf ; do + reader=`which $r 2> /dev/null` + if [ "$?" == "0" ] ; then + break; + fi + done + # 2. find Release Notes file and open it in the viewer if [ "${ROOT_DIR}" != "" ] ; then - rn_file=`find ${ROOT_DIR} -name "*Release_Notes.pdf"` - if [ "$?" == "0" ] && [ "$rn_file" != "" ] ; then - xpdf=`which xpdf >& /dev/null` - if [ "$?" == "0" ] ; then - xpdf ${rn_file} & - return 0; - fi + rn_file=`find ${ROOT_DIR} -maxdepth 1 -name "*Release_Notes.pdf"` + if [ "$?" == "0" ] && [ "$rn_file" != "" ] && [ "$reader" != "" ] ; then + $reader ${rn_file} & + return 0; fi fi return 1; -- 2.39.2