posted by Justin Piszcz on Mon 7th Jun 2004 05:37 UTC

"Relink, Page 5/5"
Upgrading a program As it already may be self-evident, I will demonstrate upgrading a program using relink as well as how to fix a possible bug if you encounter it.

For my example, I will be installing mtr 0.55 and then upgrade to 0.58.

jpiszcz@jpt2:~$ ls -l *bz2
-rw-r--r--  1 jpiszcz users 84896 May 27 01:07 mtr-0.55.tar.bz2
-rw-r--r--  1 jpiszcz users 82853 May 27 01:07 mtr-0.58.tar.bz2
jpiszcz@jpt2:~$ tar jxf mtr-0.55.tar.bz2 ; tar jxf mtr-0.58.tar.bz2
jpiszcz@jpt2:~$
A nice little script is including with relink called conf, this sets up your ./configure --prefix=/app/program for you then makes the program.
jpiszcz@jpt2:~/mtr-0.55$ conf

Autoconfigure for /app                       piszcz v1.0
 pkgName: mtr-0.55
  newDir: /app/mtr-0.55
./configure --prefix=/app/mtr-0.55
creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/ginstall -c

.. configure stuff here ..

.. make stuff here ..

gcc -DHAVE_CONFIG_H -I. -I. -I.     -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 \
-I/usr/lib/glib/include -I/usr/X11R6/include -c curses.c
gcc  -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include \
-I/usr/X11R6/include  -o mtr gtk.o curses.o mtr.o net.o dns.o \
 raw.o split.o display.o report.o getopt.o getopt1.o select.o  -lresolv -lm -lncurses -ltermcap  \
 -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule -lglib -ldl -lXext -lX11 -lm
make[2]: Leaving directory `/home/jpiszcz/mtr-0.55'
make[1]: Leaving directory `/home/jpiszcz/mtr-0.55'

real    0m21.158s
user    0m18.610s
sys     0m1.040s

 if everything looks good: make install

jpiszcz@jpt2:~/mtr-0.55$
jpiszcz@jpt2:~/mtr-0.55$ make install
Making install in img
make[1]: Entering directory `/home/jpiszcz/mtr-0.55/img'
make[2]: Entering directory `/home/jpiszcz/mtr-0.55/img'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/jpiszcz/mtr-0.55/img'
make[1]: Leaving directory `/home/jpiszcz/mtr-0.55/img'
make[1]: Entering directory `/home/jpiszcz/mtr-0.55'
make[2]: Entering directory `/home/jpiszcz/mtr-0.55'
/bin/sh ./mkinstalldirs /app/mtr-0.55/sbin
mkdir /app/mtr-0.55/sbin
  /usr/bin/ginstall -c  mtr /app/mtr-0.55/sbin/mtr
chmod u+s /app/mtr-0.55/sbin/mtr
make  install-man8
make[3]: Entering directory `/home/jpiszcz/mtr-0.55'
/bin/sh ./mkinstalldirs /app/mtr-0.55/man/man8
mkdir /app/mtr-0.55/man
mkdir /app/mtr-0.55/man/man8
 /usr/bin/ginstall -c -m 644 ./mtr.8 /app/mtr-0.55/man/man8/mtr.8
