--- scripts/hf.orig Sat Mar 26 19:11:18 2005 +++ scripts/hf Mon Jul 31 15:48:32 2006 @@ -1,7 +1,7 @@ -#!/bin/bash +#!/bin/sh # # -# *** *** /usr/bin/hf *** *** +# *** *** /usr/local/bin/hf *** *** # *** *** # *** Main Start Script for *** # *** /usr/bin/hfkernel *** @@ -12,7 +12,7 @@ # # # -# There is a system-wide config file: /etc/hf.conf +# There is a system-wide config file: /usr/local/etc/hf.conf # I will prepare the same defaults here and there, # they will work in most cases. # This script will include the config file, @@ -22,7 +22,7 @@ # file which should have root access only be in /usr/bin.) ## There is a lot of documentation in English and German! -## See comments in /etc/hf.conf, +## See comments in /usr/local/etc/hf.conf, ## See the HF-HOWTO in the doc subdirectory of hf package, ## See F1 in the hfterm window! ## To configure /etc/hf.conf just remove the single comment signs @@ -40,11 +40,7 @@ ## prepare "TELL" as a dialog-like function or just echo, ##################### ## depends on X or console #################################################### -if which dialog > /dev/null; then - DIALOG=dialog -else - if which whiptail > /dev/null; then - function whiptail_wrapper() { +whiptail_wrapper() { X1="$1" X2="$2" if [ $1 = --yesno ]; then @@ -54,7 +50,12 @@ fi shift 3 whiptail "$X1" "$X2" $X3 "$@" - } +} + +if which dialog > /dev/null; then + DIALOG=dialog +else + if which whiptail > /dev/null; then DIALOG=whiptail_wrapper else echo "Sorry, dialog or whiptail not found." @@ -62,7 +63,7 @@ fi fi -function tell { +tell() { if [ ! $DISPLAY ] ; then if [ ! -z "$DIALOG" ]; then dialog \ @@ -84,15 +85,15 @@ rc_failed="\033[71G\033[31m\033[1mfailed\033[m" ## Prepare greeting message: ################################################## -function greeting { +greeting() { tell " Hello, $startuser, I am $0, the main start script for hfkernel and hfterm, a ham radio CW-RTTY-AMTOR-GTOR-PACTOR-MT63 program system with TCP and F6FBB interface. -My main configuration file is /etc/hf.conf. +My main configuration file is /usr/local/etc/hf.conf. Short help is: man hfkernel, man hfterm, man hf. -More help in: /usr/share//hf/HF-HOWTO +More help in: /usr/local/share/doc/hf/HF-HOWTO or in the graphic 'hfterm' by F1. The homepage of hf is http://hfterm.sf.net. You are welcome to subscribe our mailing list: @@ -110,13 +111,11 @@ timecorr=1 soundcorr=1 kerneloptions= -config_file=/etc/hf.conf -proc_mhzcorr=`cat /proc/cpuinfo | grep MHz | cut -c 11- | head -n 1` -# the head is for the case you have 2 processors, like me, .... .. !!! +config_file=/usr/local/etc/hf.conf ## if not yet there, make a directory for the program's files ################ ## and fill it with examples, e.g. text macos for cq asnd so on ############## -function makepersonaldir { +makepersonaldir() { cd $HOME if [ ! -d hf ] ; then tell " @@ -142,7 +141,7 @@ with examples, e.g. text macros... " - cp -ruv /usr/share/hf/hf-examplefiles/* ./hf + cp -v /usr/local/share/hf/hf-examplefiles/* ./hf if [ $? -eq 0 ]; then tell " @@ -154,7 +153,7 @@ could not copy examplefiles. Please check if -/usr/share/hf/hf-examplefiles/... is there. +/usr/local/share/hf/hf-examplefiles/... is there. " fi @@ -163,12 +162,12 @@ }; ## Start hfkernel function: ################################################### -function startkernel { +startkernel() { tell " I will run now: $background_display $alsa_prefix -/usr/bin/hfkernel +/usr/local/bin/hfkernel -a $audio -p $serial -m $mhz -t $timecorr -s $soundcorr @@ -178,7 +177,7 @@ For any errors, see /usr/share/hf/HF-HOWTO ! You can stop the hfkernel with c. " -$background_display $alsa_prefix /usr/bin/hfkernel \ +$background_display $alsa_prefix /usr/local/bin/hfkernel \ -a $audio -p $serial \ -m $mhz -t $timecorr -s $soundcorr \ $kerneloptions @@ -203,7 +202,7 @@ Sorry, the hf script is not prepared to accept options. To configure the package, -please just edit /etc/hf.conf. +please just edit /usr/local/etc/hf.conf. " @@ -215,7 +214,6 @@ . $config_file tell " -/proc/cpuinfo thinks your cpu runs with $proc_mhzcorr Mhz. OPTIONS from main configuration file $config_file: Serial ptt: $serial @@ -258,7 +256,7 @@ Maybe you can stop that process, or you will have to select another serial port -in /etc/hf.conf. +in /usr/local/etc/hf.conf. " exit 1 fi @@ -282,10 +280,10 @@ so that non-root users can run it. But be aware that this can be a security hole. I will do this now by : -\"chmod 4755 /usr/bin/hfkernel\". +\"chmod 4755 /usr/local/bin/hfkernel\". " - chmod 4755 /usr/bin/hfkernel &> /dev/null + chmod 4755 /usr/local/bin/hfkernel &> /dev/null else # if not root tell " @@ -294,7 +292,7 @@ so that normal users can run it. Be aware that this can be a security hole. Please do as root -\"chmod 4755 /usr/bin/hfkernel\". +\"chmod 4755 /usr/bin/local/hfkernel\". or start this script again as root. " exit 1 @@ -310,7 +308,7 @@ If it works o.k., and you want to run the whole program (including graphic terminal), become normal user, start X, -and start the whole program with /usr/bin/hf. +and start the whole program with /usr/local/bin/hf. " startkernel @@ -329,7 +327,7 @@ If it works o.k., and you want to run the whole program (including graphic terminal), start X, -and start the whole program with /usr/bin/hf. +and start the whole program with /usr/local/bin/hf. " startkernel @@ -345,7 +343,7 @@ startkernel & sleep 1 # see if hfterm is running - hfterm=`pidof hfterm` + hfterm=`pgrep hfterm` if [ $hfterm ] ; then tell "hfterm is running already under X. I restart it." kill $hfterm @@ -356,11 +354,11 @@ Sorry, I still have some problems with UTF-8... I will remember your LANGUAGE and set LANG to de_DE.ISO-8859-1 for a while... -Then I will start /usr/bin/hfterm. +Then I will start /usr/local/bin/hfterm. " OLDLANG=$LANG LANG=de_DE.ISO-8859-1 -/usr/bin/hfterm +/usr/local/bin/hfterm fi ## Cleanup #################################################################### @@ -370,7 +368,7 @@ LANG=$OLDLANG echo "reset LANG to $LANG" -hfkernel=`pidof hfkernel` +hfkernel=`pgrep hfkernel` if [ $hfkernel ] ; then echo -e "hf: sending the kill signal to hfkernel ... " hfkernel -k