help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Control Theory Toolbox


From: Kai Mueller
Subject: Re: Control Theory Toolbox
Date: Wed, 29 Apr 1998 19:09:49 +0200

On Wed, Apr 29, 1998 at 12:30:36PM -0400, John Rieffel wrote:
> 
> hiya brave folks,
> 
> spurred by the relative sparsity of the Control Theory toolbox I am trying
> to install hodel's more complete control toolbox found at:
> 
> ftp://ftp.eng.auburn.edu/pub/hodel/
> 
> the README-OCTAVE file says to decompress the files in my
> "octave-2.0.5/scripts" directory and then "reinstall octave". 
> Unfortunately I installed from an RPM (so "reinnstalling" doesn't quite
> work the same way) - and moreover there isn't a "scripts"  directory in
> octave-2.0.11. 
> 
> Could someone possibly clarify the process involved to add these
> supplemental files to my octave installation?
> 


I know your problem. Following is a script file that does
the job of installing the controls toolbox in the appropriate
locations. You can use the same script for applying updates
of the controls toolbox. Decompress the files anywhere
and invoke the script with

   ./install-ocst all

It will ask before doing anything.

Kai

---- install-ocst -----------------------------------
#!/bin/sh
#
# nstall-ocst   --   install/update Octave Controls Toolbox (OCST)
#                    of A. Scottedward Hodel <address@hidden>
#
# This script uses chunks of "install-octave"
# from John W. Eaton <address@hidden>
#
# Kai P Mueller <address@hidden>, TU Braunschweig
# 11/22/97 initial version
#
    

if [ $# -ne 1 ]
then
  echo
  echo "    usage: $0 (help | all | select)"
  echo
  exit 1
fi

case $1 in

  help)
    cat << EOF
==========================================================================
  install-ocst attempts to install (or update) the OCST (Octave controls
  toolbox) of your version of Octave.

   The files in the subdirectories "general", "linear-algebra",
   "strings", "plot", and "control" will be copied to the Octave data
   directories with proper permissions.

   The install and update procedures differ in the way they perform the
   copy of the  files in this OCST version.

   o all     Copy all files to the Octave data directories assuming that
             this version is newer. Install does not ask any questions.
             This modfe is best if you are the system administrator you
             just want to install the control stuff.

   o select  Copy all files but ask before replacing an existing file
             which differs from the one in this distribution. The update
             mode is appropriate for developers. New files will be
             copied without confirmation.
             Note: it can be very annoying to confirm the replacements.
==========================================================================
EOF
    exit 0
    ;;

  all)
    ask=no
    ;;

  select)
    ask=yes
    ;;

  *)
    echo
    echo "    usage: $0 (help | all | select)"
    echo
    exit 1
    ;;
esac

if [ `whoami` != root ]
then
  echo -n " * You should execute install-ocst as root, continue anyway? [n]: "
  read ans
  case "$ans" in
    y | Y | yes | YES)
    ;;
    *)
      exit 1
    ;;
  esac
fi

# change location of the distribution file here:
ocst_version=1.1
datadir=/usr/local/share
oct_version=2.0.9

echo
echo " - This is the OCST V$ocst_version update procedure -"

# change everything below at your own risk.
# check data directory
echo
echo -n " * Octave data dir is $datadir/octave; is that correct? [y]: "
read ans
case "$ans" in
  n | N | no | NO)
    echo -n " * Enter Octave data dir (without /octave/...): "
    read datadir
  ;;
esac
if [ ! -d "$datadir/octave" ]
then
  echo "install-ocst: Octave dir ($datadir/octave) does not exist - Goodbye."
  exit 1
fi

# check Octave version
echo
echo -n " * Octave version is $oct_version; is that correct? [y]: "
read ans
case "$ans" in
  n | N | no | NO)
    echo -n " * Enter Octave version: "
    read oct_version
  ;;
esac
toplevel=$datadir/octave/$oct_version/m
if [ ! -d $toplevel ]
then
echo "install-ocst: toplevel dir ($toplevel) does not exist - Goodbye."
  exit 1
fi

# perform installation
echo
echo -n " * This is your last chance to quit, continue installation? [y]: "
read ans
case "$ans" in
  n | N | no | NO)
    echo "install-ocst aborted."
    exit 0
  ;;
esac

echo
distdir=`pwd`
for dd in general linear-algebra strings plot control
do
  if [ -d "$dd" ]
  then
    echo " o installing files in $dd..."
    cd $dd
    for ff in `ls`
    do
      if [ $ask = yes ]
      then
        if [ -e "$toplevel/$dd/$ff" ]
        then
          diff $ff "$toplevel/$dd/$ff" > /dev/null
          if [ "$?" = 0 ]
          then
            # files are identical; do not copy
            echo "---> $ff  (does already exist, no replacement)"
          else
            # file already exit, our version is (possible) newer
            echo -n " * Replace existing $ff? [y]: "
            read ans
            case "$ans" in
              n | N | no | NO)
                echo "---> $ff skipped."
              ;;
              *)
                cp $ff $toplevel/$dd
                chmod 644 $toplevel/$dd/$ff
              ;;
            esac
          fi
        else
          echo "---> $ff  (new file)"
          cp $ff $toplevel/$dd
          chmod 644 $toplevel/$dd/$ff
        fi
      else
        # copy everything without asking
        cp $ff $toplevel/$dd
        chmod 644 $toplevel/$dd/$ff
      fi
    done
    echo "   ...files in $dd installed."
  fi
  cd $distdir
done

echo
echo "   All files have been installed. Now to the final question:"
echo

echo -n " * Replace/create ls-R file? [y]: "
read ans
case "$ans" in
  n | N | no | NO)
    echo "--> no new ls-R file."
  ;;
  *)
    if [ -d "$datadir/libexec" ]
    then
      echo "install-ocst: libexec directory found."
      ls -LR $datadir/octave $libexecdir/octave > $datadir/octave/ls-R
    else
      echo "install-ocst: libexec directory not found."
      echo "              (you can safely ingnore this message.)"
      ls -LR $datadir/octave > $datadir/octave/ls-R
    fi
  ;;
esac

echo "Thank you for using install-ocst."
exit 0
---- install-ocst [end]  ----------------------------


-- 
 Kai P. Mueller
 Control Department (Regelungstechnik) | Phone [+49] (531) 391-3835
 Technical University Braunschweig     | Fax   [+49] (531) 391-5194
 D-38092 Braunschweig                  | Email address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]