Zimmer,
If you want code formatted, just make sure that each
line has 1-2 spaces at the beginning, and then it is
automatically formatted. Its nice.
Kevin
--- JohnLeo Zimmer <[EMAIL PROTECTED]> wrote:
> I have been chewing on Bhaskar's install/run/erase
> script for months
> now. I need to run it in a non-X environment
> (colinux, for example). So
> I have been converting it from Xdialog to dialog and
> learning some Bash
> along the way.
>
> This week I have cleared up a couple of my
> long-standing bugs and have
> it ready to expose it to constructive criticism. I
> attach it here and
> copy to Bhaskar who can incorporate it or not as he
> sees fit. (Kevin,
> I'll try for the Wiki, too. But formating is
> non-trivial there.)
>
> I discovered Xdialog's compatbility features which,
> if installed run
> dialog scripts with Xdialog's GUI. Much slicker than
> duplicating the
> script in dialog and Xdialog.
>
> regards,
> jlz
>
> > #!/bin/bash
> # Install and run OpenVistA for the OpenVistA Vivum
> live CD.
> # GT.M[TM] is assumed to be on the CD at
> /usr/local/gtm.
> # OpenVistA distribution is assumed to be on the CD
> at /usr/local/OpenVistA.
> #
> # This script is placed in the public domain by K.S.
> Bhaskar
> #
> # For demonstration purposes only, and not for
> production use.
> # The user assumes all responsibility for using this
> script.
> #
> # Revision history
> # 20040103 0.1 K.S. Bhaskar Initial Creation
> # 20040119 0.11 K.S. Bhaskar Make mount command
> sudoXdialog.wrapper
> # 20040122 0.12 K.S. Bhaskar Remove mount
> command and require directories be mounted in
> advance
> # 20040605 0.2 K.S. Bhaskar Put all source
> files in one directory
> # 20040627 0.3 K.S. Bhaskar Default gtm_source
> and vista_source based on package defaults
> # 20050305 0.31 K.S. Bhaskar Default base
> install directory to $PWD
>
> # 20050512 0.31z J.L. Zimmer Converted from
> Xdialog to dialog with addition of Rundown and
> cosmetic tweaks
> # See Xdialog documentation for
> Compatability
> Mode and installation of Xdialog.wrapper
>
> # Default locations for GT.M and OpenVistA
> # Determine directory if none specifiedfor GT.M and
> OpenVistA
>
> if [ -z "$vista_source" ] ; then export
> vista_source=`dirname $0` ; fi
> if [ -z "$gtm_source" ] ; then export
> gtm_source=$vista_source/../gtm ; fi
>
> # Set up GT.M environment & point to global
> directory.
>
> . $gtm_source/gtmprofile
> export gtmgbldir=$vista_source/g/mumps.gld
>
> # Determine action.
>
> case $1 in
> --install) action="Install (and run)" ;;
> --run) action="Run" ;;
> --erase) action="Erase" ;;
> --rundown) action="Rundown" ;;
>
> *) if dialog --title " OpenVistA Startup Menu
> " --radiolist " Select Action" 0 0 5 \
> "Install (and run)" "<directory> [entryref]" "" \
> "Run" "<directory> [entryref]" "on" \
> "Rundown" "" "" \
> "Erase" "<directory>" "" 2>/tmp/OpenVistA$$.tmp ;
> then action=`cat /tmp/OpenVistA$$.tmp` ; rm -f
> /tmp/OpenVistA$$.tmp ;
> else if [ -z "$action" ] ; then dialog --title "no
> action selected" --msgbox "Cancelled. Exiting
> Script..." 0 0 ; exit 1 ; fi
> fi
> ;;
> esac
>
> # Select a directory. ( "$action" )
>
> if [ -z "$2" ] ; then directory=~/ ; else
> directory=$2 ; fi
>
> dialog --title " Select directory { $action } "
> --fselect $directory 0 0 2>/tmp/OpenVistA$$.tmp
> export vista_home=`sed 's/\/$//'
> /tmp/OpenVistA$$.tmp` ; rm /tmp/OpenVistA$$.tmp
>
> if [ -z $vista_home ] ; then dialog --title "no
> directory selected" --msgbox "Action Cancelled.
> Exiting..." 0 0 ; exit 1 ; fi
>
> # For Run and Erase directory must exist; for
> Install OK to create if non existent.
>
> case $action in
> ("Run"|"Erase"|"Rundown")
> if ! [ -f "$vista_home/g/mumps.dat" ]
> then dialog --msgbox "$vista_home/g/mumps.dat does
> not exist. Exiting..." 0 0 ; exit 1
> fi
> ;;
> *) if ! [ -d "$vista_home && -d $vista_home/o && -d
> $vista_home/r" ]
> then if dialog --yesno "$vista_home and/or
> subdirectories don't exist. OK to create?" 0 0
> then mkdir -p $vista_home/g $vista_home/o
> $vista_home/r
> else dialog --title "no to new directory"
> --msgbox "Installation Cancelled. Exiting..." 0 0 ;
> exit 1
> fi
> else dialog --msgbox "Unable to create $vista_home
> and/or subdirectories. Exiting..." 0 0 ; exit 1
> fi
> ;;
> esac
>
> # Ready to execute our action.
>
> case $action in
> "Run") export
> gtmroutines="$vista_home/o($vista_home/r)
> $vista_source/o($vista_source/r) $gtm_dist"
> cd $vista_home ; clear
> if [ -z "$3" ] ; then $gtm_dist/mumps -dir ; else
> $gtm_dist/mumps -run $3 ; fi
> action="Rundown"
> # Offers rundown on the
> way out
> ;;
> "Erase")
> if dialog --title "ERASE" --yesno "about to delete
> $vista_home" 0 0
> then if ! `rm -rf $vista_home`
> then dialog --title "" --msgbox "Unable to delete
> $vista_home. Exiting..." 0 0 ; exit 1
> fi
> fi
> ;;
> "Install (and run)")
> dialog --msgbox "Copying the database. May take
> several minutes." 0 0 &
> gzip -d <$vista_source/g/mumps.dat.gz
> >$vista_home/g/mumps.dat
> export gtmroutines="$vista_home/o($vista_home/r)
> $vista_source/o($vista_source/r) $gtm_dist"
> if [ -z "$3" ] ; then $gtm_dist/mumps -dir ; else
> $gtm_dist/mumps -run $3 ; fi
> action="Rundown"
> ;;
> esac
>
> case $action in
> "Rundown")
> if dialog --defaultno --yesno "Rundown the
> database now?" 0 0
> then `$gtm_dist/mupip rundown -r "*"`
> fi
> ;;
> esac
>
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Hardhats-members mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hardhats-members