make[3]: Leaving directory `/home/jpiszcz/mtr-0.55'
make[2]: Leaving directory `/home/jpiszcz/mtr-0.55'
make[1]: Leaving directory `/home/jpiszcz/mtr-0.55'
jpiszcz@jpt2:~/mtr-0.55$ relink
  6 link(s) installed
jpiszcz@jpt2:~/mtr-0.55$
As you see, mtr 0.55 is now installed.
jpiszcz@jpt2:~/mtr-0.55$ mtr
mtr: Unable to get raw socket.  (Executable not suid?)
jpiszcz@jpt2:~/mtr-0.55$ which mtr
/vapp/sbin/mtr
jpiszcz@jpt2:~/mtr-0.55$ readlink `which mtr`
../../app/mtr-0.55/sbin/mtr
jpiszcz@jpt2:~/mtr-0.55$
jpiszcz@jpt2:~/mtr-0.55$ mtr --version
mtr 0.55
jpiszcz@jpt2:~/mtr-0.55$
Now assume you want to upgrade to mtr 0.58 as you may have just seen a new release announcement on http://freshmeat.net/

There are two ways of upgrading, the right way(1) and the wrong way(2).

The right way:

The right way is to first move the old application out of /app, relink then continue to configure, make, make install && relink the new version.
jpiszcz@jpt2:~$ mv /app/mtr-0.55/ ./mtr-0.55-old
jpiszcz@jpt2:~$ relink
  6 link(s) removed
jpiszcz@jpt2:~$ cd mtr-0.58 ; conf ; make install ; relink

jpiszcz@jpt2:~$ cd mtr-0.58 ; conf ; make install ; relink

Autoconfigure for /app                       piszcz v1.0
 pkgName: mtr-0.58
  newDir: /app/mtr-0.58
./configure --prefix=/app/mtr-0.58
creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/ginstall -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... found
checking for working autoconf... found
checking for working automake... found
checking for working autoheader... found
checking for working makeinfo... found
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking size of unsigned char... 1
checking size of unsigned short... 2
checking size of unsigned int... 4
checking size of unsigned long... 4
checking for tgetent in -ltermcap... yes
checking for initscr... no
checking for initscr in -lncurses... yes
checking for attron... yes
checking how to run the C preprocessor... gcc -E
checking for ncurses.h... yes
checking for ncurses/curses.h... yes
checking for curses.h... yes
checking for cursesX.h... no
checking for sys/types.h... yes
checking for sys/xti.h... no
checking for floor in -lm... yes
checking for gtk-config... /usr/bin/gtk-config
checking for GTK - version >= 1.0.0... yes
checking for socket... yes
checking for gethostbyname... yes
checking for seteuid... yes
checking for res_mkquery... no
checking for res_mkquery in -lbind... no
checking for res_mkquery in -lresolv... yes
checking for herror... yes
checking for strerror... yes
checking for C flags to get more warnings... -Wall
updating cache ./config.cache
creating ./config.status
creating Makefile
creating img/Makefile
creating config.h

real    0m16.497s
user    0m10.340s
sys     0m3.540s
make  all-recursive
make[1]: Entering directory `/home/jpiszcz/mtr-0.58'
Making all in img
make[2]: Entering directory `/home/jpiszcz/mtr-0.58/img'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/jpiszcz/mtr-0.58/img'
make[2]: Entering directory `/home/jpiszcz/mtr-0.58'
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -Wall -c mtr.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -Wall -c net.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -Wall -c dns.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -Wall -c raw.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -Wall -c split.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -Wall -c display.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -Wall -c report.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -Wall -c getopt.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -Wall -c getopt1.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -Wall -c select.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -Wall -c gtk.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/X11R6/include -Wall -c curses.c
gcc  -g -O2 -I/usr/include/gtk-1.2 -I/usr/include/glib-1.2 -I/usr/lib/glib/include \
-I/usr/X11R6/include -Wall  -o mtr gtk.o curses.o mtr.o net.o dns.o raw.o split.o \
display.o report.o getopt.o getopt1.o select.o  -lresolv -lm -lncurses -ltermcap \
-L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk -rdynamic -lgmodule -lglib -ldl -lXext -lX11 -lm
make[2]: Leaving directory `/home/jpiszcz/mtr-0.58'
make[1]: Leaving directory `/home/jpiszcz/mtr-0.58'

real    0m21.299s
user    0m18.870s
sys     0m1.060s

 if everything looks good: make install

Making install in img
make[1]: Entering directory `/home/jpiszcz/mtr-0.58/img'
make[2]: Entering directory `/home/jpiszcz/mtr-0.58/img'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/jpiszcz/mtr-0.58/img'
make[1]: Leaving directory `/home/jpiszcz/mtr-0.58/img'
make[1]: Entering directory `/home/jpiszcz/mtr-0.58'
make[2]: Entering directory `/home/jpiszcz/mtr-0.58'
/bin/sh ./mkinstalldirs /app/mtr-0.58/sbin
mkdir /app/mtr-0.58/sbin
  /usr/bin/ginstall -c  mtr /app/mtr-0.58/sbin/mtr
chmod u+s /app/mtr-0.58/sbin/mtr
make  install-man8
make[3]: Entering directory `/home/jpiszcz/mtr-0.58'
/bin/sh ./mkinstalldirs /app/mtr-0.58/man/man8
mkdir /app/mtr-0.58/man
mkdir /app/mtr-0.58/man/man8
 /usr/bin/ginstall -c -m 644 ./mtr.8 /app/mtr-0.58/man/man8/mtr.8
