home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 10 / mycd10.iso / share / linux / preinst.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1996-12-04  |  3.1 KB  |  157 lines

  1. #!/bin/sh
  2.  
  3. # $XFree86: xc/programs/Xserver/hw/xfree86/etc/preinst.sh,v 3.5 1996/10/19 15:15:53 dawes Exp $
  4. #
  5. # preinst.sh  (for XFree86 3.2)
  6. #
  7. # This script should be run before installing a new version.
  8. #
  9. # It removes parts of an existing installation that can cause problems
  10. # when extracting the new version.  This includes symbolic links to old
  11. # beta versions, shared lib symlinks, and old files.
  12. #
  13.  
  14. OLDBETADIR_1=/usr/XFree86-3.1.2A
  15. OLDBETADIR_2=/usr/XFree86-3.1.2B
  16. RUNDIR=/usr/X11R6
  17. LIBLIST=" \
  18.     libICE.so \
  19.     libPEX5.so \
  20.     libSM.so \
  21.     libX11.so \
  22.     libXIE.so \
  23.     libXaw.so \
  24.     libXext.so \
  25.     libXi.so \
  26.     libXmu.so \
  27.     libXt.so \
  28.     libXtst.so \
  29.     liboldX.so \
  30.     libICE.so.6 \
  31.     libPEX5.so.6 \
  32.     libSM.so.6 \
  33.     libX11.so.6 \
  34.     libXIE.so.6 \
  35.     libXaw.so.6 \
  36.     libXext.so.6 \
  37.     libXi.so.6 \
  38.     libXmu.so.6 \
  39.     libXt.so.6 \
  40.     libXtst.so.6 \
  41.     liboldX.so.6 \
  42.     "
  43.  
  44. OLDFILES=" \
  45.     lib/X11/doc/LbxproxyOnly \
  46.     lib/X11/xkb/keycodes/sgi \
  47.     lib/X11/xkb/symbols/de_nodead \
  48.     "
  49.  
  50. # First, do some checks for Linux/ELF
  51.  
  52. if [ "`uname`" = Linux ]; then
  53.     if file -L /bin/sh | grep ELF >/dev/null 2>&1; then
  54.         echo ""
  55.         echo "You appear to have an ELF system."
  56.         echo "Make sure you are installing the ELF binary dist"
  57.         # Check ldconfig
  58.         LDSO=`/sbin/ldconfig -v -n | awk '{ print $3 }'`
  59.         LDSOMIN=`echo $LDSO | awk -F. '{ print $3 }'`
  60.         LDSOMID=`echo $LDSO | awk -F. '{ print $2 }'`
  61.         LDSOMAJ=`echo $LDSO | awk -F. '{ print $1 }'`
  62.         if [ "$LDSOMAJ" -gt 1 ]; then
  63.             : OK
  64.         else
  65.             if [ "$LDSOMID" -gt 7 ]; then
  66.                 : OK
  67.             else
  68.                 if [ "$LDSOMIN" -ge 14 ]; then
  69.                     : OK
  70.                 else
  71.                     echo ""
  72.                     echo "Before continuing you will need to get a current version of ld.so."
  73.                     echo "Versions newer than 1.7.14 will do."
  74.                     NEEDSOMETHING=YES
  75.                 fi
  76.             fi
  77.         fi
  78.     else
  79.         case "`arch`" in
  80.         i*86)
  81.             echo ""
  82.             echo "You appear to have an a.out system."
  83.             echo "Make sure you are installing the aout binary dist"
  84.             ;;
  85.         esac
  86.     fi
  87. fi
  88.  
  89. if [ X"$NEEDSOMETHING" != X ]; then
  90.     echo ""
  91.     echo "When you've made the required updates, re-run this script"
  92.     echo "before continuing with the installation"
  93.     exit 1
  94. fi
  95.  
  96.  
  97. # If there is no previous installation, there is nothing more to do
  98.  
  99. if [ ! -d $RUNDIR/. ]; then
  100.     echo ""
  101.     echo Done
  102.     exit 0
  103. fi
  104.  
  105. echo ""
  106. echo "You are strongly advised to backup your /usr/X11R6 directory before"
  107. echo "proceeding with this installation.  This installation will overwrite"
  108. echo "existing files."
  109. echo ""
  110. echo "Do you want to continue? (y/n) "
  111. read response
  112. case "$response" in
  113.     [yY]*)
  114.         ;;
  115.     *)
  116.         echo Aborting
  117.         exit 1
  118.         ;;
  119. esac
  120.  
  121. if [ -d $OLDBETADIR_2 ]; then
  122.     cd $OLDBETADIR_2
  123.     for i in `find * -type f -print`; do
  124.         if [ -h $RUNDIR/$i ]; then
  125.             echo Removing link to $OLDBETADIR_2/$i
  126.             rm -f $RUNDIR/$i
  127.         fi
  128.     done
  129. fi
  130. if [ -d $OLDBETADIR_1 ]; then
  131.     cd $OLDBETADIR_1
  132.     for i in `find * -type f -print`; do
  133.         if [ -h $RUNDIR/$i ]; then
  134.             echo Removing link to $OLDBETADIR_1/$i
  135.             rm -f $RUNDIR/$i
  136.         fi
  137.     done
  138. fi
  139. for i in $LIBLIST; do
  140.     if [ -h $RUNDIR/lib/$i ]; then
  141.         echo Removing old library link $RUNDIR/lib/$i
  142.         rm -f $RUNDIR/lib/$i
  143.     fi
  144. done
  145.  
  146. for i in $OLDFILES; do
  147.     if [ -f $RUNDIR/$i ]; then
  148.         echo Removing old file $RUNDIR/$i
  149.         rm -f $RUNDIR/$i
  150.     fi
  151. done
  152.  
  153. echo ""
  154. echo Done
  155.  
  156. exit 0
  157.