head 1.5; access; symbols libdrm-1_0_4:1.5 experimental-0-1-branch:1.4.0.4 trunk-20021125:1.4 mesa-4-1-branch:1.4.0.2 DRI-SCRIPTS_1_0:1.1.1.1 DRI-SCRIPTS:1.1.1; locks; strict; comment @# @; 1.5 date 2003.10.14.11.33.21; author alanh; state Exp; branches; next 1.4; 1.4 date 2002.08.05.18.04.11; author alanh; state Exp; branches 1.4.4.1; next 1.3; 1.3 date 2002.03.09.06.10.53; author jensowen; state Exp; branches; next 1.2; 1.2 date 2002.02.22.17.00.13; author jensowen; state Exp; branches; next 1.1; 1.1 date 2002.02.02.14.10.37; author alanh; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2002.02.02.14.10.37; author alanh; state Exp; branches; next ; 1.4.4.1 date 2003.04.17.18.17.28; author dawes; state Exp; branches; next 1.4.4.2; 1.4.4.2 date 2003.04.23.01.00.20; author dawes; state Exp; branches; next ; desc @@ 1.5 log @add RPM .spec files for each driver and a Makefile to build them. + a few minor updates to the build scripts. (original implementation from David Dawes) @ text @#!/bin/bash ####################################################################### # This is the DRI installation script. It compiles the kernel modules # and installs the kernel, DRI and libGL modules. # # Frank Worsley # Alan Hourihane # David Dawes # ####################################################################### ########################################################### # VARIABLE DEFINITIONS ########################################################### LOGFILE="dri.log" LOGFILE_TMP="tmp.log" SAVE_PREFIX="" SAVE_SUFFIX=".dri-old" VARDB="/var/lib" DB_DIR="$VARDB/dripkg" INSTALLATIONS="$DB_DIR/installations" INSTALLED_FILES="$DB_DIR/files" PREVIOUS_FILES="$DB_DIR/prevfiles" UNINSTALL_SCRIPT="$DB_DIR/uninstall" ORIGINAL_FILES="$INSTALLED_FILES-orig" CURRENT_FILES="$INSTALLED_FILES-current" REQUIRED_UTILS="ed awk sort md5sum" # Defaults XF86_DIR="/usr/X11R6" KERNEL_VER=`uname -r` KERNEL_LIB_DIR="/lib/modules/$KERNEL_VER" OS_NAME="unknown" #EXTMODULES="libdri.a libglx.a libGLcore.a" #EXTMODULES="libdri.a" #OSMODULES="libdrm.a libint10.a" #MISCMODULES="libpcidata.a libscanpci.a libvbe.a" LOGO_HEADLINE="DIRECT RENDERING OPEN SOURCE PROJECT" LOGO_URL="http://dri.sourceforge.net" # TODO: Add options to allow the kernel and XFree86 directories to be specified # from the command line? # Parse the command line ARGS=`getopt bfv "$@@"` eval set -- "$ARGS" batch=0 force=0 verbose=0 while true; do case "$1" in -b) batch=1 shift ;; -f) force=1 shift ;; -v) verbose=1 shift ;; --) shift break ;; esac done OPTION=$1 # Default to install in batch mode if [ "$batch" = 1 -a X"$OPTION" = X ]; then OPTION=install fi ########################################################### # FUNCTION DECLARATIONS ########################################################### msg() { if [ $batch = 0 -o $verbose = 1 ]; then echo "$@@" fi } errmsg() { echo "$@@" } print_logo() { ################################################################ # This function prints a DRI logo and a general text header. ################################################################ if [ "$batch" = 0 ]; then clear msg "" msg "$LOGO_HEADLINE - DRIVER INSTALLATION SCRIPT" msg "" msg "[ $LOGO_URL ]" msg "" msg "==========================================================================" fi msg "" } set_values() { ##################################################################### # Sets up default values. ##################################################################### # Determine driver to be installed DRV_NAME=`echo "1 p" | ed -s pkginfo` DRV_DESC=`echo "2 p" | ed -s pkginfo` DRV_ARCH=`echo "3 p" | ed -s pkginfo` DRV_DATE=`echo "4 p" | ed -s pkginfo` DRV_MODULE=`echo "5 p" | ed -s pkginfo` DRV_VERSION=`echo "6 p" | ed -s pkginfo` DRV_BUILD_DESC=`echo "7 p" | ed -s pkginfo` if [ -f installinfo ]; then INSTALL_STAMP=`echo "1 p" | ed -s installinfo` fi # Determine directories from default or user values XF86_MOD_DIR="$XF86_DIR/lib/modules" XF86_DRI_DIR="$XF86_MOD_DIR/dri" XF86_DRV_DIR="$XF86_MOD_DIR/drivers" XF86_GL_DIR="$XF86_DIR/lib" XF86_EXT_DIR="$XF86_MOD_DIR/extensions" XF86_OS_DIR="$XF86_MOD_DIR/linux" KERNEL_DRM_DIR="$KERNEL_LIB_DIR/kernel/drivers/char/drm" KERNEL_AGPGART_DIR="$KERNEL_LIB_DIR/kernel/drivers/char/agp" INSTALL_AGPGART="0" if [ -d agpgart ]; then INSTALL_AGPGART="1" fi USE_EXISTING_KERNEL_MODULE="0" } check_values() { ##################################################################### # Checks if default/user given values are correct. ##################################################################### # Check if installation directories exist MSG=$'The following problems have occured:\n' FATAL=0 ERR=0 if [ ! -d "$XF86_DIR" ]; then MSG="$MSG"$'\n - XFree86 directory does not exist' ERR="1" FATAL="1" fi if [ ! -d "$KERNEL_LIB_DIR" ]; then MSG="$MSG"$'\n - Kernel module directory does not exist' ERR="1" FATAL="1" fi if [ ! -d "$KERNEL_DRM_DIR" ]; then MSG="$MSG"$'\n - Kernel DRM directory does not exist' ERR="1" fi if [ ! -d "$KERNEL_AGPGART_DIR" ]; then MSG="$MSG"$'\n - Kernel AGPGART directory does not exist' ERR="1" fi if [ ! -d "$XF86_GL_DIR" ]; then MSG="$MSG"$'\n - XFree86 GL library directory does not exist' ERR="1" fi if [ ! -d "$XF86_MOD_DIR" ]; then MSG="$MSG"$'\n - XFree86 modules directory does not exist' ERR="1" fi if [ ! -d "$XF86_DRI_DIR" ]; then MSG="$MSG"$'\n - XFree86 DRI directory does not exist' ERR="1" fi if [ ! -d "$XF86_DRV_DIR" ]; then MSG="$MSG"$'\n - XFree86 driver directory does not exist' ERR="1" fi if [ ! -d "$XF86_EXT_DIR" ]; then MSG="$MSG"$'\n - XFree86 extensions directory does not exist' ERR="1" fi if [ ! -d "$XF86_OS_DIR" ]; then MSG="$MSG"$'\n - XFree86 Linux OS directory does not exist' ERR="1" fi # No error so return if [ "$ERR" == "0" ]; then return 0 fi # Get out if we have a fatal error that requires user to re-enter values if [ "$FATAL" == "1" -a "$batch" = 0 ]; then MSG="$MSG"$'\n\nPlease make sure you have entered all information correctly.\n\nPress ENTER to review the information.' print_logo errmsg "$MSG" read KEY return -1 fi if [ "$batch" = 0 ]; then #Fix what we can MSG="$MSG"$'\n\nThe script can create these directories for you.\n\nPress ENTER to continue or CTRL-C to abort.' print_logo msg "$MSG" read KEY fi # Now we just create all directories no matter what ... mkdir -p $XF86_GL_DIR mkdir -p $XF86_MOD_DIR mkdir -p $XF86_DRI_DIR mkdir -p $XF86_DRV_DIR mkdir -p $XF86_EXT_DIR mkdir -p $XF86_OS_DIR mkdir -p $KERNEL_DRM_DIR mkdir -p $KERNEL_AGPGART_DIR return 0 } get_osname() { if [ -f /etc/redhat-release ]; then OS_NAME="redhat" VER=`awk '{ print $5 }' < /etc/redhat-release` OS_NAME="$OS_NAME-$VER" return 0 fi if [ -f /etc/SuSE-release ]; then OS_NAME="suse" VER=`grep VERSION /etc/SuSE-release | awk '{ print $3 }'` OS_NAME="$OS_NAME-$VER" return 0 fi } add_stamp() { if [ ! -f $INSTALLATIONS ]; then touch $INSTALLATIONS fi if grep -q $INSTALL_STAMP $INSTALLATIONS; then : else echo "$INSTALL_STAMP" >> $INSTALLATIONS fi } install_file() { srcfile=`basename $1` target="$2/$srcfile" save="$2/$SAVE_PREFIX$srcfile$SUFFIX" orig="$2/$SAVE_PREFIX$srcfile$SAVE_SUFFIX" remove="$2/$SAVE_PREFIX$srcfile$SAVE_SUFFIX:remove" add_stamp if [ -e $target ]; then if [ ! -e $orig -a ! -e $remove ]; then if [ -f $ORIGINAL_FILES ]; then rm -f $ORIGINAL_FILES.tmp grep -v $target $ORIGINAL_FILES > \ $ORIGINAL_FILES.tmp mv -f $ORIGINAL_FILES.tmp $ORIGINAL_FILES fi md5sum $target >> $ORIGINAL_FILES fi md5sum $target >> $PREVIOUS_FILES rm -f $save mv $target $save >& $LOGFILE_TMP echo "test -e $save && mv -f $save $target" >> \ $UNINSTALL_SCRIPT if [ ! -e $orig -a ! -e $remove ]; then ln $save $orig echo "rm -f $orig" >> $UNINSTALL_SCRIPT fi else rm -f $save echo "rm -f $target" >> $UNINSTALL_SCRIPT if [ ! -e $orig -a ! -e $remove ]; then touch $remove echo "rm -f $remove" >> $UNINSTALL_SCRIPT if [ -f $ORIGINAL_FILES ]; then rm -f $ORIGINAL_FILES.tmp grep -v $target $ORIGINAL_FILES > \ $ORIGINAL_FILES.tmp mv -f $ORIGINAL_FILES.tmp $ORIGINAL_FILES fi echo "remove $target" >> $ORIGINAL_FILES fi echo "remove $target" >> $PREVIOUS_FILES fi if [ -e $target ]; then echo "Failed to save file $target" return 1 fi if cp $1 $target; then md5sum $target >> $INSTALLED_FILES if [ -f $CURRENT_FILES ]; then rm -f $CURRENT_FILES.tmp grep -v $target $CURRENT_FILES > $CURRENT_FILES.tmp mv -f $CURRENT_FILES.tmp $CURRENT_FILES fi md5sum $target >> $CURRENT_FILES else echo "Failed to install file $target" return 1 fi return 0 } copy_files() { ##################################################################### # This function copies files to their destination directories. ##################################################################### msg "Installing files:" INSTALL_STAMP=`date "+%Y%m%d%H%M%S"` SUFFIX="$SAVE_SUFFIX-$INSTALL_STAMP" INSTALLED_FILES="$INSTALLED_FILES-$INSTALL_STAMP" UNINSTALL_SCRIPT="$UNINSTALL_SCRIPT-$INSTALL_STAMP" PREVIOUS_FILES="$PREVIOUS_FILES-$INSTALL_STAMP" msg -n " DRI XFree86 modules..." cd $DRV_NAME for FILE in *drv.o do if install_file $FILE $XF86_DRV_DIR; then : OK else INSTALL_FAILED=1 fi done for FILE in *dri.so do if install_file $FILE $XF86_DRI_DIR; then : OK else INSTALL_FAILED=1 fi done cd .. msg "done" msg -n " kernel modules..." if [ "$USE_EXISTING_KERNEL_MODULE" == "1" ]; then msg "using existing module" else mkdir -p $KERNEL_DRM_DIR if install_file drm/$DRV_MODULE.o $KERNEL_DRM_DIR; then : OK else INSTALL_FAILED=1 fi if [ "$INSTALL_AGPGART" == "1" ]; then mkdir -p $KERNEL_AGPGART_DIR if install_file agpgart/agpgart.o $KERNEL_AGPGART_DIR; then : OK else INSTALL_FAILED=1 fi fi msg "done" fi #echo -n " GL & GLU libraries..." #cd GL #for FILE in * #do # mv -f $XF86_GL_DIR/$FILE $XF86_GL_DIR/$FILE.dri-old >& $LOGFILE_TMP #done #cd .. #cp -f GL/* $XF86_GL_DIR #echo "done" msg -n " core libraries..." for FILE in $EXTMODULES; do if install_file core/$FILE $XF86_EXT_DIR; then : OK else INSTALL_FAILED=1 fi done for FILE in $OSMODULES; do if install_file core/$FILE $XF86_OS_DIR; then : OK else INSTALL_FAILED=1 fi done for FILE in $MISCMODULES; do if install_file core/$FILE $XF86_MOD_DIR; then : OK else INSTALL_FAILED=1 fi done if [ "$INSTALL_FAILED" = 1 ]; then errmsg "The installation of one or more files failed" else msg "done" fi if [ -e extras/extras.sh ]; then msg -n " Executing extras script..." extras/extras.sh $XF86_DIR fi } restore_files () { # Restoring to the original state is handled a little differently # from the other cases in the interests of maximising the chance # of getting back to that state. if [ $1 = orig ]; then msg "Restoring original files..." FILES="`awk '{ print $2 }' < $ORIGINAL_FILES`" for FILE in $FILES; do dir=`dirname $FILE` base=`basename $FILE` save=$dir/$SAVE_PREFIX$base$SAVE_SUFFIX if [ -e $save ]; then #msg "Restoring $FILE" mv -f $save $FILE else if [ -e $save-remove ]; then #msg "Removing $FILE" rm -f $FILE fi fi #msg Removing $save-* rm -f $save-* done rm -f $CURRENT_FILES rm -f $ORIGINAL_FILES rm -f $PREVIOUS_FILES* rm -f $INSTALLED_FILES* rm -f $INSTALLATIONS rm -f $UNINSTALL_SCRIPT* else msg "Uninstalling installation $1..." if [ -f $UNINSTALL_SCRIPT-$1 ]; then $SHELL $UNINSTALL_SCRIPT-$1 rm -f $PREVIOUS_FILES-$1 rm -f $UNINSTALL_SCRIPT-$1 FILES="`awk '{ print $2 }' < $INSTALLED_FILES-$1`" for FILE in $FILES; do dir=`dirname $FILE` base=`basename $FILE` orig=$dir/$SAVE_PREFIX$base$SAVE_SUFFIX if [ -f $CURRENT_FILES ]; then rm -f $CURRENT_FILES.tmp grep -v $FILE $CURRENT_FILES > \ $CURRENT_FILES.tmp mv -f $CURRENT_FILES.tmp $CURRENT_FILES fi if [ -e $FILE ]; then md5sum $FILE >> $CURRENT_FILES fi if [ ! -e $orig -a ! -e $orig-remove ]; then rm -f $ORIGINAL_FILES.tmp grep -v $orig $ORIGINAL_FILES > \ $ORIGINAL_FILES.tmp mv -f $ORIGINAL_FILES.tmp \ $ORIGINAL_FILES fi done rm -f $INSTALLED_FILES-$1 if [ -f $INSTALLATIONS ]; then rm -f $INSTALLATIONS.tmp grep -v $1 $INSTALLATIONS > $INSTALLATIONS.tmp mv -f $INSTALLATIONS.tmp $INSTALLATIONS fi else errmsg "Cannot find the uninstall script $UNINSTALL_SCRIPT-$1" return 1 fi fi } update_config() { ##################################################################### # This function updates the system configuration. ##################################################################### msg "" msg "Updating configuration:" #echo -n " Running ldconfig..." #grep "$XF86_DIR" /etc/ld.so.conf >& $LOGFILE_TMP #if [ $? != 0 ]; then # echo "$XF86_DIR/lib" >> /etc/ld.so.conf #fi #/sbin/ldconfig >& $LOGFILE_TMP #if [ $? != 0 ]; then # echo "ERROR" # ERR=1 #else # echo "done" #fi #cat $LOGFILE_TMP >> $LOGFILE if [ ! "$X_RUNNING" == "1" ]; then # Only try and update kernel modules if X server is not running for MOD in $DRV_MODULE do msg -n " Removing old kernel module \"$MOD\"..." /sbin/modprobe -r $MOD >& $LOGFILE_TMP if [ $? != 0 ]; then msg "ERROR" ERR=1 else msg "done" fi msg -n " Removing old kernel module \"agpgart\"..." /sbin/modprobe -r agpgart >& $LOGFILE_TMP if [ $? != 0 ]; then msg "ERROR" ERR=1 else msg "done" fi cat $LOGFILE_TMP >> $LOGFILE msg -n " Inserting new kernel module \"agpgart\"..." /sbin/modprobe agpgart >& $LOGFILE_TMP if [ $? != 0 ]; then msg "ERROR" ERR=1 else msg "done" fi msg -n " Inserting new kernel module \"$MOD\"..." /sbin/modprobe $MOD >& $LOGFILE_TMP if [ $? != 0 ]; then msg "ERROR" ERR=1 else msg "done" fi cat $LOGFILE_TMP >> $LOGFILE done fi if [ "$ERR" == "1" ]; then errmsg "" errmsg "There were errors updating the system configuration." errmsg "See the $LOGFILE file for more information." fi rm -f $LOGFILE_TMP } check_config() { ##################################################################### # This function checks the system configuration. ##################################################################### msg "" msg -n "Checking configuration..." # Fix potential libGL problems #LIBGL1=`ldd $XF86_DIR/bin/glxinfo | grep libGL.so.1 | awk -F" " '{ printf "%s",$3 }'` #LIBGL=`echo $LIBGL1 | sed -e 's/\.1//'` #if [ "$LIBGL" != "$XF86_GL_DIR/libGL.so" ]; then # echo "" # echo -n " second copy of DRI libraries found in " # echo `echo $LIBGL1 | sed -e 's/libGL.so.1//'` # # echo -n " libraries have been backed up to old.* in " # echo `echo $LIBGL1 | sed -e 's/libGL.so.1//'` # echo "" # # mv $LIBGL1 `echo $LIBGL1 | sed -e 's/libGL.so.1/old.libGL.so.1/'` # mv $LIBGL `echo $LIBGL | sed -e 's/libGL.so/old.libGL.so/'` # ln -s $XF86_GL_DIR/libGL.so.1 $LIBGL1 # ln -s $XF86_GL_DIR/libGL.so $LIBGL #fi # Make sure libGL and libGLU have correct links #rm -f $XF86_GL_DIR/libGL.so #rm -f $XF86_GL_DIR/libGL.so.1 #ln -s $XF86_GL_DIR/libGL.so.1.2 $XF86_GL_DIR/libGL.so #ln -s $XF86_GL_DIR/libGL.so.1.2 $XF86_GL_DIR/libGL.so.1 #rm -f $XF86_GL_DIR/libGLU.so #rm -f $XF86_GL_DIR/libGLU.so.1 #ln -s $XF86_GL_DIR/libGLU.so.1.3 $XF86_GL_DIR/libGLU.so #ln -s $XF86_GL_DIR/libGLU.so.1.3 $XF86_GL_DIR/libGLU.so.1 msg "done" } verify_files() { if [ $1 = orig ]; then PREVLIST="$ORIGINAL_FILES" SUFFIX="$SAVE_SUFFIX" FILELIST="$CURRENT_FILES" else FILELIST="$INSTALLED_FILES-$1" SUFFIX="$SAVE_SUFFIX-$1" PREVLIST="$PREVIOUS_FILES-$1" fi # First, verify that the saved copies match FILES="`awk '{ print $2 }' < $PREVLIST`" NOEXIST="" NOMATCH="" for FILE in $FILES; do SAVESUM="`grep $FILE $PREVLIST | awk '{ print $1 }'`" dir=`dirname $FILE` base=`basename $FILE` save=$dir/$SAVE_PREFIX$base$SUFFIX if [ -e $save ]; then CURSUM="`md5sum $save | awk '{ print $1 }'`" else CURSUM="remove" fi if [ X"$CURSUM" != X"$SAVESUM" ]; then if [ X"$CURSUM" = Xremove ]; then NOEXIST="$NOEXIST $save" else NOMATCH="$NOMATCH $save" fi fi done if [ X"$NOMATCH" != X ]; then errmsg "" errmsg "The following saved files don't match the recorded md5 signatures:" for f in $NOMATCH; do errmsg " $f" done fi if [ X"$NOEXIST" != X ]; then errmsg "" errmsg "The following saved files are missing:" for f in $NOEXIST; do errmsg " $f" done fi msg "" if [ X"$NOMATCH$NOEXIST" != X ]; then return 2 fi # Now verify that the installed file matches NOMATCH="" for FILE in $FILES; do SAVESUM="`grep $FILE $FILELIST | awk '{ print $1 }'`" CURSUM="`md5sum $FILE | awk '{ print $1 }'`" if [ X"$CURSUM" != X"$SAVESUM" ]; then NOMATCH="$NOMATCH $FILE" fi done if [ X"$NOMATCH" != X ]; then errmsg "" errmsg "The following saved files don't match the recorded md5 signatures:" for f in $NOMATCH; do errmsg " $f" done errmsg "" return 1 fi return 0 } do_uninstall() { print_logo if [ ! -f $INSTALLATIONS ]; then errmsg "No previous installations were found." exit 0 fi INST_LIST="`sort $INSTALLATIONS`" if [ X"$INST_LIST" = X ]; then errmsg "No previous installations were found." exit 0 fi msg "The following installation states have been found:" msg "" i=0 msg -n " 0. Original files" for INST in $INST_LIST; do i=`expr $i + 1` msg "" msg -n " $i. $INST" done msg " (current state)" msg "" msg "This script can attempt to revert to any of the previous" msg "states listed. In doing so, it will remove all versions" msg "installed after the specified state. Selecting 0 will remove" msg "all previous installations. Selecting $i will do nothing since" msg "that is the current state. The default is `expr $i - 1`, which" msg "will back out the most recent installation." msg "" msg -n "Enter the state you wish to revert to [0-$i]: " KEY="" while [ X$KEY = X ]; do if [ "$batch" = 0 ]; then read KEY fi case "$KEY" in "") KEY=`expr $i - 1` ;; [0-9]|[0-9][0-9]|[0-9][0-9][0-9]) if [ $KEY -lt 0 -o $KEY -gt $i ]; then KEY="" fi ;; *) KEY="" ;; esac if [ X$KEY = X ]; then msg "Bad response." msg -n "Please enter a number in the range [0-$i]: " fi done case "$KEY" in 0) msg "All previous installations will be removed." REMOVE_ALL=1 ;; $i) msg "The current state was selected. Nothing to do." exit 0 ;; *) j=0 REMOVE_LIST="" msg "" msg "The following installations will be removed:" for INST in $INST_LIST; do j=`expr $j + 1` if [ $j -gt $KEY ]; then REMOVE_LIST="$REMOVE_LIST $INST" msg " $INST" fi done esac if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit" read KEY fi set_values if [ "$REMOVE_ALL" = 1 ]; then verify_files orig case $? in 0) if restore_files orig; then msg "Successfully restored original state." fi ;; 1) msg "One of more of the files doesn't match the most recently installed" msg "version. This usually means that some other mechanism has installed" msg "a new version since this installation script was last used." if [ "$batch" = 1 -a "$force" = 0 ]; then errmsg "Aborting" exit 1 fi msg "It is possible to continue with this uninstallation process, but" msg "be aware that it may interfere with some other packaging mechanism." if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit" read KEY fi if restore_files orig; then msg "Successfully restored original state." fi ;; *) errmsg "One or more of the files required to restore the original version" errmsg "is either missing or doesn't match the recorded md5 signatures." errmsg "" if [ "$force" = 0 ]; then errmsg "Aborting" exit 1 fi if restore_files orig; then msg "Successfully restored original state." fi ;; esac else n=`echo $REMOVE_LIST | wc -w | sed 's/ *//'` while [ $n -ne 0 ]; do REMOVEID=`echo $REMOVE_LIST | awk '{ print $'$n' }'` msg "Removing $REMOVEID..." verify_files $REMOVEID case $? in 0) if restore_files $REMOVEID; then msg "Successfully uninstalled the $REMOVEID installation" else errmsg "Uninstalling the $REMOVEID installation failed." msg "Either try to revert to a later installation, or back to the original version." exit 1 fi ;; 1) errmsg "One or more of the files doesn't match the installed version about to be" errmsg "removed. This usually means that some other mechanism has installed" errmsg "a new version since this then." if [ "$batch" = 1 -a "$force" = 0 ]; then errmsg "Aborting" exit 1 fi msg "It is possible to continue with this uninstallation process, but" msg "be aware that it may interfere with some other packaging mechanism." if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit" read KEY fi if restore_files $REMOVEID; then msg "Successfully uninstalled the $REMOVEID installation." else errmsg "Uninstalling the $REMOVEID installation failed." msg "Either try to revert to a later installation, or back to the original version." exit 1 fi ;; *) errmsg "One or more of the files required to uninstall the $REMOVEID installation." errmsg "is either missing or doesn't match the recorded signatures." errmsg "" errmsg "Uninstalling the $REMOVEID installation failed." msg "Either try to revert to a later installation, or back to the original version." msg "" errmsg "Aborting" exit 1 ;; esac n=`expr $n - 1` done fi msg "" } ########################################################### # MAIN SCRIPT ########################################################### # Check if pkginfo file exists if [ ! -e "pkginfo" ]; then errmsg "Could not locate 'pkginfo' file. Aborting." exit 127 fi # Check if we are running as root if [ `id -u` != "0" ]; then errmsg "You must be root to install the DRI drivers." exit 127 fi # Check if the required utilities are available MISSING_UTILS="" for UTIL in $REQUIRED_UTILS; do if which $UTIL &> /dev/null; then : OK else MISSING_UTILS="$MISSING_UTILS $UTIL" fi if [ X"$MISSING_UTILS" != X ]; then errmsg "Could not locate some required utilities:$MISSING_UTILS" errmsg "Aborting" exit 127 fi done if [ ! -d $DB_DIR ]; then mkdir -p $DB_DIR if [ ! -d $DB_DIR ]; then errmsg "Cannot create directory $DB_DIR" exit 127 fi fi ### FIXME: We should check for matching architectures here!!! ### # Print X is running message ps -C X > /dev/null if [ $? == 0 ]; then X_RUNNING=1 print_logo errmsg "WARNING: YOUR X SERVER SEEMS TO BE RUNNING!" errmsg "" errmsg "The script can not update your kernel modules while the X server is running." errmsg "" errmsg "You can do one of the following:" errmsg "" errmsg "1. Log out of your X session now and then run this script." errmsg "" errmsg "2. Run the script now and restart your computer after the installation." errmsg " If you exit your X session now you will not have to restart." if [ "$batch" = 1 -a "$force" = 0 ]; then errmsg "Aborting" exit 1 fi if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit." read KEY fi else X_RUNNING=0 fi # Do misc stuff rm -f $LOGFILE touch $LOGFILE # Setup the defaults values set_values # Print a welcome message print_logo msg "Welcome to the DRI Driver Installation Script" msg "" msg "The package you downloaded is for the following driver: " msg "" msg "Driver Name : $DRV_NAME" msg "Description : $DRV_DESC" msg "Architecture : $DRV_ARCH" msg "Build Date : $DRV_DATE" msg "Kernel Module : $DRV_MODULE" msg "" msg "Optional Information" msg "" msg "Driver Version : $DRV_VERSION" msg "Special Description : $DRV_BUILD_DESC" msg "" if [ "$batch" = 0 ]; then msg "Press ENTER to continue or CTRL-C to exit." read KEY fi case "$OPTION" in restore|uninstall|remove|install|"") ;; *) if [ "$batch" = 1 ]; then errmsg "Unrecognised command line option '$OPTION' (aborting)" exit 1 fi print_logo msg "Unrecognised command line option '$OPTION' (ignoring)" msg "" msg "Press ENTER to continue or CTRL-C to exit." read KEY OPTION="" ;; esac while [ X"$OPTION" = X ]; do print_logo msg "Select from the following options:" msg "" msg " 1. Install driver (default)" msg " 2. Uninstall driver" msg "" msg "Enter reponse [1-2], or CTRL-C to exit" read KEY case $KEY in 2) OPTION="restore" ;; *) OPTION="install" ;; esac done case $OPTION in restore|uninstall|remove) do_uninstall exit 0 ;; esac # Determine XFree86 Directory and Kernel Module directory from user input if [ "$batch" = 1 ]; then set_values check_values ERR=0 else ERR=-1 fi while [ "$ERR" == "-1" ]; do # Determine XFree86 directory print_logo msg "The script will need to copy the DRI XFree86 driver modules to" msg "your XFree86 directory." msg "" msg "The script will use the following XFree86 directory:" msg "" msg " $XF86_DIR" msg "" msg "If this is correct press ENTER, press C to change or CTRL-C to exit." read KEY if [ "$KEY" == "C" ] || [ "$KEY" == "c" ]; then print_logo msg "Please enter the XFree86 directory you would like to use." msg "" msg "Press ENTER when done or CTRL-C to abort." msg "" msg -n "Directory: " read XF86_DIR fi # Determine Kernel module directory print_logo msg "The script also needs to copy the DRM kernel modules to your" msg "kernel module directory." msg "" msg "Please note that only 2.4.x kernels are supported right now." msg "" msg "Kernel Version : $KERNEL_VER" msg "Module Directory : $KERNEL_LIB_DIR" msg "" msg "If this is correct press ENTER, press C to change or CTRL-C to exit." read KEY if [ "$KEY" == "C" ] || [ "$KEY" == "c" ]; then print_logo msg "Please enter your kernel module directory." msg "" msg "Press ENTER when done or CTRL-C to abort." msg "" msg -n "Directory: " read KERNEL_LIB_DIR fi # Determine paths from user input or defaults set_values # Check if values are good check_values ERR="$?" done if [ X"$INSTALL_STAMP" != X ]; then msg "This package is already installed" exit 0 fi get_osname if [ -d kernel-modules/$OS_NAME-$KERNEL_VER ]; then PRECOMP_MODULES=kernel-modules/$OS_NAME-$KERNEL_VER msg "There are pre-compiled modules for your kernel" if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit." read KEY fi if [ "$INSTALL_AGPGART" == "1" ]; then cp -p -f $PRECOMP_MODULES/agpgart.o agpgart/agpgart.o fi cp -p -f $PRECOMP_MODULES/$DRV_MODULE.o drm/$DRV_MODULE.o else # Compile the kernel modules print_logo msg -n "The script will now compile the " if [ "$INSTALL_AGPGART" == "1" ]; then msg -n "agpgart module and " fi msg "DRM kernel modules" msg "for your machine." if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit." read KEY fi msg "" if [ "$INSTALL_AGPGART" == "1" ]; then msg -n "Compiling new agpgart module..." cd agpgart make clean agpgart.o >& ../$LOGFILE_TMP if [ $? != 0 ]; then cat ../$LOGFILE_TMP >> ../$LOGFILE errmsg "" errmsg "" errmsg "ERROR: AGPGART module did not compile" fi cd .. fi msg "" msg -n "Compiling DRM module..." cd drm make -f Makefile.linux clean $DRV_MODULE.o >& ../$LOGFILE_TMP if [ $? != 0 ]; then cat ../$LOGFILE_TMP >> ../$LOGFILE errmsg "" errmsg "" errmsg "ERROR: Kernel modules did not compile" # Check to see if any older DRM module already exists if [ -e $KERNEL_DRM_DIR/$DRV_MODULE.o ]; then msg "" msg "WARNING: The existing DRM kernel module available on your system might" msg "work; however, using an older module may severly limit functionality" msg "or performance!!! It is recommended that you upgrade to the latest" msg "DRM kernel module. For further details see:" msg "" msg " http://dri.sourceforge.net/doc/DRIcompile.html#s4" if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue with the existing kernel module or CTRL-C to exit." read KEY fi USE_EXISTING_KERNEL_MODULE="1" else cd .. errmsg "" errmsg "The DRI drivers can not be installed without the latest kernel modules." errmsg "Installation will be aborted. See the $LOGFILE file for information on" errmsg "what went wrong." errmsg "" exit 127 fi else msg "done" fi cat ../$LOGFILE_TMP >> ../$LOGFILE cd .. fi # Print a last message print_logo msg "The script is now ready to complete the installation." if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit." read KEY fi # Copy files, update config, check config and fix problems print_logo copy_files update_config check_config if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue." read KEY fi # Print last message print_logo msg "The DRI installation is complete." msg "" msg "Restart your X server to try the new DRI drivers." msg "" msg "If you have problems with the DRI after upgrading your drivers" msg "please visit the DRI website and read the Help and FAQ section." msg "The FAQ contains solutions to many common problems." msg "" msg "Report any bugs, problems and comments on the dri-devel mailing list." msg "" msg "Thank you for using the DRI." msg "" @ 1.4 log @add support for building agpgart. Sources must go in extras/agpgart when creating new package. @ text @d9 1 d20 14 d38 44 d84 5 d93 10 d109 10 a118 8 clear echo "" echo "DIRECT RENDERING OPEN SOURCE PROJECT - DRIVER INSTALLATION SCRIPT" echo "" echo "[ http://dri.sourceforge.net ]" echo "" echo "==========================================================================" echo "" d135 3 d140 3 a142 2 XF86_DRI_DIR="$XF86_DIR/lib/modules/dri" XF86_DRV_DIR="$XF86_DIR/lib/modules/drivers" d144 2 a145 2 XF86_EXT_DIR="$XF86_DIR/lib/modules/extensions" XF86_OS_DIR="$XF86_DIR/lib/modules/linux" d147 5 d169 1 a169 1 FATAL="1"; d175 1 a175 1 FATAL="1"; d180 6 a185 1 ERR="1"; d190 1 a190 1 ERR="1"; d193 5 d200 1 a200 1 ERR="1"; d205 1 a205 1 ERR="1"; d210 1 a210 1 ERR="1"; d215 1 a215 1 ERR="1"; d220 1 a220 1 return 0; d224 1 a224 1 if [ "$FATAL" == "1" ]; then d227 1 a227 1 echo "$MSG" d229 1 a229 1 return -1; d232 7 a238 5 #Fix what we can MSG="$MSG"$'\n\nThe script can create these directories for you.\n\nPress ENTER to continue or CTRL-C to abort.' print_logo echo "$MSG" read KEY d242 1 d248 1 d250 92 a341 1 return 0; d350 1 a350 1 echo "Installing files:" d352 7 a358 1 echo -n " DRI XFree86 modules..." d362 5 a366 1 mv -f $XF86_DRV_DIR/$FILE $XF86_DRV_DIR/dri-old.$FILE >& $LOGFILE_TMP; d370 5 a374 1 mv -f $XF86_DRI_DIR/$FILE $XF86_DRI_DIR/dri-old.$FILE >& $LOGFILE_TMP; d377 1 a377 3 cp -f $DRV_NAME/*drv.o $XF86_DRV_DIR cp -f $DRV_NAME/*dri.so $XF86_DRI_DIR echo "done" d379 1 a379 1 echo -n " kernel modules..." d381 1 a381 1 echo "using existing module" a382 1 cd drm d384 15 a398 7 for FILE in *o do mv -f $KERNEL_DRM_DIR/$FILE $KERNEL_DRM_DIR/dri-old.$FILE >& $LOGFILE_TMP; done cd .. cp -f drm/$DRV_MODULE.o $KERNEL_DRM_DIR echo "done" d405 1 a405 1 # mv -f $XF86_GL_DIR/$FILE $XF86_GL_DIR/dri-old.$FILE >& $LOGFILE_TMP; d411 30 a440 13 #echo -n " core libraries..." #mv -f $XF86_EXT_DIR/libdri.a $XF86_EXT_DIR/dri-old.libdri.a >& $LOGFILE_TMP; #cp -f core/libdri.a $XF86_EXT_DIR #mv -f $XF86_EXT_DIR/libglx.a $XF86_EXT_DIR/dri-old.libglx.a >& $LOGFILE_TMP; #cp -f core/libglx.a $XF86_EXT_DIR #mv -f $XF86_EXT_DIR/libGLcore.a $XF86_EXT_DIR/dri-old.libGLcore.a >& $LOGFILE_TMP; #cp -f core/libGLcore.a $XF86_EXT_DIR #mv -f $XF86_OS_DIR/libdrm.a $XF86_OS_DIR/dri-old.libdrm.a >& $LOGFILE_TMP; #cp -f core/libdrm.a $XF86_OS_DIR #echo "done" d443 1 a443 1 echo -n " Executing extras script..." d450 68 a517 43 print_logo echo "Restoring files..." echo -n " XFree86 modules..." cd $DRV_NAME for FILE in *drv.o do mv -f $XF86_DRV_DIR/dri-old.$FILE $XF86_DRV_DIR/$FILE >& $LOGFILE_TMP; done for FILE in *dri.so do mv -f $XF86_DRI_DIR/dri-old.$FILE $XF86_DRI_DIR/$FILE >& $LOGFILE_TMP; done cd .. echo "done" echo -n " kernel modules..." cd drm for FILE in *o do mv -f $KERNEL_DRM_DIR/dri-old.$FILE $KERNEL_DRM_DIR/$FILE >& $LOGFILE_TMP; done cd .. echo "done" #echo -n " system libraries..." #cd GL #for FILE in * #do # mv -f $XF86_GL_DIR/dri-old.$FILE $XF86_GL_DIR/$FILE >& $LOGFILE_TMP; #done #cd .. #echo "done" #echo -n " core libraries..." #mv -f $XF86_EXT_DIR/dri-old.libdri.a $XF86_EXT_DIR/libdri.a >& $LOGFILE_TMP; #mv -f $XF86_EXT_DIR/dri-old.libglx.a $XF86_EXT_DIR/libglx.a >& $LOGFILE_TMP; #mv -f $XF86_EXT_DIR/dri-old.libGLcore.a $XF86_EXT_DIR/libGLcore.a >& $LOGFILE_TMP; #mv -f $XF86_OS_DIR/dri-old.libdrm.a $XF86_OS_DIR/libdrm.a >& $LOGFILE_TMP; #echo "done" echo "" echo "Completed restoring files." d526 2 a527 2 echo "" echo "Updating configuration:" d536 1 a536 1 # echo "ERROR"; d539 1 a539 1 # echo "done"; d549 1 a549 1 echo -n " Removing old kernel module \"$MOD\"..." d551 9 d562 2 a563 2 echo "ERROR" ERR=1; d565 1 a565 1 echo "done"; d570 1 a570 1 echo -n " Inserting new kernel module \"$MOD\"..." d572 8 d583 2 a584 2 echo "ERROR" ERR=1; d586 1 a586 1 echo "done"; d589 2 a590 2 cat $LOGFILE_TMP >> $LOGFILE; done; d594 3 a596 3 echo "" echo "There were errors updating the system configuration." echo "See the $LOGFILE file for more information."; d599 1 a599 1 rm $LOGFILE_TMP d608 2 a609 2 echo "" echo -n "Checking configuration..." d625 2 a626 2 # ln -s $XF86_GL_DIR/libGL.so.1 $LIBGL1; # ln -s $XF86_GL_DIR/libGL.so $LIBGL; d637 2 a638 2 #ln -s $XF86_GL_DIR/libGLU.so.1.3 $XF86_GL_DIR/libGLU.so; #ln -s $XF86_GL_DIR/libGLU.so.1.3 $XF86_GL_DIR/libGLU.so.1; d640 265 a904 1 echo "done" d913 2 a914 2 echo "Could not locate 'pkginfo' file. Aborting." exit 127; d918 3 a920 3 if [ `whoami` != "root" ] && [ `whoami` != "ROOT" ]; then echo "You must be root to install the DRI drivers." exit 127; d923 21 a943 5 # Check if ed is installed which ed &> /dev/null if [ "$?" != "0" ]; then echo "Could not located 'ed' editor. Aborting." exit 127; a947 30 # Figure out if we should restore files if [ "$OPTION" == "restore" ]; then print_logo echo "This will restore your previous files." echo "" echo "XFree86 Dir : $XF86_DIR" echo "Kernel Module Dir : $KERNEL_LIB_DIR" echo "" echo "Press ENTER to restore files or C to change defaults." read KEY if [ "$KEY" == "C" ] || [ "$KEY" == "c" ]; then print_logo echo "Enter new values and then press ENTER." echo "" echo -n "XFree86 Dir : " read XF86_DIR echo -n "Kernel Module Dir : " read KERNEL_LIB_DIR echo "" echo "Press ENTER to restore files." read KEY; fi set_values restore_files echo ""; exit 0; fi d954 21 a974 13 echo "WARNING: YOUR X SERVER SEEMS TO BE RUNNING!" echo "" echo "The script can not update your kernel modules while the X server is running." echo "" echo "You can do one of the following:" echo "" echo "1. Log out of your X session now and then run this script." echo "" echo "2. Run the script now and restart your computer after the installation." echo " If you exit your X session now you will not have to restart." echo "" echo "Press ENTER to continue or CTRL-C to exit." read KEY ; d976 1 a976 1 X_RUNNING=0; d980 1 a980 1 rm $LOGFILE d988 62 a1049 17 echo "Welcome to the DRI Driver Installation Script" echo "" echo "The package you downloaded is for the following driver: " echo "" echo "Driver Name : $DRV_NAME" echo "Description : $DRV_DESC" echo "Architecture : $DRV_ARCH" echo "Build Date : $DRV_DATE" echo "Kernel Module : $DRV_MODULE" echo "" echo "Optional Information" echo "" echo "Driver Version : $DRV_VERSION" echo "Special Description : $DRV_BUILD_DESC" echo "" echo "Press ENTER to continue or CTRL-C to exit." read KEY d1052 8 a1059 1 ERR=-1; d1064 8 a1071 8 echo "The script will need to copy the DRI XFree86 driver modules to" echo "your XFree86 directory." echo "" echo "The script will use the following XFree86 directory:" echo "" echo " $XF86_DIR" echo "" echo "If this is correct press ENTER, press C to change or CTRL-C to exit." d1076 6 a1081 6 echo "Please enter the XFree86 directory you would like to use." echo "" echo "Press ENTER when done or CTRL-C to abort." echo "" echo -n "Directory: " read XF86_DIR ; d1086 9 a1094 9 echo "The script also needs to copy the DRM kernel modules to your" echo "kernel module directory." echo "" echo "Please note that only 2.4.x kernels are supported right now." echo "" echo "Kernel Version : $KERNEL_VER" echo "Module Directory : $KERNEL_LIB_DIR" echo "" echo "If this is correct press ENTER, press C to change or CTRL-C to exit." d1099 6 a1104 6 echo "Please enter your kernel module directory." echo "" echo "Press ENTER when done or CTRL-C to abort." echo "" echo -n "Directory: " read KERNEL_LIB_DIR ; d1112 1 a1112 1 ERR="$?"; d1115 30 a1144 28 # Compile the kernel modules print_logo echo "The script will now compile the DRM kernel modules for your machine." echo "" echo "Press ENTER to continue or CTRL-C to exit." read KEY echo "" echo -n "Compiling..." cd drm make -f Makefile.linux $DRV_MODULE.o >& ../$LOGFILE_TMP if [ $? != 0 ]; then cat ../$LOGFILE_TMP >> ../$LOGFILE echo "" echo "" echo "ERROR: Kernel modules did not compile" # Check to see if any older DRM module already exists if [ -e $KERNEL_DRM_DIR/$DRV_MODULE.o ]; then echo "" echo "WARNING: The existing DRM kernel module available on your system might" echo "work; however, using an older module may severly limit functionality" echo "or performance!!! It is recommended that you upgrade to the latest" echo "DRM kernel module. For further details see:" echo "" echo " http://dri.sourceforge.net/doc/DRIcompile.html#s4" echo "" echo "Press ENTER to continue with the existing kernel module or CTRL-C to exit." d1146 13 a1158 2 USE_EXISTING_KERNEL_MODULE="1" else d1160 41 a1200 9 echo "" echo "The DRI drivers can not be installed without the latest kernel modules." echo "Installation will be aborted. See the $LOGFILE file for information on" echo "what went wrong." echo "" exit 127; fi else echo "done"; a1201 2 cat ../$LOGFILE_TMP >> ../$LOGFILE cd .. d1205 6 a1210 4 echo "The script is now ready to complete the installation." echo "" echo "Press ENTER to continue or CTRL-C to exit." read KEY d1219 5 a1223 3 echo "" echo "Press ENTER to continue." read KEY d1227 12 a1238 12 echo "The DRI installation is complete." echo "" echo "Restart your X server to try the new DRI drivers." echo "" echo "If you have problems with the DRI after upgrading your drivers" echo "please visit the DRI website and read the Help and FAQ section." echo "The FAQ contains solutions to many common problems." echo "" echo "Report any bugs, problems and comments on the dri-devel mailing list." echo "" echo "Thank you for using the DRI." echo "" @ 1.4.4.1 log @Packaging and install script enhancements: - make the package contents easier to configure - allow the package name to be set from the command line - prompt for install vs uninstall - add a batch mode for non-interactive installation - keep track of some state to allow more reliable uninstalling without losing original files. - when the package has been installed more than once, allow any number of installs to be rolled back + misc cleanups @ text @a8 1 # David Dawes a18 14 SAVE_PREFIX="" SAVE_SUFFIX=".dri-old" VARDB="/var/lib" DB_DIR="$VARDB/dripkg" INSTALLATIONS="$DB_DIR/installations" INSTALLED_FILES="$DB_DIR/files" PREVIOUS_FILES="$DB_DIR/prevfiles" UNINSTALL_SCRIPT="$DB_DIR/uninstall" ORIGINAL_FILES="$INSTALLED_FILES-orig" CURRENT_FILES="$INSTALLED_FILES-current" REQUIRED_UTILS="ed awk sort md5sum" a22 40 DIST_NAME="unknown" OS_NAME=`uname -s` LOGO_HEADLINE="DIRECT RENDERING OPEN SOURCE PROJECT" LOGO_URL="http://dri.sourceforge.net" # TODO: Add options to allow the kernel and XFree86 directories to be specified # from the command line? # Parse the command line ARGS=`getopt bfv "$@@"` eval set -- "$ARGS" batch=0 force=0 verbose=0 while true; do case "$1" in -b) batch=1 shift ;; -f) force=1 shift ;; -v) verbose=1 shift ;; --) shift break ;; esac done a24 5 # Default to install in batch mode if [ "$batch" = 1 -a X"$OPTION" = X ]; then OPTION=install fi a28 10 msg() { if [ $batch = 0 -o $verbose = 1 ]; then echo "$@@" fi } errmsg() { echo "$@@" } d35 8 a42 10 if [ "$batch" = 0 ]; then clear msg "" msg "$LOGO_HEADLINE - DRIVER INSTALLATION SCRIPT" msg "" msg "[ $LOGO_URL ]" msg "" msg "==========================================================================" fi msg "" a58 3 if [ -f installinfo ]; then INSTALL_STAMP=`echo "1 p" | ed -s installinfo` fi d61 2 a62 3 XF86_MOD_DIR="$XF86_DIR/lib/modules" XF86_DRI_DIR="$XF86_MOD_DIR/dri" XF86_DRV_DIR="$XF86_MOD_DIR/drivers" d64 2 a65 2 XF86_EXT_DIR="$XF86_MOD_DIR/extensions" XF86_OS_DIR="$XF86_MOD_DIR/linux" a66 5 KERNEL_AGPGART_DIR="$KERNEL_LIB_DIR/kernel/drivers/char/agp" INSTALL_AGPGART="0" if [ -d agpgart ]; then INSTALL_AGPGART="1" fi d84 1 a84 1 FATAL="1" d90 1 a90 1 FATAL="1" d95 1 a95 6 ERR="1" fi if [ ! -d "$KERNEL_AGPGART_DIR" ]; then MSG="$MSG"$'\n - Kernel AGPGART directory does not exist' ERR="1" d100 1 a100 1 ERR="1" a102 5 if [ ! -d "$XF86_MOD_DIR" ]; then MSG="$MSG"$'\n - XFree86 modules directory does not exist' ERR="1" fi d105 1 a105 1 ERR="1" d110 1 a110 1 ERR="1" d115 1 a115 1 ERR="1" d120 1 a120 1 ERR="1" d125 1 a125 1 return 0 d129 1 a129 1 if [ "$FATAL" == "1" -a "$batch" = 0 ]; then d132 1 a132 1 errmsg "$MSG" d134 1 a134 1 return -1 d137 5 a141 7 if [ "$batch" = 0 ]; then #Fix what we can MSG="$MSG"$'\n\nThe script can create these directories for you.\n\nPress ENTER to continue or CTRL-C to abort.' print_logo msg "$MSG" read KEY fi a144 1 mkdir -p $XF86_MOD_DIR a149 1 mkdir -p $KERNEL_AGPGART_DIR d151 1 a151 92 return 0 } get_osname() { if [ -f /etc/redhat-release ]; then DIST_NAME="redhat" VER=`awk '{ print $5 }' < /etc/redhat-release` DIST_NAME="$DIST_NAME-$VER" return 0 fi if [ -f /etc/SuSE-release ]; then DIST_NAME="suse" VER=`grep VERSION /etc/SuSE-release | awk '{ print $3 }'` DIST_NAME="$DIST_NAME-$VER" return 0 fi } add_stamp() { if [ ! -f $INSTALLATIONS ]; then touch $INSTALLATIONS fi if grep -q $INSTALL_STAMP $INSTALLATIONS; then : else echo "$INSTALL_STAMP" >> $INSTALLATIONS fi } install_file() { srcfile=`basename $1` target="$2/$srcfile" save="$2/$SAVE_PREFIX$srcfile$SUFFIX" orig="$2/$SAVE_PREFIX$srcfile$SAVE_SUFFIX" remove="$2/$SAVE_PREFIX$srcfile$SAVE_SUFFIX:remove" add_stamp if [ -e $target ]; then if [ ! -e $orig -a ! -e $remove ]; then if [ -f $ORIGINAL_FILES ]; then rm -f $ORIGINAL_FILES.tmp grep -v $target $ORIGINAL_FILES > \ $ORIGINAL_FILES.tmp mv -f $ORIGINAL_FILES.tmp $ORIGINAL_FILES fi md5sum $target >> $ORIGINAL_FILES fi md5sum $target >> $PREVIOUS_FILES rm -f $save mv $target $save >& $LOGFILE_TMP echo "test -e $save && mv -f $save $target" >> \ $UNINSTALL_SCRIPT if [ ! -e $orig -a ! -e $remove ]; then ln $save $orig echo "rm -f $orig" >> $UNINSTALL_SCRIPT fi else rm -f $save echo "rm -f $target" >> $UNINSTALL_SCRIPT if [ ! -e $orig -a ! -e $remove ]; then touch $remove echo "rm -f $remove" >> $UNINSTALL_SCRIPT if [ -f $ORIGINAL_FILES ]; then rm -f $ORIGINAL_FILES.tmp grep -v $target $ORIGINAL_FILES > \ $ORIGINAL_FILES.tmp mv -f $ORIGINAL_FILES.tmp $ORIGINAL_FILES fi echo "remove $target" >> $ORIGINAL_FILES fi echo "remove $target" >> $PREVIOUS_FILES fi if [ -e $target ]; then echo "Failed to save file $target" return 1 fi if cp $1 $target; then md5sum $target >> $INSTALLED_FILES if [ -f $CURRENT_FILES ]; then rm -f $CURRENT_FILES.tmp grep -v $target $CURRENT_FILES > $CURRENT_FILES.tmp mv -f $CURRENT_FILES.tmp $CURRENT_FILES fi md5sum $target >> $CURRENT_FILES else echo "Failed to install file $target" return 1 fi return 0 d160 1 a160 1 msg "Installing files:" d162 1 a162 7 INSTALL_STAMP=`date "+%Y%m%d%H%M%S"` SUFFIX="$SAVE_SUFFIX-$INSTALL_STAMP" INSTALLED_FILES="$INSTALLED_FILES-$INSTALL_STAMP" UNINSTALL_SCRIPT="$UNINSTALL_SCRIPT-$INSTALL_STAMP" PREVIOUS_FILES="$PREVIOUS_FILES-$INSTALL_STAMP" msg -n " DRI XFree86 modules..." d166 1 a166 5 if install_file $FILE $XF86_DRV_DIR; then : OK else INSTALL_FAILED=1 fi d170 1 a170 5 if install_file $FILE $XF86_DRI_DIR; then : OK else INSTALL_FAILED=1 fi d173 3 a175 1 msg "done" d177 1 a177 1 msg -n " kernel modules..." d179 1 a179 1 msg "using existing module" d181 1 d183 7 a189 15 if install_file drm/$DRV_MODULE.o $KERNEL_DRM_DIR; then : OK else INSTALL_FAILED=1 fi if [ "$INSTALL_AGPGART" == "1" ]; then mkdir -p $KERNEL_AGPGART_DIR if install_file agpgart/agpgart.o $KERNEL_AGPGART_DIR; then : OK else INSTALL_FAILED=1 fi fi msg "done" d192 23 a214 61 if [ -d GL ]; then msg -n " GL libraries..." for FILE in GL/*; do if [ -e $FILE ]; then if install_file $FILE $XF86_GL_DIR; then : OK else INSTALL_FAILED=1 fi fi done msg "done" fi if [ -d core/extensions ]; then msg -n " extension modules..." for FILE in core/extensions/*; do if [ -e $FILE ]; then if install_file $FILE $XF86_EXT_DIR; then : OK else INSTALL_FAILED=1 fi fi done msg "done" fi if [ -d core/os ]; then msg -n " OS-specific server modules..." for FILE in core/os/*; do if [ -e $FILE ]; then if install_file $FILE $XF86_OS_DIR; then : OK else INSTALL_FAILED=1 fi fi done msg "done" fi if [ -d core/misc ]; then msg -n " Misc server modules..." for FILE in core/misc/*; do if [ -e $FILE ]; then if install_file $FILE $XF86_MOD_DIR; then : OK else INSTALL_FAILED=1 fi fi done msg "done" fi if [ "$INSTALL_FAILED" = 1 ]; then errmsg "The installation of one or more files failed" else msg "done" fi d217 1 a217 1 msg -n " Executing extras script..." d224 43 a266 68 # Restoring to the original state is handled a little differently # from the other cases in the interests of maximising the chance # of getting back to that state. if [ $1 = orig ]; then msg "Restoring original files..." FILES="`awk '{ print $2 }' < $ORIGINAL_FILES`" for FILE in $FILES; do dir=`dirname $FILE` base=`basename $FILE` save=$dir/$SAVE_PREFIX$base$SAVE_SUFFIX if [ -e $save ]; then #msg "Restoring $FILE" mv -f $save $FILE else if [ -e $save-remove ]; then #msg "Removing $FILE" rm -f $FILE fi fi #msg Removing $save-* rm -f $save-* done rm -f $CURRENT_FILES rm -f $ORIGINAL_FILES rm -f $PREVIOUS_FILES* rm -f $INSTALLED_FILES* rm -f $INSTALLATIONS rm -f $UNINSTALL_SCRIPT* else msg "Uninstalling installation $1..." if [ -f $UNINSTALL_SCRIPT-$1 ]; then $SHELL $UNINSTALL_SCRIPT-$1 rm -f $PREVIOUS_FILES-$1 rm -f $UNINSTALL_SCRIPT-$1 FILES="`awk '{ print $2 }' < $INSTALLED_FILES-$1`" for FILE in $FILES; do dir=`dirname $FILE` base=`basename $FILE` orig=$dir/$SAVE_PREFIX$base$SAVE_SUFFIX if [ -f $CURRENT_FILES ]; then rm -f $CURRENT_FILES.tmp grep -v $FILE $CURRENT_FILES > \ $CURRENT_FILES.tmp mv -f $CURRENT_FILES.tmp $CURRENT_FILES fi if [ -e $FILE ]; then md5sum $FILE >> $CURRENT_FILES fi if [ ! -e $orig -a ! -e $orig-remove ]; then rm -f $ORIGINAL_FILES.tmp grep -v $orig $ORIGINAL_FILES > \ $ORIGINAL_FILES.tmp mv -f $ORIGINAL_FILES.tmp \ $ORIGINAL_FILES fi done rm -f $INSTALLED_FILES-$1 if [ -f $INSTALLATIONS ]; then rm -f $INSTALLATIONS.tmp grep -v $1 $INSTALLATIONS > $INSTALLATIONS.tmp mv -f $INSTALLATIONS.tmp $INSTALLATIONS fi else errmsg "Cannot find the uninstall script $UNINSTALL_SCRIPT-$1" return 1 fi fi d275 2 a276 2 msg "" msg "Updating configuration:" d285 1 a285 1 # echo "ERROR" d288 1 a288 1 # echo "done" d298 1 a298 1 msg -n " Removing old kernel module \"$MOD\"..." a299 9 if [ $? != 0 ]; then msg "ERROR" ERR=1 else msg "done" fi msg -n " Removing old kernel module \"agpgart\"..." /sbin/modprobe -r agpgart >& $LOGFILE_TMP d302 2 a303 2 msg "ERROR" ERR=1 d305 1 a305 1 msg "done" d310 1 a310 1 msg -n " Inserting new kernel module \"agpgart\"..." a311 8 if [ $? != 0 ]; then msg "ERROR" ERR=1 else msg "done" fi msg -n " Inserting new kernel module \"$MOD\"..." d315 2 a316 2 msg "ERROR" ERR=1 d318 1 a318 1 msg "done" d321 2 a322 2 cat $LOGFILE_TMP >> $LOGFILE done d326 3 a328 3 errmsg "" errmsg "There were errors updating the system configuration." errmsg "See the $LOGFILE file for more information." d331 1 a331 1 rm -f $LOGFILE_TMP d340 2 a341 2 msg "" msg -n "Checking configuration..." d357 2 a358 2 # ln -s $XF86_GL_DIR/libGL.so.1 $LIBGL1 # ln -s $XF86_GL_DIR/libGL.so $LIBGL d369 2 a370 2 #ln -s $XF86_GL_DIR/libGLU.so.1.3 $XF86_GL_DIR/libGLU.so #ln -s $XF86_GL_DIR/libGLU.so.1.3 $XF86_GL_DIR/libGLU.so.1 d372 1 a372 265 msg "done" } verify_files() { if [ $1 = orig ]; then PREVLIST="$ORIGINAL_FILES" SUFFIX="$SAVE_SUFFIX" FILELIST="$CURRENT_FILES" else FILELIST="$INSTALLED_FILES-$1" SUFFIX="$SAVE_SUFFIX-$1" PREVLIST="$PREVIOUS_FILES-$1" fi # First, verify that the saved copies match FILES="`awk '{ print $2 }' < $PREVLIST`" NOEXIST="" NOMATCH="" for FILE in $FILES; do SAVESUM="`grep $FILE $PREVLIST | awk '{ print $1 }'`" dir=`dirname $FILE` base=`basename $FILE` save=$dir/$SAVE_PREFIX$base$SUFFIX if [ -e $save ]; then CURSUM="`md5sum $save | awk '{ print $1 }'`" else CURSUM="remove" fi if [ X"$CURSUM" != X"$SAVESUM" ]; then if [ X"$CURSUM" = Xremove ]; then NOEXIST="$NOEXIST $save" else NOMATCH="$NOMATCH $save" fi fi done if [ X"$NOMATCH" != X ]; then errmsg "" errmsg "The following saved files don't match the recorded md5 signatures:" for f in $NOMATCH; do errmsg " $f" done fi if [ X"$NOEXIST" != X ]; then errmsg "" errmsg "The following saved files are missing:" for f in $NOEXIST; do errmsg " $f" done fi msg "" if [ X"$NOMATCH$NOEXIST" != X ]; then return 2 fi # Now verify that the installed file matches NOMATCH="" for FILE in $FILES; do SAVESUM="`grep $FILE $FILELIST | awk '{ print $1 }'`" CURSUM="`md5sum $FILE | awk '{ print $1 }'`" if [ X"$CURSUM" != X"$SAVESUM" ]; then NOMATCH="$NOMATCH $FILE" fi done if [ X"$NOMATCH" != X ]; then errmsg "" errmsg "The following saved files don't match the recorded md5 signatures:" for f in $NOMATCH; do errmsg " $f" done errmsg "" return 1 fi return 0 } do_uninstall() { print_logo if [ ! -f $INSTALLATIONS ]; then errmsg "No previous installations were found." exit 0 fi INST_LIST="`sort $INSTALLATIONS`" if [ X"$INST_LIST" = X ]; then errmsg "No previous installations were found." exit 0 fi msg "The following installation states have been found:" msg "" i=0 msg -n " 0. Original files" for INST in $INST_LIST; do i=`expr $i + 1` msg "" msg -n " $i. $INST" done msg " (current state)" msg "" msg "This script can attempt to revert to any of the previous" msg "states listed. In doing so, it will remove all versions" msg "installed after the specified state. Selecting 0 will remove" msg "all previous installations. Selecting $i will do nothing since" msg "that is the current state. The default is `expr $i - 1`, which" msg "will back out the most recent installation." msg "" msg -n "Enter the state you wish to revert to [0-$i]: " KEY="" while [ X$KEY = X ]; do if [ "$batch" = 0 ]; then read KEY fi case "$KEY" in "") KEY=`expr $i - 1` ;; [0-9]|[0-9][0-9]|[0-9][0-9][0-9]) if [ $KEY -lt 0 -o $KEY -gt $i ]; then KEY="" fi ;; *) KEY="" ;; esac if [ X$KEY = X ]; then msg "Bad response." msg -n "Please enter a number in the range [0-$i]: " fi done case "$KEY" in 0) msg "All previous installations will be removed." REMOVE_ALL=1 ;; $i) msg "The current state was selected. Nothing to do." exit 0 ;; *) j=0 REMOVE_LIST="" msg "" msg "The following installations will be removed:" for INST in $INST_LIST; do j=`expr $j + 1` if [ $j -gt $KEY ]; then REMOVE_LIST="$REMOVE_LIST $INST" msg " $INST" fi done esac if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit" read KEY fi set_values if [ "$REMOVE_ALL" = 1 ]; then verify_files orig case $? in 0) if restore_files orig; then msg "Successfully restored original state." fi ;; 1) msg "One of more of the files doesn't match the most recently installed" msg "version. This usually means that some other mechanism has installed" msg "a new version since this installation script was last used." if [ "$batch" = 1 -a "$force" = 0 ]; then errmsg "Aborting" exit 1 fi msg "It is possible to continue with this uninstallation process, but" msg "be aware that it may interfere with some other packaging mechanism." if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit" read KEY fi if restore_files orig; then msg "Successfully restored original state." fi ;; *) errmsg "One or more of the files required to restore the original version" errmsg "is either missing or doesn't match the recorded md5 signatures." errmsg "" if [ "$force" = 0 ]; then errmsg "Aborting" exit 1 fi if restore_files orig; then msg "Successfully restored original state." fi ;; esac else n=`echo $REMOVE_LIST | wc -w | sed 's/ *//'` while [ $n -ne 0 ]; do REMOVEID=`echo $REMOVE_LIST | awk '{ print $'$n' }'` msg "Removing $REMOVEID..." verify_files $REMOVEID case $? in 0) if restore_files $REMOVEID; then msg "Successfully uninstalled the $REMOVEID installation" else errmsg "Uninstalling the $REMOVEID installation failed." msg "Either try to revert to a later installation, or back to the original version." exit 1 fi ;; 1) errmsg "One or more of the files doesn't match the installed version about to be" errmsg "removed. This usually means that some other mechanism has installed" errmsg "a new version since this then." if [ "$batch" = 1 -a "$force" = 0 ]; then errmsg "Aborting" exit 1 fi msg "It is possible to continue with this uninstallation process, but" msg "be aware that it may interfere with some other packaging mechanism." if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit" read KEY fi if restore_files $REMOVEID; then msg "Successfully uninstalled the $REMOVEID installation." else errmsg "Uninstalling the $REMOVEID installation failed." msg "Either try to revert to a later installation, or back to the original version." exit 1 fi ;; *) errmsg "One or more of the files required to uninstall the $REMOVEID installation." errmsg "is either missing or doesn't match the recorded signatures." errmsg "" errmsg "Uninstalling the $REMOVEID installation failed." msg "Either try to revert to a later installation, or back to the original version." msg "" errmsg "Aborting" exit 1 ;; esac n=`expr $n - 1` done fi msg "" d381 2 a382 2 errmsg "Could not locate 'pkginfo' file. Aborting." exit 127 d386 3 a388 3 if [ `id -u` != "0" ]; then errmsg "You must be root to install the DRI drivers." exit 127 d391 5 a395 21 # Check if the required utilities are available MISSING_UTILS="" for UTIL in $REQUIRED_UTILS; do if which $UTIL &> /dev/null; then : OK else MISSING_UTILS="$MISSING_UTILS $UTIL" fi if [ X"$MISSING_UTILS" != X ]; then errmsg "Could not locate some required utilities:$MISSING_UTILS" errmsg "Aborting" exit 127 fi done if [ ! -d $DB_DIR ]; then mkdir -p $DB_DIR if [ ! -d $DB_DIR ]; then errmsg "Cannot create directory $DB_DIR" exit 127 fi d400 30 d436 13 a448 21 errmsg "WARNING: YOUR X SERVER SEEMS TO BE RUNNING!" errmsg "" errmsg "The script can not update your kernel modules while the X server is running." errmsg "" errmsg "You can do one of the following:" errmsg "" errmsg "1. Log out of your X session now and then run this script." errmsg "" errmsg "2. Run the script now and restart your computer after the installation." errmsg " If you exit your X session now you will not have to restart." if [ "$batch" = 1 -a "$force" = 0 ]; then errmsg "Aborting" exit 1 fi if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit." read KEY fi d450 1 a450 1 X_RUNNING=0 d454 1 a454 1 rm -f $LOGFILE d462 17 a478 62 msg "Welcome to the DRI Driver Installation Script" msg "" msg "The package you downloaded is for the following driver: " msg "" msg "Driver Name : $DRV_NAME" msg "Description : $DRV_DESC" msg "Architecture : $DRV_ARCH" msg "Build Date : $DRV_DATE" msg "Kernel Module : $DRV_MODULE" msg "" msg "Optional Information" msg "" msg "Driver Version : $DRV_VERSION" msg "Special Description : $DRV_BUILD_DESC" msg "" if [ "$batch" = 0 ]; then msg "Press ENTER to continue or CTRL-C to exit." read KEY fi case "$OPTION" in restore|uninstall|remove|install|"") ;; *) if [ "$batch" = 1 ]; then errmsg "Unrecognised command line option '$OPTION' (aborting)" exit 1 fi print_logo msg "Unrecognised command line option '$OPTION' (ignoring)" msg "" msg "Press ENTER to continue or CTRL-C to exit." read KEY OPTION="" ;; esac while [ X"$OPTION" = X ]; do print_logo msg "Select from the following options:" msg "" msg " 1. Install driver (default)" msg " 2. Uninstall driver" msg "" msg "Enter reponse [1-2], or CTRL-C to exit" read KEY case $KEY in 2) OPTION="restore" ;; *) OPTION="install" ;; esac done case $OPTION in restore|uninstall|remove) do_uninstall exit 0 ;; esac d481 1 a481 8 if [ "$batch" = 1 ]; then set_values check_values ERR=0 else ERR=-1 fi d486 8 a493 8 msg "The script will need to copy the DRI XFree86 driver modules to" msg "your XFree86 directory." msg "" msg "The script will use the following XFree86 directory:" msg "" msg " $XF86_DIR" msg "" msg "If this is correct press ENTER, press C to change or CTRL-C to exit." d498 6 a503 6 msg "Please enter the XFree86 directory you would like to use." msg "" msg "Press ENTER when done or CTRL-C to abort." msg "" msg -n "Directory: " read XF86_DIR d508 9 a516 9 msg "The script also needs to copy the DRM kernel modules to your" msg "kernel module directory." msg "" msg "Please note that only 2.4.x kernels are supported right now." msg "" msg "Kernel Version : $KERNEL_VER" msg "Module Directory : $KERNEL_LIB_DIR" msg "" msg "If this is correct press ENTER, press C to change or CTRL-C to exit." d521 6 a526 6 msg "Please enter your kernel module directory." msg "" msg "Press ENTER when done or CTRL-C to abort." msg "" msg -n "Directory: " read KERNEL_LIB_DIR d534 1 a534 1 ERR="$?" d537 28 a564 12 if [ X"$INSTALL_STAMP" != X ]; then msg "This package is already installed" exit 0 fi get_osname if [ -d kernel-modules/$DIST_NAME-$KERNEL_VER ]; then PRECOMP_MODULES=kernel-modules/$DIST_NAME-$KERNEL_VER msg "There are pre-compiled modules for your kernel" if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit." d566 10 a575 5 fi if [ "$INSTALL_AGPGART" == "1" ]; then cp -p -f $PRECOMP_MODULES/agpgart.o agpgart/agpgart.o fi cp -p -f $PRECOMP_MODULES/$DRV_MODULE.o drm/$DRV_MODULE.o d577 1 a577 67 # Compile the kernel modules print_logo msg -n "The script will now compile the " if [ "$INSTALL_AGPGART" == "1" ]; then msg -n "agpgart module and " fi msg "DRM kernel modules" msg "for your machine." if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit." read KEY fi msg "" if [ "$INSTALL_AGPGART" == "1" ]; then msg -n "Compiling new agpgart module..." cd agpgart make clean agpgart.o >& ../$LOGFILE_TMP if [ $? != 0 ]; then cat ../$LOGFILE_TMP >> ../$LOGFILE errmsg "" errmsg "" errmsg "ERROR: AGPGART module did not compile" fi cd .. fi msg "" msg -n "Compiling DRM module..." cd drm make -f Makefile.linux clean $DRV_MODULE.o >& ../$LOGFILE_TMP if [ $? != 0 ]; then cat ../$LOGFILE_TMP >> ../$LOGFILE errmsg "" errmsg "" errmsg "ERROR: Kernel modules did not compile" # Check to see if any older DRM module already exists if [ -e $KERNEL_DRM_DIR/$DRV_MODULE.o ]; then msg "" msg "WARNING: The existing DRM kernel module available on your system might" msg "work; however, using an older module may severly limit functionality" msg "or performance!!! It is recommended that you upgrade to the latest" msg "DRM kernel module. For further details see:" msg "" msg " http://dri.sourceforge.net/doc/DRIcompile.html#s4" if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue with the existing kernel module or CTRL-C to exit." read KEY fi USE_EXISTING_KERNEL_MODULE="1" else cd .. errmsg "" errmsg "The DRI drivers can not be installed without the latest kernel modules." errmsg "Installation will be aborted. See the $LOGFILE file for information on" errmsg "what went wrong." errmsg "" exit 127 fi else msg "done" fi cat ../$LOGFILE_TMP >> ../$LOGFILE cd .. d579 2 d584 4 a587 6 msg "The script is now ready to complete the installation." if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue or CTRL-C to exit." read KEY fi d596 3 a598 5 if [ "$batch" = 0 ]; then msg "" msg "Press ENTER to continue." read KEY fi d602 12 a613 12 msg "The DRI installation is complete." msg "" msg "Restart your X server to try the new DRI drivers." msg "" msg "If you have problems with the DRI after upgrading your drivers" msg "please visit the DRI website and read the Help and FAQ section." msg "The FAQ contains solutions to many common problems." msg "" msg "Report any bugs, problems and comments on the dri-devel mailing list." msg "" msg "Thank you for using the DRI." msg "" @ 1.4.4.2 log @- add copyright and licence - move required utility check up to the beginning - make the required utility list more complete - use getopts builtin instead of the getopt utility @ text @d7 1 a7 3 # Authors: # # Frank Worsley a10 24 # Copyright (c) 2002 Frank Worsley # Copyright (c) 2002, 2003 Alan Hourihane # Copyright (c) 2003 David Dawes # ####################################################################### # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation. # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # d32 1 a32 1 REQUIRED_UTILS="awk ed expr md5sum sort wc" a43 15 # Check if the required utilities are available. MISSING_UTILS="" for UTIL in $REQUIRED_UTILS; do if which $UTIL &> /dev/null; then : OK else MISSING_UTILS="$MISSING_UTILS $UTIL" fi if [ X"$MISSING_UTILS" != X ]; then echo "Could not locate some required utilities:$MISSING_UTILS" echo "Aborting" exit 127 fi done d49 4 d57 3 a59 3 while getopts bfv c; do case $c in b) d63 1 a63 1 f) d67 1 a67 1 v) d71 3 a73 3 '?') echo "Unrecognised option: -$c" exit 127 d939 15 @ 1.3 log @Commented out packaging of device indepent files. @ text @d217 1 a217 1 echo -n " Copying extra files..." a218 1 echo "done" @ 1.2 log @Update to allow existing DRM modules to be tried if compilation of new DRM module fails. @ text @d192 23 a214 23 echo -n " GL & GLU libraries..." cd GL for FILE in * do mv -f $XF86_GL_DIR/$FILE $XF86_GL_DIR/dri-old.$FILE >& $LOGFILE_TMP; done cd .. cp -f GL/* $XF86_GL_DIR echo "done" echo -n " core libraries..." mv -f $XF86_EXT_DIR/libdri.a $XF86_EXT_DIR/dri-old.libdri.a >& $LOGFILE_TMP; cp -f core/libdri.a $XF86_EXT_DIR mv -f $XF86_EXT_DIR/libglx.a $XF86_EXT_DIR/dri-old.libglx.a >& $LOGFILE_TMP; cp -f core/libglx.a $XF86_EXT_DIR mv -f $XF86_EXT_DIR/libGLcore.a $XF86_EXT_DIR/dri-old.libGLcore.a >& $LOGFILE_TMP; cp -f core/libGLcore.a $XF86_EXT_DIR mv -f $XF86_OS_DIR/libdrm.a $XF86_OS_DIR/dri-old.libdrm.a >& $LOGFILE_TMP; cp -f core/libdrm.a $XF86_OS_DIR echo "done" d250 15 a264 15 echo -n " system libraries..." cd GL for FILE in * do mv -f $XF86_GL_DIR/dri-old.$FILE $XF86_GL_DIR/$FILE >& $LOGFILE_TMP; done cd .. echo "done" echo -n " core libraries..." mv -f $XF86_EXT_DIR/dri-old.libdri.a $XF86_EXT_DIR/libdri.a >& $LOGFILE_TMP; mv -f $XF86_EXT_DIR/dri-old.libglx.a $XF86_EXT_DIR/libglx.a >& $LOGFILE_TMP; mv -f $XF86_EXT_DIR/dri-old.libGLcore.a $XF86_EXT_DIR/libGLcore.a >& $LOGFILE_TMP; mv -f $XF86_OS_DIR/dri-old.libdrm.a $XF86_OS_DIR/libdrm.a >& $LOGFILE_TMP; echo "done" d279 13 a291 13 echo -n " Running ldconfig..." grep "$XF86_DIR" /etc/ld.so.conf >& $LOGFILE_TMP if [ $? != 0 ]; then echo "$XF86_DIR/lib" >> /etc/ld.so.conf fi /sbin/ldconfig >& $LOGFILE_TMP if [ $? != 0 ]; then echo "ERROR"; ERR=1 else echo "done"; fi cat $LOGFILE_TMP >> $LOGFILE d345 16 a360 16 LIBGL1=`ldd $XF86_DIR/bin/glxinfo | grep libGL.so.1 | awk -F" " '{ printf "%s",$3 }'` LIBGL=`echo $LIBGL1 | sed -e 's/\.1//'` if [ "$LIBGL" != "$XF86_GL_DIR/libGL.so" ]; then echo "" echo -n " second copy of DRI libraries found in " echo `echo $LIBGL1 | sed -e 's/libGL.so.1//'` echo -n " libraries have been backed up to old.* in " echo `echo $LIBGL1 | sed -e 's/libGL.so.1//'` echo "" mv $LIBGL1 `echo $LIBGL1 | sed -e 's/libGL.so.1/old.libGL.so.1/'` mv $LIBGL `echo $LIBGL | sed -e 's/libGL.so/old.libGL.so/'` ln -s $XF86_GL_DIR/libGL.so.1 $LIBGL1; ln -s $XF86_GL_DIR/libGL.so $LIBGL; fi d363 9 a371 9 rm -f $XF86_GL_DIR/libGL.so rm -f $XF86_GL_DIR/libGL.so.1 ln -s $XF86_GL_DIR/libGL.so.1.2 $XF86_GL_DIR/libGL.so ln -s $XF86_GL_DIR/libGL.so.1.2 $XF86_GL_DIR/libGL.so.1 rm -f $XF86_GL_DIR/libGLU.so rm -f $XF86_GL_DIR/libGLU.so.1 ln -s $XF86_GL_DIR/libGLU.so.1.3 $XF86_GL_DIR/libGLU.so; ln -s $XF86_GL_DIR/libGLU.so.1.3 $XF86_GL_DIR/libGLU.so.1; @ 1.1 log @Initial revision @ text @d67 1 d178 13 a190 9 cd drm mkdir -p $KERNEL_DRM_DIR for FILE in *o do mv -f $KERNEL_DRM_DIR/$FILE $KERNEL_DRM_DIR/dri-old.$FILE >& $LOGFILE_TMP; done cd .. cp -f drm/$DRV_MODULE.o $KERNEL_DRM_DIR echo "done" d551 1 a551 1 cd .. d554 23 a576 6 echo "" echo "The DRI drivers can not be installed without the latest kernel modules." echo "Installation will be aborted. See the $LOGFILE file for information on" echo "what went wrong." echo "" exit 127; @ 1.1.1.1 log @Import of DRI install and packaging scripts @ text @@