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

Colin Ingram synergizedmusic at gmail.com
Sun Feb 12 02:50:57 UTC 2006


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:

#!/bin/bash

major_versions="2.1 2.9"
man="/usr/share/man/man1/"
bin="/usr/bin/"
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"
		                ;;
	esac
    fi
  done
  update-alternatives $OCTAVE $HEADERS
done



More information about the Pkg-octave-devel mailing list