[Pkg-octave-devel] Re: update-alternatives and Octave packages

Colin Ingram synergizedmusic at gmail.com
Sun Feb 12 09:44:53 UTC 2006


On 2/11/06, Colin Ingram <synergizedmusic at gmail.com> wrote:
> On 2/10/06, Rafael Laboissiere <rafael at debian.org> wrote:
>
> > It might be possible to write a script (called, say,
> > /usr/bin/octave-update-alternatives) which will be called from the
> > postinst scripts of both octave2.* and octave2.*-headers packages.  This
> > script would install the alternatives with the appropriate slave links
> > according to the presence or absence of the octave2.*-headers in the
> > system.  I have not yet tested this idea, though, so I do not know if it
> > really works.  I will give a try next week, unless someone else beats me
> > on that.
>
>
> its pretty rough and incomplete but how about something like this:
>
a more complete version

#!/bin/bash

major_versions="2.1 2.9"
man="/usr/share/man/man1/"
bin="/usr/bin/"
include="/usr/include/"
share="/usr/share/"
info="${share}info"
debian="${share}octave/debian/"

for v in $major_versions
do
  if [ $v == "2.1" ]; then VERSION=2.1.72; PRIORITY=80; fi
  if [ $v == "2.9" ]; then VERSION=2.9.4;  PRIORITY=70; fi
  packages="octave$v octave$v-headers octave$v-emacsen octave$v-info"

  for g in $packages
  do
    if [ -n `dpkg -l | grep -o "$g "` ]
    then
	case $g in
	    octave2.? ) OCTAVE="--install ${bin}octave octave             \
                                          ${bin}octave-$VERSION $PRIORITY \
                                --slave ${man}octave.1.gz octave.1.gz     \
                                        ${man}octave-$VERSION.1.gz        \
                                --slave ${bin}octave-bug octave-bug       \
                                        ${bin}octave-bug-$VERSION         \
                                --slave ${man}octave-bug.1.gz             \
                                        octave-bug.1.gz                   \
                                        ${man}octave-bug-$VERSION.1.gz"
                 	;;
	
	    octave2.?-headers ) HEADERS="--slave ${bin}mkoctfile mkoctfile \
                                                 ${bin}mkoctfile-$VERSION \
                                         --slave ${man}mkoctfile.1.gz      \
                                                 mkoctfile.1.gz            \
                                                 ${man}mkoctfile-$VERSION.1.gz\
                                         --slave ${bin}octave-config       \
                                                 octave-config             \
                                                 ${bin}octave-config-$VERSION\
                                         --slave ${man}octave-config.1.gz  \
                                                 octave-config.1.gz        \
                                                
${man}octave-config-$VERSION.1.gz\
                                         --slave ${bin}octave-depends      \
                                                 octave-depends            \
                                                 ${bin}octave-depends-$VERSION\
                                         --slave ${man}octave-depends.1.gz \
                                                 octave-depends.1.gz       \
                                                
${man}octave-depends-$VERSION.1.gz\
                                         --slave ${include}octave          \
                                                 octave-include            \
                                                 ${include}octave-$VERSION \
                                         --slave ${debian}defs.make        \
                                                 octave-defs.make          \
                                                 ${debian}defs.make-$VERSION"
		                ;;

	    octave2.?-emacsen ) EMACS="--slave ${bin}otags otags           \
                                               ${bin}otags-$VERSION        \
                                       --slave ${man}otags.1.gz otags.1.gz \
                                               ${man}otags-$VERSION.1.gz"
                                ;;

	    octave2.?-info ) if [ -n `dpgk -l | grep -o "octave$v` ]
                             then
                                 INFO="--slave ${info}octave.info.gz       \
                                               octave.info.gz              \
                                               ${info}octave$v.info.gz     \
                                       --slave ${info}liboctave.info.gz    \
                                               liboctave.info.gz           \
                                               ${info}liboctave$v.info.gz  \
                                       --slave ${info}Octave-FAQ.info.gz   \
                                               Octave-FAQ.info.gz          \
                                               ${info}Octave$v-FAQ.info.gz"
                             else
	                         for f in octave at v liboctave at v Octave at v-FAQ
                                 do
	                           g=`echo $f | sed s/@v//`
	                           h=`echo $f | sed s/@v/$v/`
	                           INFO="--install ${info}$h.info.gz \
		                                  $g.info.gz         \
		                                  ${info}$i.info.gz  \
                                                  $PRIORITY"
                                 done
                             fi
		             ;;
	    # In anticipation of octave-forge package split
#	    octave-forge2.? ) FORGE="--slave ${bin}mex mex           \
#                                             ${bin}mex-$VERSION      \
#                                     --slave ${man}mex.1.gz          \
#                                             mex.1.gz                \
#                                             ${man}mex-$VERSION.1.gz"
#		              ;;
	
	esac
    fi
  done
  update-alternatives $OCTAVE $HEADERS $EMACS $INFO $FORGE
done



More information about the Pkg-octave-devel mailing list