#!/bin/sh
SNAPSHOT=n
if [ $SNAPSHOT = y ]; then
FULLPREFIX=XXX
VERSION=4.3.99.903
PATCHLEVEL=0
FULLVERSION=$VERSION
else
FULLPREFIX=4.4
PATCHLEVEL=0
VERSION=$FULLPREFIX.$PATCHLEVEL
FULLVERSION=$FULLPREFIX.0
fi
SCRIPTVERSION=$VERSION
BINDISTFULLPREFIX=
BINDISTPATCHLEVEL=
BINDISTVERSION=
BINDISTFULLVERSION=
ROOTDIR=
TESTROOT=/home1/test
if [ X"$1" = "X-test" -o X"$XINST_TEST" != X ]; then
if [ X"$1" = "X-test" ]; then
shift
case "$1" in
/*)
TESTROOT="$1"
shift
;;
esac
else
case "$XINST_TEST" in
/*)
TESTROOT="$XINST_TEST"
;;
esac
fi
ROOTDIR=$TESTROOT
echo ""
echo "Running in test mode, with root set to $TESTROOT"
sleep 2
echo ""
if [ ! -d $TESTROOT ]; then
echo "$TESTROOT doesn't exist (for test mode)"
exit 1
fi
for i in usr etc var; do
if [ ! -d $TESTROOT/$i ]; then
echo "$TESTROOT/$i doesn't exist, creating it"
mkdir $TESTROOT/$i
fi
done
fi
RUNDIR=$ROOTDIR/usr/X11R6
ETCDIR=$ROOTDIR/etc
VARDIR=$ROOTDIR/var
OLDFILES=" \
$RUNDIR/include/freetype2/ft2build.h \
"
OLDDIRS=" \
$RUNDIR/lib/X11/xkb/compiled \
$RUNDIR/lib/X11/xkb/geometry/hp \
"
OLDMODULES=" \
xie.so \
pex5.so \
glx.so \
"
BASEDIST=" \
Xbin.tgz \
Xlib.tgz \
Xman.tgz \
Xdoc.tgz \
Xfnts.tgz \
Xfenc.tgz \
"
UPDDIST=" \
Xupd.tgz \
"
UPDATEDIST=" \
Xupdate.tgz \
Xdrivers.tgz \
Xdocupd.tgz \
"
ETCDIST="Xetc.tgz"
VARDIST=""
SERVDIST=" \
Xxserv.tgz \
Xmod.tgz \
"
OPTDIST=" \
Xfsrv.tgz \
Xnest.tgz \
Xprog.tgz \
Xprt.tgz \
Xvfb.tgz \
Xf100.tgz \
Xfcyr.tgz \
Xfscl.tgz \
Xhtml.tgz \
Xjdoc.tgz \
Xps.tgz \
Xpdf.tgz \
"
ETCDLINKS=" \
app-defaults \
fs \
lbxproxy \
proxymngr \
rstart \
twm \
xdm \
xinit \
xsm \
xserver \
"
ETCFLINKS=" \
XftConfig \
"
ETCFONTFILES=" \
fonts.conf \
fonts.dtd \
"
XKBDIR="$ETCDIR/X11/xkb"
XKBDBDIR=
FONTDIRS=" \
local \
misc
"
XSERVERCMD="$RUNDIR/bin/XFree86"
VERSIONFILE=".XFree86_Version"
WDIR="`pwd`"
DOUPDATE=
DOBASE=
OPTS=""
((echo "xxx\c"; echo " ") > .echotmp) 2> /dev/null
if [ ! -f .echotmp ]; then
echo "Can't write to the current directory. Aborting";
exit 1
fi
if grep c .echotmp >/dev/null 2>&1; then
n='-n'
c=''
else
n=''
c='\c'
fi
rm -f .echotmp
Echo()
{
echo $n "$@""$c"
}
ContinueNo()
{
Echo "Do you wish to continue? (y/n) [n] "
read response
case "$response" in
[yY]*)
echo ""
;;
*)
echo "Aborting the installation."
exit 2
;;
esac
}
ContinueYes()
{
Echo "Do you wish to continue? (y/n) [y] "
read response
case "$response" in
[nN]*)
echo "Aborting the installation."
exit 2
;;
*)
echo ""
;;
esac
}
Description()
{
case $1 in
Xfsrv*)
echo "font server";;
Xnest*)
echo "Nested X server";;
Xprog*)
echo "programmer support";;
Xprt*)
echo "X print server";;
Xvfb*)
echo "Virtual framebuffer X server";;
Xdrm*)
echo "DRM kernel module source";;
Xf100*)
echo "100dpi fonts";;
Xfcyr*)
echo "Cyrillic fonts";;
Xfscl*)
echo "Scaled fonts (Speedo, Type1 and TTF)";;
Xhtml*)
echo "Docs in HTML";;
Xjdoc*)
echo "Docs in Japanese";;
Xps*)
echo "Docs in PostScript";;
Xpdf*)
echo "Docs in PDF";;
Xaout*)
echo "a.out compatibility libraries";;
Xquartz*)
echo "Mac OS X Quartz X server and extensions";;
Xupd.tgz)
echo "Post-release updates";;
*)
echo "unknown";;
esac
}
CheckUtil()
{
if [ X"$1" = X-t ]; then
shift
testonly=1
else
testonly=""
fi
if which /bin/sh > /dev/null 2>&1; then
if which $1 > /dev/null 2>&1; then
return 0
else
if [ "$testonly" ]; then
return 1
else
echo "Cannot find the \"$1\" command."
echo "Aborting"
exit 1
fi
fi
else
return 0
fi
}
ReadLink()
{
rltmp="`ls -l $1`"
rl=`expr "$rltmp" : '.*-> \([^ ]*\)'`
echo $rl
}
GetOsInfo()
{
CheckUtil uname
echo "Checking which OS you're running..."
OsName="`uname`"
OsVersion="`uname -r`"
case "$OsName" in
SunOS) OsArch="`uname -p`"
;;
*)
OsArch="`uname -m`"
;;
esac
if [ "$OsName" = "`uname -n`" -a -f /stand/unix ]; then
OsName=UNIX_SV
fi
echo "uname reports '$OsName' version '$OsVersion', architecture '$OsArch'."
case "$OsName" in
FreeBSD|NetBSD|OpenBSD)
CheckUtil file
if file -L /bin/sh | grep ELF > /dev/null 2>&1; then
OsObjFormat=ELF
else
OsObjFormat=a.out
fi
;;
esac
if [ X"$OsObjFormat" != X ]; then
Echo "Object format is '$OsObjFormat'. "
needNL=YES
fi
case "$OsName" in
FreeBSD)
case "$OsVersion" in
2.*)
L="-h"
;;
*)
L="-L"
;;
esac
;;
SunOS)
L="-h" ;;
OS-with-no-symlinks) L="-b"
NoSymlinks=YES
;;
*)
L="-L"
;;
esac
if [ X"$1" = X-l ]; then
case "$OsName" in
Linux)
tmp="`ldd /bin/sh | grep libc.so 2> /dev/null`"
LibcPath=`expr "$tmp" : '[^/]*\(/[^ ]*\)'`
if CheckUtil -t strings; then
tmp="`strings $LibcPath | grep -i 'c library'`"
else
if [ $L $LibcPath ]; then
tmp=`ReadLink $LibcPath`
tmp="`echo $tmp | sed 's/-/ /'`"
else
tmp=""
fi
fi
OsLibcMajor=`expr "$tmp" : '.* \([0-9][0-9]*\)'`
OsLibcMinor=`expr "$tmp" : '.* [0-9][0-9]*\.\([0-9][0-9]*\)'`
OsLibcTeeny=`expr "$tmp" : '.* [0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)'`
case "$OsLibcMajor" in
2)
OsLibcMajor=6
;;
"")
echo "Cannot find the glibc version."
echo "Aborting."
exit 1
esac
;;
esac
if [ X"$OsLibcMajor" != X ]; then
Echo "libc version is '$OsLibcMajor"
if [ X"$OsLibcMinor" != X ]; then
Echo ".$OsLibcMinor"
if [ X"$OsLibcTeeny" != X ]; then
Echo ".$OsLibcTeeny"
if [ $OsLibcTeeny -gt 80 ]; then
OsLibcMinor=`expr $OsLibcMinor + 1`
fi
fi
Echo "'"
Echo " ($OsLibcMajor.$OsLibcMinor)"
else
Echo "'"
fi
echo "."
fi
fi
echo ""
}
DoOsChecks()
{
case "$OsName" in
Linux)
LDSO=`/sbin/ldconfig -v -n | awk '{ print $3 }'`
if [ X"$LDSO" = X ]; then
LDSO=`/sbin/ldconfig -V | awk 'NR == 1 { print $4 }'`
fi
LDSOMIN=`echo $LDSO | awk -F[.-] '{ print $3 }'`
LDSOMID=`echo $LDSO | awk -F[.-] '{ print $2 }'`
LDSOMAJ=`echo $LDSO | awk -F[.-] '{ print $1 }'`
if [ "$LDSOMAJ" -gt 1 ]; then
: OK
else
if [ "$LDSOMID" -gt 7 ]; then
: OK
else
if [ "$LDSOMIN" -ge 14 ]; then
: OK
else
echo ""
echo "Before continuing, you will need to get a"
echo "current version of ld.so. Version 1.7.14 or"
echo "newer will do."
NEEDSOMETHING=YES
fi
fi
fi
;;
esac
}
FindDistName()
{
case "$OsName" in
CYGWIN*)
case "$OsArch" in
i*86)
DistName="Cygwin"
;;
*)
Message="Cygwin binaries are only available for ix86 platforms"
;;
esac
;;
Darwin)
case "$OsArch" in
Power*)
case "$OsVersion" in
1.[2-3]*)
DistName="Darwin-ppc-1.x"
;;
1.4* | 5.*)
DistName="Darwin-ppc-5.x"
;;
6.[0-2]*)
if [ -d /System/Library/Frameworks/ApplicationServices.framework ]; then
Message="No binaries available for Mac OS X 10.2.0 - 10.2.2"
else
DistName="Darwin-ppc-6.x"
fi
;;
6.[3-9]*)
DistName="Darwin-ppc-6.x"
;;
7.*)
DistName="Darwin-ppc-7.x"
;;
[8-9].*)
Message="No Darwin/ppc binaries available for this OS version. Try Darwin-ppc-7.x"
;;
*)
Message="No Darwin/ppc binaries available for this OS version"
;;
esac
;;
x86*)
case "$OsVersion" in
1.4* | 5.*)
DistName="Darwin-ix86-5.x"
;;
6.* | 7.*)
DistName="Darwin-ix86-7.x"
;;
[8-9].*)
Message="No Darwin/ix86 binaries available for this OS version. Try Darwin-ix86-7.x"
;;
*)
Message="No Darwin/ix86 binaries available for this OS version"
;;
esac
;;
*)
Message="Darwin binaries are not available for this architecture"
;;
esac
;;
DGUX) case "$OsArch" in
i*86)
DistName="DGUX-ix86"
;;
*)
Message="DGUX binaries are only available for ix86 platforms"
;;
esac
;;
FreeBSD)
case "$OsArch" in
i386)
case "$OsVersion" in
2.2*)
DistName="FreeBSD-2.2.x"
;;
3.*)
case "$OsObjFormat" in
ELF)
DistName="FreeBSD-3.x"
;;
*)
Message="FreeBSD 3.x binaries are only available in ELF format"
;;
esac
;;
4.*)
DistName="FreeBSD-4.x"
;;
5.*)
DistName="FreeBSD-5.x"
;;
*)
Message="FreeBSD/i386 binaries are not available for this version"
;;
esac
;;
alpha)
case "$OsVersion" in
3.*)
DistName="FreeBSD-alpha-3.x"
;;
4.*)
DistName="FreeBSD-alpha-4.x"
;;
5.*)
DistName="FreeBSD-alpha-5.x"
;;
*)
Message="FreeBSD/alpha binaries are not available for this version"
;;
esac
;;
*)
Message="FreeBSD binaries are not available for this architecture"
;;
esac
;;
Linux)
case "$OsArch" in
i*86)
case "$OsLibcMajor" in
5)
DistName="Linux-ix86-libc5"
;;
6)
case "$OsLibcMinor" in
0)
DistName="Linux-ix86-glibc20"
;;
1)
DistName="Linux-ix86-glibc21"
;;
2)
DistName="Linux-ix86-glibc22"
;;
3)
DistName="Linux-ix86-glibc23"
;;
*)
Message="No dist available for glibc 2.$OsLibcMinor. Try Linux-ix86-glibc23"
;;
esac
;;
*)
Message="No Linux/ix86 binaries for this libc version"
;;
esac
;;
ppc)
case "$OsLibcMajor.$OsLibcMinor" in
6.1)
DistName="Linux-ppc-glibc21"
;;
6.*)
Message="No Linux/ppc binaries for glibc 2.$OsLibcMinor. Try Linux-ppc-glibc21"
;;
*)
Message="No Linux/ppc binaries for this libc version"
;;
esac
;;
alpha)
case "$OsLibcMajor.$OsLibcMinor" in
6.1)
DistName="Linux-alpha-glibc21"
;;
6.2)
DistName="Linux-alpha-glibc22"
;;
6.*)
Message="No Linux/alpha binaries for glibc 2.$OsLibcMinor. Try Linux-alpha-glibc22"
;;
*)
Message="No Linux/alpha binaries for this libc version"
;;
esac
;;
mips)
case "$OsLibcMajor.$OsLibcMinor" in
6.0)
DistName="Linux-mips-glibc20"
;;
*)
Message="No Linux/Mips binaries for this libc version"
;;
esac
;;
x86_64|amd64)
case "$OsLibcMajor.$OsLibcMinor" in
6.2)
DistName="Linux-amd64-glibc22"
;;
6.[3-9]*)
Message="No dist available for glibc 2.$OsLibcMinor. Try Linux-amd64-glibc22"
;;
*)
Message="No Linux/AMD64 binaries for this libc version"
;;
esac
;;
*)
Message="No Linux binaries available for this architecture"
;;
esac
;;
LynxOS) DistName="LynxOS"
;;
NetBSD)
case "$OsArch" in
i386)
case "$OsVersion" in
1.[4-9]*) case "$OsObjFormat" in
a.out)
DistName="NetBSD-1.4.x"
;;
*)
DistName="NetBSD-1.6 or NetBSD 1.5"
;;
esac
;;
*)
Message="No NetBSD/i386 binaries available for this version"
;;
esac
;;
*)
Message="No NetBSD binaries available for this architecture"
;;
esac
;;
OpenBSD)
case "$OsArch" in
i386)
case "$OsVersion" in
2.*)
DistName="OpenBSD-2.8"
;;
3.4*) DistName="OpenBSD-3.4"
;;
*)
Message="No OpenBSD/i386 binaries available for this version. Try OpenBSD-3.4."
;;
esac
;;
*)
Message="No OpenBSD binaries available for this architecture"
;;
esac
;;
SunOS)
case "$OsArch" in
i386)
case "$OsVersion" in
5.[67]*)
DistName="Solaris"
;;
5.8*)
DistName="Solaris-8"
;;
5.9*)
DistName="Solaris-9"
;;
5.10*)
Message="No Solaris/x86 binaries available for this version. Try Solaris-9."
;;
esac
;;
*)
Message="No SunOS/Solaris binaries available for this architecture"
;;
esac
;;
UNIX_SV)
case "$OsArch" in
i386)
case "$OsVersion" in
4.0*)
DistName="SVR4.0"
;;
*)
DistName="UnixWare"
;;
esac
;;
*)
Message="No SYSV binaries available for this architecture"
;;
esac
;;
*)
Message="No binaries available for this OS"
;;
esac
if [ X"$DistName" != X ]; then
echo "Binary distribution name is '$DistName'"
echo ""
echo "If you don't find a binary distribution with this name, then"
echo "binaries for your platform are not available from XFree86.org."
echo ""
else
if [ X"$Message" = X ]; then
echo "Can't find which binary distribution you should use."
echo "Please send the output of this script to XFree86@XFree86.org."
echo ""
else
echo "$Message"
echo ""
fi
fi
}
GetBindistVersion()
{
VERSTARBALL=
if [ X$DOBASE = XYES ]; then
if [ -f Xbin.tgz ]; then
VERSTARBALL=Xbin.tgz
fi
else
if [ X$DOUPDATE = XYES ]; then
if [ -f Xupdate.tgz ]; then
VERSTARBALL=Xupdate.tgz
fi
fi
fi
rm -f $VERSIONFILE
if [ X$VERSTARBALL != X ]; then
"$TAR" xzf $VERSTARBALL $VERSIONFILE
fi
if [ -f $VERSIONFILE ]; then
BINDISTVERSION=`cat $VERSIONFILE`
echo "Bindist version is $BINDISTVERSION"
BINDISTFULLPREFIX=`expr $BINDISTVERSION : '\([0-9]*\.[0-9]*\)\.'`
BINDISTPATCHLEVEL=`expr $BINDISTVERSION : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
case $BINDISTPATCHLEVEL in
99)
BINDISTFULLVERSION=$BINDISTVERSION
;;
*)
BINDISTFULLVERSION=$BINDISTFULLPREFIX.0
;;
esac
else
echo "Warning: can't detect the bindist version"
fi
}
CheckInstallType()
{
if [ X"$1" != X ]; then
case $1 in
-update)
DOUPDATE=YES
DOBASE=NO
OPTS="$OPTS $1"
shift
;;
-base|-full)
DOBASE=YES
DOUPDATE=NO
OPTS="$OPTS $1"
shift
;;
esac
fi
if [ X"$DOUPDATE" = X ]; then
for i in $BASEDIST; do
if [ -f $i ]; then
DOBASE=YES
fi
done
for i in $UPDATEDIST; do
if [ -f $i ]; then
DOUPDATE=YES
fi
done
if [ X"$DOBASE" = XYES -a X"$DOUPDATE" = XYES ]; then
echo ""
echo "You appear to have binaries in the current directory for"
echo "both a full release and an update release. The full release"
echo "must be installed before installing the update release."
echo ""
echo "The full release can be installed by re-running this script"
echo "with the '-base' option (sh $0 -base)."
echo ""
echo "The update release can be installed by re-running this script"
echo "with the '-update' option (sh $0 -update)."
echo ""
exit 1
fi
fi
GetBindistVersion
}
InstallUpdate()
{
missingDir=
for d in $RUNDIR $RUNDIR/lib $RUNDIR/lib/X11 $RUNDIR/bin; do
if [ ! -d $d ]; then
missingDir="$missingDir $d"
fi
done
if [ X$missingDir != X ]; then
echo ""
echo "You don't appear to have an existing installation of XFree86."
echo "You must install the most recent full release ($FULLVERSION)"
echo "before installing this update release."
echo ""
exit 1
fi
if [ -f $XSERVERCMD ]; then
existingVer=`$XSERVERCMD -version 2>&1 | grep "XFree86 Version" | \
awk '{print $3}'`
case $existingVer in
${FULLPREFIX}.*)
;;
*)
echo ""
echo "This update release should be installed on top of the most"
echo "recent full release ($FULLVERSION). Your current version"
echo "appears to be $existingVer. Please install $FULLVERSION"
echo "before installing this update release."
echo ""
exit 1
esac
fi
echo ""
echo "Installing the update binary distribution"
echo ""
for i in $UPDATEDIST $EXTRAUPDATE; do
(cd $RUNDIR; "$EXTRACT" "$WDIR"/$i)
done
chmod og-w $RUNDIR/lib
case "$OsName" in
FreeBSD|NetBSD|OpenBSD)
echo ""
echo "Running ldconfig"
chmod g-w $RUNDIR/lib
/sbin/ldconfig -m $RUNDIR/lib
;;
Linux)
echo ""
echo "Running ldconfig"
/sbin/ldconfig $RUNDIR/lib
;;
esac
echo ""
for i in $FONTDIRS $EXTRAFONTDIRS; do
if [ -d $RUNDIR/lib/X11/fonts/$i ]; then
Echo "Updating the fonts.dir file in $RUNDIR/lib/X11/fonts/$i..."
$RUNDIR/bin/mkfontdir $RUNDIR/lib/X11/fonts/$i
echo ""
fi
done
Echo "Updating the index of Freetype fonts..."
$RUNDIR/bin/fc-cache -v
echo ""
echo "Update installation complete."
}
CheckUtil expr
CheckUtil grep
if [ X"$1" = "X-check" ]; then
GetOsInfo -l
FindDistName
exit 0
fi
echo ""
echo " Welcome to the XFree86 $SCRIPTVERSION installer"
echo ""
echo "You are strongly advised to backup your existing XFree86 installation"
echo "before proceeding. This includes the $ROOTDIR/usr/X11R6, $ROOTDIR/etc/X11"
echo "and $ROOTDIR/etc/fonts directories. The installation process will"
echo "overwrite existing files in those directories, and this may include"
echo "some configuration files that may have been customised."
echo ""
echo "If you are installing a version different from $SCRIPTVERSION, you"
echo "may need an updated version of this installer script."
echo ""
ContinueNo
if [ X"$DISPLAY" != X ]; then
echo "\$DISPLAY is set, which may indicate that you are running this"
echo "installation from an X session. It is recommended that X not be"
echo "running while doing the installation."
echo ""
ContinueNo
fi
GetOsInfo
CheckUtil sed
CheckUtil fgrep
CheckUtil basename
case "$OsName" in
CYGWIN*)
SERVDIST="Xxserv.tgz"
;;
Darwin)
UPDATEDIST="Xupdate.tgz Xdocupd.tgz"
if [ -d /System/Library/Frameworks/ApplicationServices.framework ]; then
SERVDIST="Xxserv.tgz Xquartz.tgz"
else
SERVDIST="Xxserv.tgz"
fi
;;
FreeBSD)
VARDIST="Xvar.tgz"
XKBDBDIR="$VARDIR/db/xkb"
EXTRAOPTDIST="Xdrm.tgz"
;;
OpenBSD)
VARDIST="Xvar.tgz"
XKBDBDIR="$VARDIR/db/xkb"
;;
NetBSD)
EXTRAOPTDIST="Xdrm.tgz"
;;
Interactive) EXTRADIST="Xbin1.tgz"
EXTRAOPTDIST="Xxdm.tgz"
;;
Linux)
VARDIST="Xvar.tgz"
XKBDBDIR="$VARDIR/lib/xkb"
EXTRAOPTDIST="Xdrm.tgz"
;;
esac
if [ -f extract ]; then
ExtractExists=YES
chmod +x extract
if ./extract --version | sed 1q | \
fgrep "extract (XFree86 version" > /dev/null 2>&1; then
ExtractOK=YES
else
echo "extract doesn't work properly, renaming it to 'extract.bad'"
rm -f extract.bad
mv extract extract.bad
fi
fi
if [ X"$ExtractOK" != XYES ]; then
if [ -f extract.exe ]; then
ExtractExeExists=YES
rm -f extract
ln extract.exe extract
chmod +x extract
if ./extract --version | sed 1q | \
fgrep "extract (XFree86 version" > /dev/null 2>&1; then
ExtractOK=YES
else
echo "extract.exe doesn't work properly, renaming it to"
echo "'extract.exe.bad'"
rm -f extract.exe.bad
mv extract.exe extract.exe.bad
rm -f extract
fi
fi
fi
if [ X"$ExtractOK" != XYES ]; then
echo ""
if [ X"$ExtractExists" = XYES -a X"$ExtractExeExists" = XYES ]; then
echo "The versions of 'extract' and 'extract.exe' you have do not run'"
echo "correctly. Make sure that you have downloaded the correct"
echo "binaries for your system. To find out which is correct,"
echo "run 'sh $0 -check'."
fi
if [ X"$ExtractExists" = XYES -a X"$ExtractExeExists" != XYES ]; then
echo "The version of 'extract' you have does not run correctly."
echo "This is most commonly due to problems downloading this file"
echo "with some web browsers. You may get better results if you"
echo "download the version called 'extract.exe' and try again."
fi
if [ X"$ExtractExists" != XYES -a X"$ExtractExeExists" = XYES ]; then
echo "The version of 'extract.exe' you have does not run correctly."
echo "Make sure that you have downloaded the correct binaries for your"
echo "system. To find out which is correct, run 'sh $0 -check'."
fi
if [ X"$ExtractExists" != XYES -a X"$ExtractExeExists" != XYES ]; then
echo "You need to download the 'extract' (or 'extract.exe') utility"
echo "and put it in this directory."
fi
echo ""
echo "When you have corrected the problem, please re-run 'sh $0$OPTS'"
echo "to proceed with the installation."
echo ""
exit 1
fi
case "$OsName" in
CYGWIN*)
rm -f gnu-tar
ln -s extract.exe gnu-tar
;;
*)
rm -f gnu-tar
ln extract gnu-tar
;;
esac
EXTRACT="$WDIR"/extract
TAR="$WDIR"/gnu-tar
CheckInstallType "$@"
if [ X"$DOUPDATE" = XYES ]; then
REQUIREDFILES=" \
extract \
$UPDATEDIST \
$EXTRAUPDATE
"
else
REQUIREDFILES=" \
extract \
$BASEDIST \
$ETCDIST \
$VARDIST \
$SERVDIST \
$EXTRADIST \
"
fi
echo "Checking for required files ..."
Needed=""
for i in $REQUIREDFILES; do
if [ ! -f $i ]; then
Needed="$Needed $i"
fi
done
if [ X"$Needed" != X ]; then
echo ""
echo "The files:"
echo ""
echo "$Needed"
echo ""
echo "must be present in the current directory to proceed with the"
echo "installation. You should be able to find it at the same place"
echo "you picked up the rest of the XFree86 binary distribution."
echo "Please re-run 'sh $0$OPTS' to proceed with the installation when"
echo "you have them."
echo ""
exit 1
fi
DoOsChecks
if [ X"$NEEDSOMETHING" != X ]; then
echo ""
echo "Please re-run 'sh $0$OPTS' to proceed with the installation after you"
echo "have made the required updates."
echo ""
exit 1
fi
echo ""
if [ X$BINDISTVERSION != X ]; then
VERSION=$BINDISTVERSION
fi
if [ X$BINDISTFULLVERSION != X ]; then
FULLVERSION=$BINDISTFULLVERSION
fi
if [ X$BINDISTPATCHLEVEL != X ]; then
PATCHLEVEL=$BINDISTPATCHLEVEL
fi
if [ X$BINDISTFULLPREFIX != X ]; then
FULLPREFIX=$BINDISTFULLPREFIX
fi
if [ X"$DOUPDATE" = XYES ]; then
InstallUpdate
exit 0
fi
if [ ! -d $RUNDIR ]; then
NewRunDir=YES
echo "Creating $RUNDIR"
mkdir $RUNDIR
fi
if [ ! -d $RUNDIR/lib ]; then
echo "Creating $RUNDIR/lib"
mkdir $RUNDIR/lib
fi
if [ ! -d $RUNDIR/lib/X11 ]; then
echo "Creating $RUNDIR/lib/X11"
mkdir $RUNDIR/lib/X11
fi
if [ ! -d $ETCDIR/X11 ]; then
NewEtcDir=YES
echo "Creating $ETCDIR/X11"
mkdir $ETCDIR/X11
fi
if [ ! -d $ETCDIR/fonts ]; then
echo "Creating $ETCDIR/fonts"
mkdir $ETCDIR/fonts
fi
if [ -d $RUNDIR -a -d $RUNDIR/bin -a -d $RUNDIR/lib ]; then
echo ""
echo "You appear to have an existing installation of X. Continuing will"
echo "overwrite it. You will, however, have the option of being prompted"
echo "before most configuration files are overwritten."
ContinueYes
fi
if [ X"$OLDFILES" != X ]; then
echo ""
echo "Removing some old files that are no longer required..."
for i in $OLDFILES; do
if [ -f $i ]; then
echo " removing old file $i"
rm -f $i
fi
done
echo ""
fi
if [ X"$OLDDIRS" != X ]; then
echo ""
echo "Removing some old directories that are no longer required..."
for i in $OLDDIRS; do
if [ -d $i ]; then
echo " removing old directory $i"
rm -fr $i
fi
done
echo ""
fi
if [ ! -d $RUNDIR/lib/X11/xkb ]; then
echo "Creating $RUNDIR/lib/X11/xkb"
mkdir $RUNDIR/lib/X11/xkb
fi
EtcDirToMove=
EtcFileToMove=
if [ X"$NoSymLinks" != XYES ]; then
for i in $ETCDLINKS; do
if [ -d $RUNDIR/lib/X11/$i -a ! $L $RUNDIR/lib/X11/$i ]; then
EtcDirToMove="$EtcDirToMove $i"
fi
done
for i in $ETCFLINKS; do
if [ -f $RUNDIR/lib/X11/$i -a ! $L $RUNDIR/lib/X11/$i ]; then
EtcFileToMove="$EtcFileToMove $i"
fi
done
fi
if [ X"$EtcDirToMove" != X -o X"$EtcFileToMove" != X ]; then
echo "XFree86 now installs most customisable configuration files under"
echo "$ETCDIR/X11 instead of under $RUNDIR/lib/X11, and has symbolic links"
echo "under $RUNDIR/lib/X11 that point to $ETCDIR. You currently have"
echo "files under the following subdirectories of $RUNDIR/lib/X11:"
echo ""
echo "$EtcDirToMove $EtcFileToMove"
echo ""
echo "Do you want to move them to $ETCDIR/X11 and create the necessary"
Echo "links? (y/n) [y] "
read response
case "$response" in
[nN]*)
echo ""
echo "Note: this means that your run-time config files will remain"
echo "in the old $RUNDIR/lib/X11 location."
NoSymLinks=YES;
;;
esac
echo ""
if [ X"$NoSymLinks" != XYES ]; then
for i in $EtcDirToMove; do
echo "Moving $RUNDIR/lib/X11/$i to $ETCDIR/X11/$i ..."
if [ ! -d $ETCDIR/X11/$i ]; then
mkdir $ETCDIR/X11/$i
fi
"$TAR" -C $RUNDIR/lib/X11/$i -c -f - . | \
"$TAR" -C $ETCDIR/X11/$i -v -x -p -U -f - && \
rm -fr $RUNDIR/lib/X11/$i && \
ln -s $ETCDIR/X11/$i $RUNDIR/lib/X11/$i
done
for i in $EtcFileToMove; do
echo "Moving $RUNDIR/lib/X11/$i to $ETCDIR/X11/$i ..."
cp -p $RUNDIR/lib/X11/$i $ETCDIR/X11/$i && \
rm -fr $RUNDIR/lib/X11/$i && \
ln -s $ETCDIR/X11/$i $RUNDIR/lib/X11/$i
done
fi
fi
echo "Extracting $ETCDIST into a temporary location ..."
rm -fr .etctmp
mkdir .etctmp
(cd .etctmp; "$EXTRACT" "$WDIR"/$ETCDIST)
for i in $ETCDLINKS; do
DoCopy=YES
if [ -d $RUNDIR/lib/X11/$i ]; then
Echo "Do you want to overwrite the $i config files? (y/n) [n] "
read response
case "$response" in
[yY]*)
: OK
;;
*)
DoCopy=NO
;;
esac
fi
if [ $DoCopy = YES ]; then
echo "Installing the $i config files ..."
if [ X"$NoSymLinks" != XYES ]; then
if [ ! -d $ETCDIR/X11/$i ]; then
mkdir $ETCDIR/X11/$i
fi
if [ ! -d $RUNDIR/lib/X11/$i ]; then
ln -s $ETCDIR/X11/$i $RUNDIR/lib/X11/$i
fi
else
if [ ! -d $RUNDIR/lib/X11/$i ]; then
mkdir $RUNDIR/lib/X11/$i
fi
fi
"$TAR" -C .etctmp/X11/$i -c -f - . | \
"$TAR" -C $RUNDIR/lib/X11/$i -v -x -p -U -f -
fi
done
for i in $ETCFLINKS; do
DoCopy=YES
if [ -f $RUNDIR/lib/X11/$i ]; then
Echo "Do you want to overwrite the $i config file? (y/n) [n] "
read response
case "$response" in
[yY]*)
: OK
;;
*)
DoCopy=NO
;;
esac
fi
if [ $DoCopy = YES ]; then
echo "Installing the $i config file ..."
if [ X"$NoSymLinks" != XYES ]; then
if [ ! -f $RUNDIR/lib/X11/$i ]; then
ln -s $ETCDIR/X11/$i $RUNDIR/lib/X11/$i
fi
fi
(set -x; cp -p .etctmp/X11/$i $RUNDIR/lib/X11/$i)
fi
done
if [ X"$XKBDIR" != X ]; then
if [ X"$NoSymLinks" = XYES ]; then
XKBDIR=$RUNDIR/lib/X11/xkb/compiled
fi
if [ -d .etctmp/X11/xkb ]; then
if [ ! -d $XKBDIR ]; then
mkdir $XKBDIR
fi
"$TAR" -C .etctmp/X11/xkb -c -f - . | \
"$TAR" -C $XKBDIR -v -x -p -U -f -
fi
fi
for i in $ETCFONTFILES; do
DoCopy=YES
if [ -f $ETCDIR/fonts/$i ]; then
Echo "Do you want to overwrite the $i config file? (y/n) [n] "
read response
case "$response" in
[yY]*)
: OK
;;
*)
DoCopy=NO
;;
esac
fi
if [ $DoCopy = YES ]; then
echo "Installing the $i config file ..."
(set -x; cp -p .etctmp/fonts/$i $ETCDIR/fonts/$i)
fi
done
rm -fr .etctmp
echo ""
echo "Installing the mandatory parts of the binary distribution"
echo ""
for i in $BASEDIST $SERVDIST; do
(cd $RUNDIR; "$EXTRACT" "$WDIR"/$i)
done
if [ X"$VARDIST" != X ]; then
(cd $VARDIR; "$EXTRACT" "$WDIR"/$VARDIST)
fi
if [ X"$XKBDIR" != X -a X"$XKBDIR" != X"$RUNDIR/lib/X11/xkb/compiled" -a \
X"$XKBDBDIR" != X ]; then
rm -fr $RUNDIR/lib/X11/xkb/compiled
ln -s $XKBDBDIR $RUNDIR/lib/X11/xkb/compiled
fi
echo "Checking for post-release updates ..."
for i in $UPDDIST; do
if [ -f $i ]; then
Echo "Do you want to install update $i (`Description $i`)? (y/n) [y] "
read response
case "$response" in
[nN]*)
: skip this one
;;
*)
(cd $RUNDIR; "$EXTRACT" "$WDIR"/$i)
;;
esac
fi
done
echo "Checking for optional components to install ..."
for i in $OPTDIST $EXTRAOPTDIST; do
if [ -f $i ]; then
Echo "Do you want to install $i (`Description $i`)? (y/n) [y] "
read response
case "$response" in
[nN]*)
: skip this one
;;
*)
(cd $RUNDIR; "$EXTRACT" "$WDIR"/$i)
;;
esac
fi
done
TERMCAP1DIR=$ROOTDIR/usr/share
TERMCAP2=$ROOTDIR/etc/termcap
if [ -d $TERMCAP1DIR ]; then
TERMCAP1=`find $TERMCAP1DIR -type f -name termcap -print 2> /dev/null`
if [ x"$TERMCAP1" != x ]; then
TERMCAPFILE="$TERMCAP1"
fi
fi
if [ x"$TERMCAPFILE" = x ]; then
if [ -f $TERMCAP2 ]; then
TERMCAPFILE="$TERMCAP2"
fi
fi
case "$OsName" in
OpenBSD)
TERMCAPFILE=""
;;
esac
if [ X"$TERMCAPFILE" != X ]; then
echo ""
echo "You appear to have a termcap file: $TERMCAPFILE"
echo "This should be edited manually to replace the xterm entries"
echo "with those in $RUNDIR/lib/X11/etc/xterm.termcap"
echo ""
echo "Note: the new xterm entries are required to take full advantage"
echo "of new features, but they may cause problems when used with"
echo "older versions of xterm. A terminal type 'xterm-r6' is included"
echo "for compatibility with the standard X11R6 version of xterm."
fi
TINFODIR=$ROOTDIR/usr/lib/terminfo
OLDTINFO=" \
x/xterm \
x/xterms \
x/xterm-24 \
x/xterm-vi \
x/xterm-65 \
x/xterm-bold \
x/xtermm \
x/xterm-boldso \
x/xterm-ic \
x/xterm-r6 \
x/xterm-old \
x/xterm-r5 \
v/vs100"
if [ -d $TINFODIR ]; then
echo ""
echo "You appear to have a terminfo directory: $TINFODIR"
echo "New xterm terminfo entries can be installed now."
echo ""
echo "Note: the new xterm entries are required to take full advantage"
echo "of new features, but they may cause problems when used with"
echo "older versions of xterm. A terminal type 'xterm-r6' is included"
echo "for compatibility with the standard X11R6 version of xterm."
echo ""
echo "Do you wish to have the new xterm terminfo entries installed"
Echo "now (y/n)? [n] "
read response
case "$response" in
[yY]*)
echo ""
for t in $OLDTINFO; do
if [ -f $TINFODIR/$t ]; then
echo "Moving old terminfo file $TINFODIR/$t to $TINFODIR/$t.bak"
rm -f $TINFODIR/$t.bak
mv -f $TINFODIR/$t $TINFODIR/$t.bak
fi
done
echo ""
echo "Installing new terminfo entries for xterm."
echo ""
echo "On some systems you may get warnings from tic about 'meml'"
echo "and 'memu'. These warnings can safely be ignored."
echo ""
tic $RUNDIR/lib/X11/etc/xterm.terminfo
;;
*)
echo ""
echo "Not installing new terminfo entries for xterm."
echo "They can be installed later by running:"
echo ""
echo " tic $RUNDIR/lib/X11/etc/xterm.terminfo"
;;
esac
fi
if [ -f $RUNDIR/lib/libGL.so ]; then
existing=""
if [ -f $ROOTDIR/usr/lib/libGL.so ]; then
existing="$existing /usr/lib/libGL.so"
fi
if [ -f $ROOTDIR/usr/lib/libGL.so.1 ]; then
existing="$existing /usr/lib/libGL.so.1"
fi
if [ -d $ROOTDIR/usr/include/GL ]; then
existing="$existing /usr/include/GL"
fi
echo ""
echo "On some platforms (e.g., Linux), the OpenGL standard requires"
echo "that the GL shared library and header files be visible from the"
echo "standard system lib and include directories ($ROOTDIR/usr/lib and"
echo "$ROOTDIR/usr/include). This can be done by installing links in those"
echo "directories to the files that have been installed under $RUNDIR."
echo ""
echo "NOTE: installing these links will overwrite existing files or"
echo "links."
if [ X"$existing" != X ]; then
echo ""
echo "The follwing links/files/directories already exist:"
echo ""
ls -ld $existing
fi
echo ""
Echo "Do you wish to have the (new) links installed (y/n)? [n] "
read response
case "$response" in
[yY]*)
if [ ! -d $ROOTDIR/usr/lib ]; then
echo "Creating $ROOTDIR/usr/lib"
mkdir $ROOTDIR/usr/lib
fi
if [ ! -d $ROOTDIR/usr/include ]; then
echo "Creating $ROOTDIR/usr/include"
mkdir $ROOTDIR/usr/include
fi
rm -f $ROOTDIR/usr/lib/libGL.so
if [ ! -f $ROOTDIR/usr/lib/libGL.so ]; then
echo "Creating link from $RUNDIR/lib/libGL.so to $ROOTDIR/usr/lib/libGL.so"
ln -s $RUNDIR/lib/libGL.so $ROOTDIR/usr/lib/libGL.so
else
echo "Could not remove existing $ROOTDIR/usr/lib/libGL.so, so the new"
echo "link has not been created."
fi
rm -f $ROOTDIR/usr/lib/libGL.so.1
if [ ! -f $ROOTDIR/usr/lib/libGL.so.1 ]; then
echo "Creating link from $RUNDIR/lib/libGL.so.1 to $ROOTDIR/usr/lib/libGL.so.1"
ln -s $RUNDIR/lib/libGL.so.1 $ROOTDIR/usr/lib/libGL.so.1
else
echo "Could not remove existing $ROOTDIR/usr/lib/libGL.so.1, so the new"
echo "link has not been created."
fi
if [ -d $RUNDIR/include/GL ]; then
rm -f $ROOTDIR/usr/include/GL
if [ ! -d $ROOTDIR/usr/include/GL ]; then
echo "Creating link from $RUNDIR/include/GL to $ROOTDIR/usr/include/GL"
ln -s $RUNDIR/include/GL $ROOTDIR/usr/include/GL
else
echo "Could not remove existing $ROOTDIR/usr/include/GL, so the new"
echo "link has not been created."
fi
fi
;;
esac
fi
for i in $RUNDIR/lib/X11/doc/*.txt; do
base=`basename $i .txt`
old="RUNDIR/lib/X11/doc/$base.TXT"
if [ -f "$old" ]; then
echo "Removing old file $old (replaced by $base.txt)"
rm -f "$old"
fi
done
for i in $RUNDIR/lib/X11/doc/PostScript/*.PS; do
base=`basename $i .ps`
old="RUNDIR/lib/X11/doc/$base.PS"
if [ -f "$old" ]; then
echo "Removing old file $old (replaced by $base.ps)"
rm -f "$old"
fi
done
case "$OsName" in
FreeBSD|NetBSD|OpenBSD)
echo ""
echo "Running ldconfig"
chmod g-w $RUNDIR/lib
/sbin/ldconfig -m $RUNDIR/lib
;;
Linux)
echo ""
echo "Running ldconfig"
/sbin/ldconfig $RUNDIR/lib
;;
esac
echo ""
for i in $FONTDIRS $EXTRAFONTDIRS; do
if [ -d $RUNDIR/lib/X11/fonts/$i ]; then
Echo "Updating the fonts.dir file in $RUNDIR/lib/X11/fonts/$i..."
$RUNDIR/bin/mkfontdir $RUNDIR/lib/X11/fonts/$i
echo ""
fi
done
if [ -f $RUNDIR/bin/rstartd ]; then
echo ""
echo "If you are going to use rstart and $RUNDIR/bin isn't in the"
echo "default path for commands run remotely via rsh, you will need"
echo "a link to rstartd installed in $ROOTDIR/usr/bin."
echo ""
Echo "Do you wish to have this link installed (y/n)? [n] "
read response
case "$response" in
[yY]*)
if [ ! -d $ROOTDIR/usr/bin ]; then
echo "Creating $ROOTDIR/usr/bin"
mkdir $ROOTDIR/usr/bin
fi
echo "Creating link from $RUNDIR/bin/rstartd to $ROOTDIR/usr/bin/rstartd"
rm -f $ROOTDIR/usr/bin/rstartd
ln -s $RUNDIR/bin/rstartd $ROOTDIR/usr/bin/rstartd
;;
esac
fi
if [ -d $RUNDIR/lib/modules ]; then
for i in $OLDMODULES; do
if [ -f $RUNDIR/lib/modules/$i ]; then
ModList="$ModList $i"
fi
done
if [ X"$ModList" != X ]; then
echo ""
echo "The following 3.3.x X server modules were found in"
echo "$RUNDIR/lib/modules, and they may cause problems when running"
echo "$VERSION:"
echo ""
echo " $ModList"
echo ""
echo "Do you want them moved to $RUNDIR/lib/modules/old?"
echo "Note: that if you want to use them with 3.3.x again, you'll"
Echo "need to move them back manually. (y/n) [n] "
read response
case "$response" in
[yY]*)
if [ ! -d $RUNDIR/lib/modules/old ]; then
echo ""
echo "Creating $RUNDIR/lib/modules/old"
mkdir $RUNDIR/lib/modules/old
else
echo ""
fi
if [ -d $RUNDIR/lib/modules/old ]; then
for i in $ModList; do
echo "Moving $i to $RUNDIR/lib/modules/old"
mv $RUNDIR/lib/modules/$i $RUNDIR/lib/modules/old/$i
done
else
echo "Failed to create directory $RUNDIR/lib/modules/old"
fi
;;
*)
echo ""
echo "Make sure that you rename, move or delete the old modules"
echo "before running $VERSION."
esac
fi
if [ -d $RUNDIR/lib/modules/codeconv ]; then
if [ -f $RUNDIR/lib/modules/codeconv/ISO8859_1.so ]; then
echo ""
echo "Warning: it looks like there are some old *.so modules"
echo "in $RUNDIR/lib/modules/codeconv. You may need to rename,"
echo "move or delete them if you use the xtt font module."
fi
fi
fi
case "$OsName" in
FreeBSD|NetBSD)
DRMBUILDDIR="$RUNDIR/src/bsd/drm/kernel"
;;
Linux)
DRMBUILDDIR="$RUNDIR/src/linux/drm/kernel"
;;
esac
DoDrmBuild=
if [ -f $DRMBUILDDIR/Makefile ]; then
echo ""
echo "If you have source for your current kernel installed, you can"
echo "have new DRM kernel modules built and installed. Note: this will"
echo "overwrite any existing DRM kernel modules you may have installed."
echo "If you'd prefer to save them before installing new ones, answer 'n'"
echo "here and follow the build/install instructions manually later."
echo ""
Echo "Do you want to build and install new DRM kernel modules? (y/n) [n] "
read response
case "$response" in
[yY]*)
DoDrmBuild=1
;;
*)
echo ""
echo "To build the DRM modules manually, run 'make' from the"
echo "$DRMBUILDDIR directory. Once built, install"
echo "them by running 'make install' from the same directory."
;;
esac
fi
if [ X"$DoDrmBuild" != X ]; then
cd $DRMBUILDDIR && \
echo "" && \
echo "Building DRM modules" && \
make clean > build.log 2>&1 && \
make >> build.log 2>&1
if [ $? != 0 ]; then
echo ""
echo "DRM module build failed."
echo "See $DRMBUILDDIR/build.log for details."
else
echo ""
echo "Installing DRM modules"
make install > install.log 2>&1
if [ $? != 0 ]; then
echo ""
echo "DRM module install failed."
echo "See $DRMBUILDDIR/install.log for details."
else
echo ""
echo "DRM module build and install was successful."
echo "You may need to manually unload the old module and reload"
echo "the new ones, or reboot to have this done automatically."
fi
fi
cd $WDIR
fi
echo ""
echo "Installation complete."
exit 0