#! /bin/sh #---------------------------------------------------------------------------- # /var/install/bin/doc - ask user for doc view # # Copyright (c) 2003-2004 Frank Meyer # # Creation: 28.08.2003 fm # Last Update: $Id$ # # usage: doc file # doc file message # # return values: # 0 pager started # 1 pager not started # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # include eislib . /var/install/include/eislib docfile=$1 if [ "`dirname "$docfile"`" = "." -a "$PACKAGE" != "" ] then docfile="/usr/share/doc/$PACKAGE/$docfile" fi if [ $# -eq 2 ] then title="$2" clrhome mecho -info "$title" mecho fi pager=$PAGER if [ "$pager" = "" ] then pager=less fi mecho mecho mecho "The documentation will be shown using '$PAGER'" case $pager in *less) mecho "You can get help by typing the key 'h', 'q' to quit.";; *more*) mecho "You can get help by typing the key 'h', 'q' to quit.";; *vi|*view ) mecho "You can get help by typing :h, :q to quit.";; *) true;; esac mecho rtc=1 if /var/install/bin/ask "Continue" "yes" then if [ -f $docfile -a -s $docfile ] then export LESSCHARSET=latin1 $pager $docfile if [ $? -ne 0 ] then mecho -error "pager $PAGER invalid!" mecho -error "check variable PAGER." anykey else rtc=0 fi else mecho -warn "Could not find desired documentation!" anykey fi fi exit $rtc