home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 45 / cda45.iso / Linux / XFree86-4.0 / Xinstall.sh < prev   
Encoding:
Linux/UNIX/POSIX Shell Script  |  2000-03-09  |  20.3 KB  |  993 lines

  1. #!/bin/sh
  2.  
  3. #
  4. # $XFree86: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh,v 1.7 2000/02/29 18:01:20 dawes Exp $
  5. #
  6. # Copyright ⌐ 2000 by Precision Insight, Inc.
  7. # Portions Copyright ⌐ 1996-2000 by The XFree86 Project, Inc.
  8. #
  9. # This script should be used to install XFree86 4.0.
  10. #
  11. # Parts of this script are based on the old preinst.sh and postinst.sh
  12. # scripts.
  13. #
  14. # Set tabs to 4 spaces to view/edit this file.
  15. #
  16. # Authors:    David Dawes <dawes@xfree86.org>
  17. #
  18.  
  19. VERSION=4.0
  20.  
  21. RUNDIR=/usr/X11R6
  22. ETCDIR=/etc/X11
  23. VARDIR=/var
  24.  
  25. if [ X"$1" = "X-test" -o X"$XINST_TEST" != X ]; then
  26.     RUNDIR=/home1/test/X11R6
  27.     ETCDIR=/home1/test/etcX11
  28.     VARDIR=/home1/test/var
  29.     if [ X"$1" = "X-test" ]; then
  30.         shift
  31.     fi
  32.     echo ""
  33.     echo "Running in test mode"
  34. fi
  35.  
  36. OLDFILES=""
  37.  
  38. OLDDIRS=" \
  39.     $RUNDIR/lib/X11/xkb/compiled \
  40.     "
  41.  
  42. BASEDIST=" \
  43.     Xbin.tgz \
  44.     Xlib.tgz \
  45.     Xman.tgz \
  46.     Xdoc.tgz \
  47.     Xfnts.tgz \
  48.     Xfenc.tgz \
  49.     "
  50.  
  51. ETCDIST="Xetc.tgz"
  52.  
  53. VARDIST="Xvar.tgz"
  54.  
  55. SERVDIST=" \
  56.     Xxserv.tgz \
  57.     Xmod.tgz \
  58.     "
  59. OPTDIST=" \
  60.     Xfsrv.tgz \
  61.     Xnest.tgz \
  62.     Xprog.tgz \
  63.     Xprt.tgz \
  64.     Xvfb.tgz \
  65.     Xf100.tgz \
  66.     Xfcyr.tgz \
  67.     Xflat2.tgz \
  68.     Xfnon.tgz \
  69.     Xfscl.tgz \
  70.     Xhtml.tgz \
  71.     Xjdoc.tgz \
  72.     Xps.tgz \
  73.     "
  74.  
  75. ETCLINKS=" \
  76.     app-defaults \
  77.     fs \
  78.     lbxproxy \
  79.     proxymngr \
  80.     rstart \
  81.     twm \
  82.     xdm \
  83.     xinit \
  84.     xsm \
  85.     xserver \
  86.     "
  87.  
  88. FONTDIRS=" \
  89.     local \
  90.     misc
  91.     "
  92.  
  93. WDIR=`pwd`
  94.  
  95. # Check how to suppress newlines with echo (from perl's Configure)
  96. ((echo "xxx\c"; echo " ") > .echotmp) 2> /dev/null
  97. if [ ! -f .echotmp ]; then
  98.     echo "Can't write to the current directory.  Aborting";
  99.     exit 1
  100. fi
  101. if grep c .echotmp >/dev/null 2>&1; then
  102.     n='-n'
  103.     c=''
  104. else
  105.     n=''
  106.     c='\c'
  107. fi
  108. rm -f .echotmp
  109.  
  110. Echo()
  111. {
  112.     echo $n "$@""$c"
  113. }
  114.  
  115. ContinueNo()
  116. {
  117.     Echo "Do you wish to continue? (y/n) [n] "
  118.     read response
  119.     case "$response" in
  120.     [yY]*)
  121.         echo ""
  122.         ;;
  123.     *)
  124.         echo "Aborting the installation."
  125.         exit 2
  126.         ;;
  127.     esac
  128. }
  129.  
  130. ContinueYes()
  131. {
  132.     Echo "Do you wish to continue? (y/n) [y] "
  133.     read response
  134.     case "$response" in
  135.     [nN]*)
  136.         echo "Aborting the installation."
  137.         exit 2
  138.         ;;
  139.     *)
  140.         echo ""
  141.         ;;
  142.     esac
  143. }
  144.  
  145. Description()
  146. {
  147.     case $1 in
  148.     Xfsrv*)
  149.         echo "font server";;
  150.     Xnest*)
  151.         echo "Nested X server";;
  152.     Xprog*)
  153.         echo "programmer support";;
  154.     Xprt*)
  155.         echo "X print server";;
  156.     Xvfb*)
  157.         echo "Virtual framebuffer X server";;
  158.     Xf100*)
  159.         echo "100dpi fonts";;
  160.     Xfcyr*)
  161.         echo "Cyrillic fonts";;
  162.     Xflat2*)
  163.         echo "Latin-2 fonts";;
  164.     Xfnon*)
  165.         echo "Some large fonts";;
  166.     Xfscl*)
  167.         echo "Scaled fonts (Speedo and Type1)";;
  168.     Xhtml*)
  169.         echo "Docs in HTML";;
  170.     Xjdoc*)
  171.         echo "Docs in Japanese";;
  172.     Xps*)
  173.         echo "Docs in PostScript";;
  174.     *)
  175.         echo "unknown";;
  176.     esac
  177. }
  178.  
  179. ReadLink()
  180. {
  181.     rltmp="`ls -l $1`"
  182.     rl=`expr "$rltmp" : '.*-> \([^     ]*\)'`
  183.     echo $rl
  184. }
  185.  
  186. GetOsInfo()
  187. {
  188.     echo "Checking which OS you're running..."
  189.  
  190.     OsName="`uname`"
  191.     OsVersion="`uname -r`"
  192.     case "$OsName" in
  193.     SunOS) # Assumes SunOS 5.x
  194.         OsArch="`uname -p`"
  195.         ;;
  196.     *)
  197.         OsArch="`uname -m`"
  198.         ;;
  199.     esac
  200.     # Some SVR4.0 versions have a buggy uname that reports the node name
  201.     # for the OS name.  Try to catch that here.  Need to check what is
  202.     # reported for non-buggy versions.
  203.     if [ "$OsName" = "`uname -n`" -a -f /stand/unix ]; then
  204.         OsName=UNIX_SV
  205.     fi
  206.     echo "uname reports '$OsName' version '$OsVersion', architecture '$OsArch'."
  207.  
  208.     # Find the object type, where needed
  209.  
  210.     case "$OsName" in
  211.     Linux|FreeBSD|NetBSD)
  212.         if file -L /bin/sh | grep ELF > /dev/null 2>&1; then
  213.             OsObjFormat=ELF
  214.         else
  215.             OsObjFormat=a.out
  216.         fi
  217.         ;;
  218.     esac
  219.  
  220.     if [ X"$OsObjFormat" != X ]; then
  221.         Echo "Object format is '$OsObjFormat'.  "
  222.         needNL=YES
  223.     fi
  224.  
  225.     # test's flag for symlinks
  226.     #
  227.     # For OSs that don't support symlinks, choose a type that is guaranteed to
  228.     # return false for regular files and directories.
  229.  
  230.     case "$OsName" in
  231.     FreeBSD)
  232.         case "$OsVersion" in
  233.         2.*)
  234.             L="-h"
  235.             ;;
  236.         *)
  237.             L="-L"
  238.         esac
  239.         ;;
  240.     OS-with-no-symlinks)    # Need to set this correctly
  241.         L="-b"
  242.         NoSymlinks=YES
  243.         ;;
  244.     *)
  245.         L="-L"
  246.         ;;
  247.     esac
  248.  
  249.     # Find the libc version, where needed
  250.     case "$OsName" in
  251.     Linux)
  252.         tmp="`ldd /bin/sh | grep libc.so 2> /dev/null`"
  253.         LibcPath=`expr "$tmp" : '[^/]*\(/[^ ]*\)'`
  254.         tmp="`strings $LibcPath | grep -i 'c library'`"
  255.         OsLibcMajor=`expr "$tmp" : '.* \([0-9][0-9]*\)'`
  256.         OsLibcMinor=`expr "$tmp" : '.* [0-9][0-9]*\.\([0-9][0-9]*\)'`
  257.         case "$OsLibcMajor" in
  258.         2)
  259.             # 2 is the glibc version
  260.             OsLibcMajor=6
  261.             ;;
  262.         esac
  263.         ;;
  264.     esac
  265.  
  266.     if [ X"$OsLibcMajor" != X ]; then
  267.         Echo "libc version is '$OsLibcMajor"
  268.         if [ X"$OsLibcMinor" != X ]; then
  269.             Echo ".$OsLibcMinor'."
  270.         else
  271.             Echo "'."
  272.         fi
  273.         needNL=YES
  274.     fi
  275.     if [ X"$needNL" = XYES ]; then
  276.         echo ""
  277.     fi
  278.     echo ""
  279. }
  280.  
  281. DoOsChecks()
  282. {
  283.     # Do some OS-specific checks
  284.  
  285.     case "$OsName" in
  286.     Linux)
  287.         case "$OsObjFormat" in
  288.         ELF)
  289.             # Check ldconfig
  290.             LDSO=`/sbin/ldconfig -v -n | awk '{ print $3 }'`
  291.             LDSOMIN=`echo $LDSO | awk -F[.-] '{ print $3 }'`
  292.             LDSOMID=`echo $LDSO | awk -F[.-] '{ print $2 }'`
  293.             LDSOMAJ=`echo $LDSO | awk -F[.-] '{ print $1 }'`
  294.             if [ "$LDSOMAJ" -gt 1 ]; then
  295.                 : OK
  296.             else
  297.                 if [ "$LDSOMID" -gt 7 ]; then
  298.                     : OK
  299.                 else
  300.                     if [ "$LDSOMIN" -ge 14 ]; then
  301.                         : OK
  302.                     else
  303.                         echo ""
  304.                         echo "Before continuing, you will need to get a"
  305.                         echo "current version of ld.so.  Version 1.7.14 or"
  306.                         echo "newer will do."
  307.                         NEEDSOMETHING=YES
  308.                     fi
  309.                 fi
  310.             fi
  311.             ;;
  312.         esac
  313.         # The /dev/tty0 check is left out.  Presumably nobody has a system where
  314.         # this is missing any more.
  315.         ;;
  316.     esac
  317. }
  318.  
  319. FindDistName()
  320. {
  321.     case "$OsName" in
  322.     DGUX)    # Check this string
  323.         case "$OsArch" in
  324.         i*86)
  325.             DistName="DGUX-ix86"
  326.             ;;
  327.         *)
  328.             Message="DGUX binaries are only available for ix86 platforms"
  329.             ;;
  330.         esac
  331.         ;;
  332.     FreeBSD)
  333.         case "$OsArch" in
  334.         i386)
  335.             case "$OsVersion" in
  336.             2.2*)
  337.                 DistName="FreeBSD-2.2.x"
  338.                 ;;
  339.             3.*)
  340.                 case "$OsObjFormat" in
  341.                 ELF)
  342.                     DistName="FreeBSD-3.x"
  343.                     ;;
  344.                 *)
  345.                     Message="FreeBSD 3.x binaries are only available in ELF format"
  346.                     ;;
  347.                 esac
  348.                 ;;
  349.             4.*)
  350.                 DistName="FreeBSD-4.x"
  351.                 ;;
  352.             *)
  353.                 Message="FreeBSD/i386 binaries are not available for this version"
  354.                 ;;
  355.             esac
  356.             ;;
  357.         alpha)
  358.             case "$OsVersion" in
  359.             3.*)
  360.                 DistName="FreeBSD-alpha-3.x"
  361.                 ;;
  362.             4.*)
  363.                 DistName="FreeBSD-alpha-4.x"
  364.                 ;;
  365.             *)
  366.                 Message="FreeBSD/alpha binaries are not available for this version"
  367.                 ;;
  368.             esac
  369.             ;;
  370.         *)
  371.             Message="FreeBSD binaries are not available for this architecture"
  372.             ;;
  373.         esac
  374.         ;;
  375.     Linux)
  376.         case "$OsArch" in
  377.         i*86)
  378.             case "$OsLibcMajor" in
  379.             5)
  380.                 DistName="Linux-ix86-libc5"
  381.                 ;;
  382.             6)
  383.                 case "$OsLibcMinor" in
  384.                 0)
  385.                     DistName="Linux-ix86-glibc20"
  386.                     ;;
  387.                 1)
  388.                     DistName="Linux-ix86-glibc21"
  389.                     ;;
  390.                 *)
  391.                     Message="No dist available for glibc 2.$OsLibcMinor.  Try Linux-ix86-glibc21"
  392.                     ;;
  393.                 esac
  394.                 ;;
  395.             *)
  396.                 case "$OsObjFormat" in
  397.                 a.out)
  398.                     Message="Linux a.out is no longer supported"
  399.                     ;;
  400.                 *)
  401.                     Message="No Linux/ix86 binaries for this libc version"
  402.                     ;;
  403.                 esac
  404.                 ;;
  405.             esac
  406.             ;;
  407.         alpha)
  408.             case "$OsLibcMajor.$OsLibcMinor" in
  409.             6.1)
  410.                 DistName="Linux-alpha-glibc21"
  411.                 ;;
  412.             6.*)
  413.                 Message="No Linux/alpha binaries for glibc 2.$OsLibcMinor.  Try Linux-alpha-glibc21"
  414.                 ;;
  415.             *)
  416.                 Message="No Linux/alpha binaries for this libc version"
  417.                 ;;
  418.             esac
  419.             ;;
  420.         *)
  421.             Message="No Linux binaries available for this architecture"
  422.             ;;
  423.         esac
  424.         ;;
  425.     LynxOS)    # Check this
  426.         DistName="LynxOS"
  427.         ;;
  428.     NetBSD)
  429.         case "$OsArch" in
  430.         i386)
  431.             case "$OsVersion" in
  432.             1.[3-9]*)    # Check this
  433.                 case "$OsObjFormat" in
  434.                 a.out)
  435.                     DistName="NetBSD-1.4.1"
  436.                     ;;
  437.                 *)
  438.                     DistName="NetBSD-current-ELF"
  439.                     ;;
  440.                 esac
  441.                 ;;
  442.             *)
  443.                 Message="No NetBSD/i386 binaries available for this version"
  444.                 ;;
  445.             esac
  446.             ;;
  447.         *)
  448.             Message="No NetBSD binaries available for this architecture"
  449.             ;;
  450.         esac
  451.         ;;
  452.     OpenBSD)
  453.         case "$OsArch" in
  454.         i386)
  455.             case "$OsVersion" in
  456.             2.[6-9]*)    # Check this
  457.                 DistName="OpenBSD-2.6"
  458.                 ;;
  459.             *)
  460.                 Message="No OpenBSD/i386 binaries available for this version"
  461.                 ;;
  462.             esac
  463.             ;;
  464.         *)
  465.             Message="No OpenBSD binaries available for this architecture"
  466.             ;;
  467.         esac
  468.         ;;
  469.     SunOS)
  470.         case "$OsArch" in
  471.         i386)
  472.             case "$OsVersion" in
  473.             5.[67]*)
  474.                 DistName="Solaris"
  475.                 ;;
  476.             5.8*)
  477.                 DistName="Solaris-8"
  478.                 ;;
  479.             *)
  480.                 Message="No Solaris/x86 binaries available for this version"
  481.                 ;;
  482.             esac
  483.             ;;
  484.         *)
  485.             Message="No SunOS/Solaris binaries available for this architecture"
  486.             ;;
  487.         esac
  488.         ;;
  489.     UNIX_SV)
  490.         case "$OsArch" in
  491.         i386)
  492.             case "$OsVersion" in
  493.             4.0*)
  494.                 DistName="SVR4.0"
  495.                 ;;
  496.             *)
  497.                 # More detailed version check??
  498.                 DistName="UnixWare"
  499.                 ;;
  500.             esac
  501.             ;;
  502.         *)
  503.             Message="No SYSV binaries available for this architecture"
  504.             ;;
  505.         esac
  506.         ;;
  507.     *)
  508.         Message="No binaries available for this OS"
  509.         ;;
  510.     esac
  511.  
  512.     if [ X"$DistName" != X ]; then
  513.         echo "Binary distribution name is '$DistName'"
  514.         echo ""
  515.     else
  516.         if [ X"$Message" = X ]; then
  517.             echo "Can't find which binary distribution you should use."
  518.             echo "Please send the output of this script to XFree86@XFree86.org"
  519.             echo ""
  520.         else
  521.             echo "$Message"
  522.             echo ""
  523.         fi
  524.     fi
  525. }
  526.  
  527. if [ X"$1" = "X-check" ]; then
  528.     GetOsInfo
  529.     FindDistName
  530.     exit 0
  531. fi
  532.  
  533. echo ""
  534. echo "        Welcome to the XFree86 $VERSION installer"
  535. echo ""
  536. echo "You are strongly advised to backup your existing XFree86 installation"
  537. echo "before proceeding.  This includes the /usr/X11R6 and /etc/X11"
  538. echo "directories.  The installation process will overwrite existing files"
  539. echo "in those directories, and this may include some configuration files"
  540. echo "that may have been customised."
  541. echo ""
  542. ContinueNo
  543.  
  544. # Should check if uid is zero
  545.  
  546. # Check if $DISPLAY is set, and warn
  547.  
  548. if [ X"$DISPLAY" != X ]; then
  549.     echo "\$DISPLAY is set, which may indicate that you are running this"
  550.     echo "installation from an X session.  It is recommended that X not be"
  551.     echo "running while doing the installation."
  552.     echo ""
  553.     ContinueNo
  554. fi
  555.  
  556. # First, do some preliminary checks
  557.  
  558. GetOsInfo
  559.  
  560. # Make OS-specific adjustments to the distribution file lists
  561.  
  562. case "$OsName" in
  563. Interactive)    # Need the correct name for this
  564.     VARDIST=""
  565.     EXTRADIST="Xbin1.tgz"
  566.     EXTRAOPTDIST="Xxdm.tgz"
  567.     ;;
  568. LynxOS)
  569.     VARDIST=""
  570.     ;;
  571. esac
  572.  
  573. REQUIREDFILES=" \
  574.     extract \
  575.     $BASEDIST \
  576.     $ETCDIST \
  577.     $VARDIST \
  578.     $SERVDIST \
  579.     $EXTRADIST \
  580.     "
  581.  
  582. echo "Checking for required files ..."
  583. Needed=""
  584.  
  585. # Check for extract and extract.exe, and check that they are usable.
  586. #
  587. # This test may not be fool-proof.  A FreeBSD/ELF binary downloaded in
  588. # ASCII mode passed it :-(.
  589. #
  590. if [ -f extract ]; then
  591.     ExtractExists=YES
  592.     chmod +x extract
  593.     if ./extract --version | head -1 | \
  594.       fgrep "extract (XFree86 version" > /dev/null 2>&1; then
  595.         ExtractOK=YES
  596.     else
  597.         echo "extract doesn't work properly, renaming it to 'extract.bad'"
  598.         rm -f extract.bad
  599.         mv extract extract.bad
  600.     fi
  601. fi
  602. if [ X"$ExtractOK" != XYES ]; then
  603.     if [ -f extract.exe ]; then
  604.         ExtractExeExists=YES
  605.         rm -f extract
  606.         ln extract.exe extract
  607.         chmod +x extract
  608.         if ./extract --version | head -1 | \
  609.           fgrep "extract (XFree86 version" > /dev/null 2>&1; then
  610.             ExtractOK=YES
  611.         else
  612.             echo "extract.exe doesn't work properly, renaming it to"
  613.             echo "'extract.exe.bad'"
  614.             rm -f extract.exe.bad
  615.             mv extract.exe extract.exe.bad
  616.             rm -f extract
  617.         fi
  618.     fi
  619. fi
  620. if [ X"$ExtractOK" != XYES ]; then
  621.     echo ""
  622.     if [ X"$ExtractExists" = XYES -a X"$ExtractExeExists" = XYES ]; then
  623.         echo "The versions of 'extract' and 'extract.exe' you have do not run'"
  624.         echo "correctly.  Make sure that you have downloaded the correct"
  625.         echo "binaries for your system.  To find out which is correct,"
  626.         echo "run 'sh $0 -check'."
  627.     fi
  628.     if [ X"$ExtractExists" = XYES -a X"$ExtractExeExists" != XYES ]; then
  629.         echo "The version of 'extract' you have does not run correctly."
  630.         echo "This is most commonly due to problems downloading this file"
  631.         echo "with some web browsers.  You may get better results if you"
  632.         echo "download the version called 'extract.exe' and try again."
  633.     fi
  634.     if [ X"$ExtractExists" != XYES -a X"$ExtractExeExists" = XYES ]; then
  635.         echo "The version of 'extract.exe' you have does not run correctly."
  636.         echo "Make sure that you have downloaded the correct binaries for your"
  637.         echo "system.  To find out which is correct, run 'sh $0 -check'."
  638.     fi
  639.     if [ X"$ExtractExists" != XYES -a X"$ExtractExeExists" != XYES ]; then
  640.         echo "You need to download the 'extract' (or 'extract.exe') utility"
  641.         echo "and put it in this directory."
  642.     fi
  643.     echo ""
  644.     echo "When you have corrected the problem, please re-run 'sh $0'"
  645.     echo "to proceed with the installation."
  646.     echo ""
  647.     exit 1
  648. fi
  649.  
  650. for i in $REQUIREDFILES; do
  651.     if [ ! -f $i ]; then
  652.         Needed="$Needed $i"
  653.     fi
  654. done
  655. if [ X"$Needed" != X ]; then
  656.     echo ""
  657.     echo "The files:"
  658.     echo ""
  659.     echo "$Needed"
  660.     echo ""
  661.     echo "must be present in the current directory to proceed with the"
  662.     echo "installation.  You should be able to find it at the same place"
  663.     echo "you picked up the rest of the XFree86 binary distribution."
  664.     echo "Please re-run 'sh $0' to proceed with the installation when"
  665.     echo "you have them."
  666.     echo ""
  667.     exit 1
  668. fi
  669.  
  670. DoOsChecks
  671.  
  672. if [ X"$NEEDSOMETHING" != X ]; then
  673.     echo ""
  674.     echo "Please re-run 'sh $0' to proceed with the installation after you"
  675.     echo "have made the required updates."
  676.     echo ""
  677.     exit 1
  678. fi
  679.  
  680. # Link extract to gnu-tar so it can also be used as a regular tar
  681. rm -f gnu-tar
  682. ln extract gnu-tar
  683.  
  684. EXTRACT=$WDIR/extract
  685. TAR=$WDIR/gnu-tar
  686.  
  687. # Create $RUNDIR and $ETCDIR if they don't already exist
  688.  
  689. if [ ! -d $RUNDIR ]; then
  690.     NewRunDir=YES
  691.     echo "Creating $RUNDIR"
  692.     mkdir $RUNDIR
  693. fi
  694. if [ ! -d $RUNDIR/lib ]; then
  695.     echo "Creating $RUNDIR/lib"
  696.     mkdir $RUNDIR/lib
  697. fi
  698. if [ ! -d $RUNDIR/lib/X11 ]; then
  699.     echo "Creating $RUNDIR/lib/X11"
  700.     mkdir $RUNDIR/lib/X11
  701. fi
  702. if [ ! -d $ETCDIR ]; then
  703.     NewEtcDir=YES
  704.     echo "Creating $ETCDIR"
  705.     mkdir $ETCDIR
  706. fi
  707.  
  708. if [ -d $RUNDIR -a -d $RUNDIR/bin -a -d $RUNDIR/lib ]; then
  709.     echo ""
  710.     echo "You appear to have an existing installation of X.  Continuing will"
  711.     echo "overwrite it.  You will, however, have the option of being prompted"
  712.     echo "before most configuration files are overwritten."
  713.     ContinueYes
  714. fi
  715.  
  716. if [ X"$OLDFILES" != X ]; then
  717.     echo ""
  718.     echo "Removing some old files that are no longer required..."
  719.     for i in $OLDFILES; do
  720.         if [ -f $i ]; then
  721.             echo "    removing old file $i"
  722.             rm -f $i
  723.         fi
  724.     done
  725.     echo ""
  726. fi
  727.  
  728. if [ X"$OLDDIRS" != X ]; then
  729.     echo ""
  730.     echo "Removing some old directories that are no longer required..."
  731.     for i in $OLDDIRS; do
  732.         if [ -d $i ]; then
  733.             echo "    removing old directory $i"
  734.             rm -fr $i
  735.         fi
  736.     done
  737.     echo ""
  738. fi
  739.  
  740. # Check for config file directories that may need to be moved.
  741.  
  742. EtcToMove=
  743. if [ X"$NoSymLinks" != XYES ]; then
  744.     for i in $ETCLINKS; do
  745.         if [ -d $RUNDIR/lib/X11/$i -a ! $L $RUNDIR/lib/X11/$i ]; then
  746.             EtcToMove="$EtcToMove $i"
  747.         fi
  748.     done
  749. fi
  750.  
  751. if [ X"$EtcToMove" != X ]; then
  752.     echo "XFree86 now installs most customisable configuration files under"
  753.     echo "$ETCDIR instead of under $RUNDIR/lib/X11, and has symbolic links"
  754.     echo "under $RUNDIR/lib/X11 that point to $ETCDIR.  You currently have"
  755.     echo "files under the following subdirectories of $RUNDIR/lib/X11:"
  756.     echo ""
  757.     echo "$EtcToMove"
  758.     echo ""
  759.     echo "Do you want to move them to $ETCDIR and create the necessary"
  760.     Echo "links? (y/n) [y] "
  761.     read response
  762.     case "$response" in
  763.     [nN]*)
  764.         echo ""
  765.         echo "Note: this means that your run-time config files will remain"
  766.         echo "in the old $RUNDIR/lib/X11 location."
  767.         NoSymLinks=YES;
  768.         ;;
  769.     esac
  770.     echo ""
  771.     if [ X"NoSymlinks" != XYES ]; then
  772.         for i in $EtcToMove; do
  773.             echo "Moving $RUNDIR/lib/X11/$i to $ETCDIR/$i ..."
  774.             if [ ! -d $ETCDIR/$i ]; then
  775.                 mkdir $ETCDIR/$i
  776.             fi
  777.             $TAR -C $RUNDIR/lib/X11/$i -c -f - . | \
  778.                 $TAR -C $ETCDIR/$i -v -x -p -U -f - && \
  779.                 rm -fr $RUNDIR/lib/X11/$i && \
  780.                 ln -s $ETCDIR/$i $RUNDIR/lib/X11/$i
  781.         done
  782.     fi
  783. fi
  784.  
  785. # Maybe allow a backup of the config files to be made?
  786.  
  787. # Extract Xetc.tgz into a temporary location, and prompt for moving the
  788. # files.
  789.  
  790. echo "Extracting $ETCDIST into a temporary location ..."
  791. rm -fr .etctmp
  792. mkdir .etctmp
  793. (cd .etctmp; $EXTRACT $WDIR/$ETCDIST)
  794. for i in $ETCLINKS; do
  795.     DoCopy=YES
  796.     if [ -d $RUNDIR/lib/X11/$i ]; then
  797.         Echo "Do you want to overwrite the $i config files? (y/n) [n] "
  798.         read response
  799.         case "$response" in
  800.         [yY]*)
  801.             : OK
  802.             ;;
  803.         *)
  804.             DoCopy=NO
  805.             ;;
  806.         esac
  807.     fi
  808.     if [ $DoCopy = YES ]; then
  809.         echo "Installing the $i config files ..."
  810.         if [ X"$NoSymLinks" != XYES ]; then
  811.             if [ ! -d $ETCDIR/$i ]; then
  812.                 mkdir $ETCDIR/$i
  813.             fi
  814.             if [ ! -d $RUNDIR/lib/X11/$i ]; then
  815.                 ln -s $ETCDIR/$i $RUNDIR/lib/X11/$i
  816.             fi
  817.         else
  818.             if [ ! -d $RUNDIR/lib/X11/$i ]; then
  819.                 mkdir $RUNDIR/lib/X11/$i
  820.             fi
  821.         fi
  822.         $TAR -C .etctmp/$i -c -f - . | \
  823.             $TAR -C $RUNDIR/lib/X11/$i -v -x -p -U -f -
  824.     fi
  825. done
  826. rm -fr .etctmp
  827.  
  828. echo "Installing the mandatory parts of the binary distribution"
  829. echo ""
  830. for i in $BASEDIST $SERVDIST; do
  831.     (cd $RUNDIR; $EXTRACT $WDIR/$i)
  832. done
  833. if [ X"$VARDIST" != X ]; then
  834.     (cd $VARDIR; $EXTRACT $WDIR/$VARDIST)
  835. fi
  836.  
  837. echo "Checking for optional components to install ..."
  838. for i in $OPTDIST $EXTRAOPTDIST; do
  839.     if [ -f $i ]; then
  840.         Echo "Do you want to install $i (`Description $i`)? (y/n) [y] "
  841.         read response
  842.         case "$response" in
  843.         [nN]*)
  844.             : skip this one
  845.             ;;
  846.         *)
  847.             (cd $RUNDIR; $EXTRACT $WDIR/$i)
  848.             ;;
  849.         esac
  850.     fi
  851. done
  852.  
  853. # Need to run ldconfig on some OSs
  854. case "$OsName" in
  855. FreeBSD|NetBSD|OpenBSD)
  856.     echo ""
  857.     echo "Running ldconfig"
  858.     /sbin/ldconfig -m $RUNDIR/lib
  859.     ;;
  860. Linux)
  861.     echo ""
  862.     echo "Running ldconfig"
  863.     /sbin/ldconfig $RUNDIR/lib
  864.     ;;
  865. esac
  866.  
  867. # Run mkfontdir in the local and misc directories to make sure that
  868. # the fonts.dir files are up to date after the installation.
  869. echo ""
  870. for i in $FONTDIRS $EXTRAFONTDIRS; do
  871.     if [ -d $RUNDIR/lib/X11/fonts/$i ]; then
  872.         Echo "Updating the fonts.dir file in $RUNDIR/lib/X11/fonts/$i..."
  873.         $RUNDIR/bin/mkfontdir $RUNDIR/lib/X11/fonts/$i
  874.         echo ""
  875.     fi
  876. done
  877.         
  878. # Check if the system has a termcap file
  879. TERMCAP1DIR=/usr/share
  880. TERMCAP2=/etc/termcap
  881. if [ -d $TERMCAP1DIR ]; then
  882.     TERMCAP1=`find $TERMCAP1DIR -type f -name termcap -print 2> /dev/null`
  883.     if [ x"$TERMCAP1" != x ]; then
  884.         TERMCAPFILE="$TERMCAP1"
  885.     fi
  886. fi
  887. if [ x"$TERMCAPFILE" = x ]; then
  888.     if [ -f $TERMCAP2 ]; then
  889.         TERMCAPFILE="$TERMCAP2"
  890.     fi
  891. fi
  892.  
  893. # Override this for some OSs
  894.  
  895. case "$OsName" in
  896. OpenBSD)
  897.     TERMCAPFILE=""
  898.     ;;
  899. esac
  900.  
  901. if [ X"$TERMCAPFILE" != X ]; then
  902.     echo ""
  903.     echo "You appear to have a termcap file: $TERMCAPFILE"
  904.     echo "This should be edited manually to replace the xterm entries"
  905.     echo "with those in $RUNDIR/lib/X11/etc/xterm.termcap"
  906.     echo ""
  907.     echo "Note: the new xterm entries are required to take full advantage"
  908.     echo "of new features, but they may cause problems when used with"
  909.     echo "older versions of xterm.  A terminal type 'xterm-r6' is included"
  910.     echo "for compatibility with the standard X11R6 version of xterm."
  911. fi
  912.  
  913. # Check for terminfo, and update the xterm entry
  914. TINFODIR=/usr/lib/terminfo
  915. # Does this list need to be updated?
  916. OLDTINFO=" \
  917.     x/xterm \
  918.     x/xterms \
  919.     x/xterm-24 \
  920.     x/xterm-vi \
  921.     x/xterm-65 \
  922.     x/xterm-bold \
  923.     x/xtermm \
  924.     x/xterm-boldso \
  925.     x/xterm-ic \
  926.     x/xterm-r6 \
  927.     x/xterm-old \
  928.     x/xterm-r5 \
  929.     v/vs100"
  930.     
  931. if [ -d $TINFODIR ]; then
  932.     echo ""
  933.     echo "You appear to have a terminfo directory: $TINFODIR"
  934.     echo "New xterm terminfo entries can be installed now."
  935.     echo ""
  936.     echo "Note: the new xterm entries are required to take full advantage"
  937.     echo "of new features, but they may cause problems when used with"
  938.     echo "older versions of xterm.  A terminal type 'xterm-r6' is included"
  939.     echo "for compatibility with the standard X11R6 version of xterm."
  940.     echo ""
  941.     echo "Do you wish to have the new xterm terminfo entries installed"
  942.     Echo "now (y/n)? [n] "
  943.     read response
  944.     case "$response" in
  945.     [yY]*)
  946.         echo ""
  947.         for t in $OLDTINFO; do
  948.             if [ -f $TINFODIR/$t ]; then
  949.                 echo "Moving old terminfo file $TINFODIR/$t to $TINFODIR/$t.bak"
  950.                 rm -f $TINFODIR/$t.bak
  951.                 mv -f $TINFODIR/$t $TINFODIR/$t.bak
  952.             fi
  953.         done
  954.         echo ""
  955.         echo "Installing new terminfo entries for xterm."
  956.         echo ""
  957.         echo "On some systems you may get warnings from tic about 'meml'"
  958.         echo "and 'memu'.  These warnings can safely be ignored."
  959.         echo ""
  960.         tic $RUNDIR/lib/X11/etc/xterm.terminfo
  961.         ;;
  962.     *)
  963.         echo ""
  964.         echo "Not installing new terminfo entries for xterm."
  965.         echo "They can be installed later by running:"
  966.         echo ""
  967.         echo "  tic $RUNDIR/lib/X11/etc/xterm.terminfo"
  968.         ;;
  969.     esac
  970. fi
  971.  
  972. if [ -f $RUNDIR/bin/rstartd ]; then
  973.     echo ""
  974.     echo "If you are going to use rstart and $RUNDIR/bin isn't in the"
  975.     echo "default path for commands run remotely via rsh, you will need"
  976.     echo "a link to rstartd installed in /usr/bin."
  977.     echo ""
  978.     Echo "Do you wish to have this link installed (y/n)? [n] "
  979.     read response
  980.     case "$response" in
  981.     [yY]*)
  982.         echo "Creating link from $RUNDIR/bin/rstartd to /usr/bin/rstartd"
  983.         rm -f /usr/bin/rstartd
  984.         ln -s $RUNDIR/bin/rstartd /usr/bin/rstartd
  985.         ;;
  986.     esac
  987. fi
  988.  
  989. echo ""
  990. echo "Installation complete."
  991.  
  992. exit 0
  993.