make[3]: Leaving directory `/home/jpiszcz/mtr-0.58'
make[2]: Leaving directory `/home/jpiszcz/mtr-0.58'
make[1]: Leaving directory `/home/jpiszcz/mtr-0.58'
  6 link(s) installed
jpiszcz@jpt2:~/mtr-0.58$

jpiszcz@jpt2:~/mtr-0.58$ mtr --version
mtr 0.58
jpiszcz@jpt2:~/mtr-0.58$
You have now successfully upgraded mtr from 0.55 to 0.58!

The wrong way:

jpiszcz@jpt2:~$ ls -ld /app/mtr*
drwxr-xr-x  4 jpiszcz users 96 May 27 01:09 /app/mtr-0.55/
jpiszcz@jpt2:~$ cd mtr-0.58
jpiszcz@jpt2:~/mtr-0.58$ make install > /dev/null
mkdir /app/mtr-0.58
mkdir /app/mtr-0.58/sbin
mkdir /app/mtr-0.58/man
mkdir /app/mtr-0.58/man/man8
jpiszcz@jpt2:~/mtr-0.58$ relink
  6 link(s) installed
jpiszcz@jpt2:~/mtr-0.58$ ls -ld /app/mtr*
drwxr-xr-x  4 jpiszcz users 96 May 27 01:09 /app/mtr-0.55/
drwxr-xr-x  4 jpiszcz users 96 May 27 01:15 /app/mtr-0.58/
jpiszcz@jpt2:~/mtr-0.58$ mtr --version
mtr 0.55
jpiszcz@jpt2:~/mtr-0.58$ # The first installed version is used first.
jpiszcz@jpt2:~/mtr-0.58$ cd
jpiszcz@jpt2:~$ mv /app/mtr-0.55/ ./mtr-0.55-old
jpiszcz@jpt2:~$ relink
  6 link(s) removed
jpiszcz@jpt2:~$ mtr --version
-su: /vapp/sbin/mtr: No such file or directory
jpiszcz@jpt2:~$ # What? This is another known bug.
jpiszcz@jpt2:~$ # relink -i to fix it.
jpiszcz@jpt2:~$ relink -i
APPDIR: /a/app
RELINK>> Delete all files in current directory
RELINK>> DIRECTORY: /a/vapp

bin  doc  etc  include  lib  libexec  local  man  sbin  share

RELINK>> CTRL-C to abort, 'Y' to continue: Y
Removing all vapp symbolic link files
/a/rdb
rdb.dat  rdb.dat.last
Removing rdb files

Executing relink: [/a/app/relink/bin/relink]
  1148 link(s) installed
jpiszcz@jpt2:~$ mtr --version
mtr 0.58
jpiszcz@jpt2:~$
It is now fixed.

Caveats of relink

Every program has bugs, here are the known bugs with relink:

1] When first installing relink, you must relink -i twice.

2] You cannot install the man program, ie: /app/man-version.

3] If you have two versions of the same program, the program installed first will be used, however:

If you have:

   /app/pine-4.59
   /app/pine-4.60
And you had installed 4.60 without moving and relinking the old pine first then you may get this error when trying to run pine: pine: command not found.

This is a bug, to fix this bug: relink -i (re-initialize database). Conclusion

Despite a few known caveats of relink, I find it to be the most useful package management tool that I have ever used. I have tried other tools in the past such as epkg, but they do not compare to relink. The reason for trying other package management tools is because I wanted a tool that was written in C/C++ because I thought Perl was inferior to C/C++ which turned out to be a very big mistake! I have learned that Perl is just as powerful as C or C++ for the programs people write! I had tried all of the package management tools I could get my hands on that were the most popular at the time. Every time I tried a different package management program, I could never compete with the ease of use and flexibility of relink; there was always some aspect of deb,rpm,tgz that was either tying me down or made things non-portable. In my opinion, relink has outperformed all other package management systems out there; therefore I will continue to use it until I find or write something better.


If you would like to see your thoughts or experiences with technology published, please consider writing an article for OSNews.
Table of contents
  1. "Relink, Page 1/5"
  2. "Relink, Page 2/5"
  3. "Relink, Page 3/5"
  4. "Relink, Page 4/5"
  5. "Relink, Page 5/5"
e p (0)    27 Comment(s)

Technology White Papers

See More