grass5.4.0_i686-pc-linux-gnu_install.sh

来自「地理资源分析支援系统grass是在1982到1995年由许多美国联邦机构、大学及」· Shell 代码 · 共 448 行

SH
448
字号
#!/bin/sh############################################################################ Generated from the binaryInstall.src file using the command make bindist#  # GRASS 5 binary package installation tool# platform independent## $Id: binaryInstall.src,v 1.17 2004/01/05 10:26:24 paul Exp $# 1999-2000 by Markus Neteler, neteler@itc.it############################################################################ Set a zero size variable for testing if this file is a source file. Note# that the make bindist command will change this line to TEST_STR = executable# without the spaces surrounding the equal signTEST_STR=executable# Use a text string for sed to recognize to insert the proper versionNAME_VER=54ORIG_BASE_DIR='/usr/local/grass54'TAR_FILE_SIZE=12515224# Set the default BINDIR and DESTDIR directoriesBINDIR=/usr/local/binDESTDIR=/usr/local/grass$NAME_VERUNINSTALL=grass${NAME_VER}uninstall.sh# Check if this is a source file or notif [ -z "$TEST_STR" ] ; then    echo "This is a source script, not an executable script which can be run."    exitfi# Check for first parameter:if [ $# -lt 1 -o "$1" = "-h" -o "$1" = "-help" ] ; then    echo "GRASS GIS $NAME_VER binary package installation toolUsage:	sh grass5install.sh grass_binpackage.tar.gz [dest_dir] [bin_dir]      with:        grass_binpackage : name of GRASS $NAME_VER binary package           [dest_dir] - optional: FULL path name to the installation directory                     (default: /usr/local/grass$NAME_VER/)        [bin_dir] - optional: FULL path name to the grass binary directory                     (default: /usr/local/bin/)		     Notes: 1) Only the grass executable file is stored here		     	    2) If you want to change the binary directory only			       then you need to specify the destination			       directory as wellYou may need login as root for installation."    exitfi# Check for second parameter:if [ "$2" ] ; then    DESTDIR=$2fi# Check for third parameter:if [ "$3" ] ; then    BINDIR=$3fi# Print out script identification messageecho ""echo "GRASS GIS $NAME_VER binary package installation tool"echo ""# Check for correct package name:if [ ! -f $1 ] ; then     echo "ERROR: Wrong package name $1 (file does not exist)"    echo ""    exitfi# Obtain the package name and pathCURR_DIR=`pwd`PACKAGE_NAME=`basename $1`PACKAGE_DIR=`dirname $1`# the dirname command uses . and .. if found so we need the absolute pathcd $PACKAGE_DIRPACKAGE_DIR=`pwd`# Check if package is first parameter and in gz or bz2 compression:# is package in .tar.gz format?echo $PACKAGE_NAME | grep "tar\.gz" > /dev/nullif [ $? -eq 0 ] ; then    UNPACK=gunzip    	    # Is gunzip there?    IFSSAVE="$IFS"    IFS=":"    GUNZIP=""    for TEST in $PATH ; do        if [ -x $TEST/gunzip ] ; then	    GUNZIP="$TEST/gunzip"	fi    done    # which gunzip | grep -v no > /dev/null    IFS="$IFSSAVE"    if [ ! "$GUNZIP" ] ; then        echo "No gunzip installed. Please get from:"        echo "   http://www.gnu.org/software/gzip/gzip.html"        exit    fielse    # not in .tar.gz format, perhaps in .tar.bz2 format?    echo $PACKAGE_NAME | grep "tar\.bz2" > /dev/null    if [ $? -eq 0 ] ; then        UNPACK=bunzip2            # Is bunzip2 there?        IFSSAVE="$IFS"        IFS=":"        BUNZIP2=""        for TEST in $PATH ; do            if [ -x $TEST/bunzip2 ] ; then	        BUNZIP2="$TEST/bunzip2"	    fi        done        IFS="$IFSSAVE"        # which bunzip2 | grep -v no > /dev/null        if [ ! "$BUNZIP2" ] ; then    	    echo "No bunzip2 installed. Please get from:"    	    echo "   http://sources.redhat.com/bzip2/index.html"    	    exit        fi    else        # not in .tar.gz or .tar.bz2 format, completely wrong!        echo "ERROR: You need the GRASS binary package in .tar.gz compression "        echo "or .tar.bz2."        echo ""        exit    fifi# Check if the size of the tar gzip file is the same as what was on the serverSIZE=`ls -l $PACKAGE_NAME | tr -s " " | cut -d" " -f5`if [ $? -ne 0 ] ; then    echo "ERROR while installing binaries!"    echo "Exiting."    exitfiif [ $SIZE -ne $TAR_FILE_SIZE ] ; then    echo "ERROR: The size of the binary package is not correct."    echo "  Perhaps there was a transmission error. Please download"    echo "  the package again"    echo ""    exitfiecho "Using $UNPACK decompressor..."echo "The package $PACKAGE_NAME seems to be o.k."echo " Proceeding..."echo ""# Check if the paths for the binary and the destination are the sameBIN_PATH1=$BINDIR/grass$NAME_VERBIN_PATH2=$BIN_PATH1/if [ $BIN_PATH1 = $DESTDIR -o $BIN_PATH2 = $DESTDIR ] ; then    echo "ERROR:"    echo "It appears that the destination directory path is the same as the"    echo "path for the grass binary executable. This results in a name"    echo "conflict between the destination directory and the executable."    echo "Please run this script again with a different path name for the"    echo "destination directory."    exitfi# Check if BINDIR is a directoryif [ ! -d "$BINDIR" ] ; then        # Check if BINDIR is a file    if [ -f "$BINDIR" ] ; then    	echo ""	echo "ERROR: $BINDIR is a file not a directory."	echo "Please specify a directory for the binary executable directory."	exit    fi       mkdir -p $BINDIR        if [ $? -ne 0 ] ; then	echo "An error occured trying to create $BINDIR ! Exiting."	exit    fifi# Check if DESTDIR is appropriateecho "Checking and creating installation directory..."if [ ! -d "$DESTDIR" ] ; then    # Check if a word "grass" is in string $DESTDIR    echo $DESTDIR |grep "grass" > /dev/null        if [ $? -eq 1 ] ; then    	echo "WARNING: Your destination path $DESTDIR does not contain the word 'grass'"        echo "Continue (y/n)?"        read ans                 	if [ "$ans" = "n" -o "$ans" = "N" ] ; then            exit        fi    fi        # Check if DESTDIR is a file    if [ -f "$DESTDIR" ] ; then    	echo ""	echo "ERROR: $DESTDIR is a file not a directory."	echo "Please specify a directory for the destination directory"	exit    fi    mkdir -p $DESTDIR        if [ $? -ne 0 ] ; then    	echo "An error occured trying to create $DESTDIR! Exiting."    	exit    fielse    if [ -d $DESTDIR/bin ] ; then    	echo ""        echo "ERROR: Old GRASS distribution existing in $DESTDIR!"        echo "Remove first!"        exit    else    	# Check if a word "grass" is in string $DESTDIR        echo $DESTDIR | grep "grass" > /dev/null        	if [ $? -eq 1 ] ; then            echo "WARNING: Your destination path $DESTDIR does not contain the word 'grass'"            echo "Continue (y/n)?"            read ans                     	    if [ "$ans" = "n" -o "$ans" = "N" ] ; then            	exit            fi        fi	# Check if DESTDIR is writable	touch $DESTDIR/test$$ > /dev/null	if [ $? -ne 0 ] ; then	    echo "ERROR: Destination directory $DESTDIR is not"	    echo "writable, try installing as root!"	    echo "Exiting."    	    exit 1        fi	rm -f $DESTDIR/test$$ > /dev/null    fi        fi# Start the installation job...echo "Installing GRASS binaries into $DESTDIR"echo ""echo "Uncompressing the package and extracting to target directory..."#for windows/cygwin we have to change // -> / when installing from root:PACK_FILE=`echo "$PACKAGE_DIR/$PACKAGE_NAME" | sed 's+//+/+g'`cd $DESTDIR; $UNPACK -c $PACK_FILE | tar -xf -if [ $? -eq 1 ] ; then    echo "An error occured or user break while installing binaries! Exiting."    exitfi# Get rid of any CVS directoriesfind . -name CVS -exec rm -rf {} \; 2>/dev/null ; truecd $CURR_DIR# Creating start scriptecho "Creating start script: $BINDIR/grass$NAME_VER"#awk '#{#    if ($1 ~ /^GISBASE/)#    	print "GISBASE='$DESTDIR'"#    else#    	print#}' $DESTDIR/grass$NAME_VER > $BINDIR/grass$NAME_VER STRING="s|^GISBASE.*|GISBASE\=\'$DESTDIR\'|g"#check needed to avoid writing to identical file (grass5 script)if [ "$DESTDIR" != "$BINDIR" ]then  sed -e $STRING $DESTDIR/grass$NAME_VER > $BINDIR/grass$NAME_VER  if [ $? -eq 1 ] ; then    echo "An error occured trying to create the grass start script! Exiting."    echo "You probably do not have permission to install into $BINDIR."    echo "You may need to be the root user to install in that directory."    exit  fi  # Remove the source version of the grass executable  rm -f $DESTDIR/grass$NAME_VERelse  sed -e $STRING $DESTDIR/grass$NAME_VER > $BINDIR/grass$NAME_VER.tmp  if [ $? -eq 1 ] ; then    echo "An error occured trying to create the grass start script! Exiting."    echo "You probably do not have permission to install into $BINDIR."    echo "You may need to be the root user to install in that directory."    exit  fi  mv $BINDIR/grass$NAME_VER.tmp $BINDIR/grass$NAME_VERfichmod ugo+x $BINDIR/grass$NAME_VERif [ $? -eq 1 ] ; then    echo "An error occured trying to create the grass start script! Exiting."    echo "You probably do not have permission to install into $BINDIR."    echo "You may need to be the root user to install in that directory."    exitfiecho "Creating the locks directory for monitors..."SERVERNAME=`uname -n | sed -e "s/\..*//"`if [ ! -d $DESTDIR/locks ] ; then    mkdir $DESTDIR/locksfirm -rf $DESTDIR/locks/*mkdir $DESTDIR/locks/$SERVERNAMEchmod -R 1777 $DESTDIR/locksecho "Creating datum transformation gridshift files..."if test -x ${DESTDIR}/etc/nad2bin ; then    NAD2BIN=${DESTDIR}/etc/nad2binelse    # Use version installed with PROJ.4 (should be in path)    NAD2BIN=nad2binfifor i in ${DESTDIR}/etc/nad/src/*.llado     ${NAD2BIN} < $i \    ${DESTDIR}/etc/nad/`echo \`basename $i\` | sed 's/.lla//'` && rm -f $idoneif test -z "`ls ${DESTDIR}/etc/nad/src`" ; then    rmdir ${DESTDIR}/etc/nad/srcfiecho""# Create the binary uninstall scriptcd $BINDIRecho "#!/bin/sh" > $UNINSTALLecho "" >> $UNINSTALLecho "#########################################################" >> $UNINSTALLecho "#" >> $UNINSTALLecho "# GRASS binary package uninstallation tool" >> $UNINSTALLecho "# Platform independent" >> $UNINSTALLecho "# Automatically generated by binary installation script" >> $UNINSTALLecho "#" >> $UNINSTALLecho "#########################################################" >> $UNINSTALLecho "" >> $UNINSTALLecho "RESULT=`echo $DESTDIR | awk '{ if ($1 ~ /grass/) print $1 }'`" >> $UNINSTALLecho "if [ \"\$RESULT\" = \"\" ] ; then" >> $UNINSTALLecho "    echo \"WARNING: Your install directory $DESTDIR\"" >> $UNINSTALLecho "    echo \"  does not contain the word 'grass'.\"" >> $UNINSTALLecho "    echo \"  There is a possibility that this directory conflicts\"" >> $UNINSTALLecho "    echo \"  with a system directory. If you proceed the following\"" >> $UNINSTALLecho "    echo \"  directories will be deleted:\"" >> $UNINSTALLecho "    echo \"  ${DESTDIR}/bin, ${DESTDIR}/bwidget, ${DESTDIR}/dev,\"" >> $UNINSTALLecho "    echo \"  ${DESTDIR}/documents, ${DESTDIR}/driver, ${DESTDIR}/etc,\"" >> $UNINSTALLecho "    echo \"  ${DESTDIR}/fonts, ${DESTDIR}/include, ${DESTDIR}/lib,\"" >> $UNINSTALLecho "    echo \"  ${DESTDIR}/locks, ${DESTDIR}/man, ${DESTDIR}/scripts,\"" >> $UNINSTALLecho "    echo \"  ${DESTDIR}/tcltkgrass, ${DESTDIR}/txt\"" >> $UNINSTALLecho "    echo \"  as well as the file ${BINDIR}/grass${NAME_VER},\"" >> $UNINSTALLecho "    echo \"  Do you want to continue? [y/n]\"" >> $UNINSTALLecho "    read ANS" >> $UNINSTALLecho "    ANS=\`echo \"\$ANS\" | tr A-Z a-z\`" >> $UNINSTALLecho "    if [ \"\$ANS\" != \"y\" ] ; then" >> $UNINSTALL echo "        echo \"Uninstall aborted, exiting.\"" >> $UNINSTALLecho "        exit" >> $UNINSTALLecho "    fi" >> $UNINSTALLecho "else" >> $UNINSTALLecho "    echo \"WARNING: You are about to delete all files in $DESTDIR\"" >> $UNINSTALLecho "    echo \"  as well as the file ${BINDIR}/grass${NAME_VER}.\"" >> $UNINSTALLecho "    echo \"  Do you want to continue? [y/n]\"" >> $UNINSTALLecho "    read ANS" >> $UNINSTALLecho "    ANS=\`echo \"\$ANS\" | tr A-Z a-z\`" >> $UNINSTALLecho "    if [ \"\$ANS\" != \"y\" ] ; then" >> $UNINSTALLecho "        echo \"Uninstall aborted, exiting.\"" >> $UNINSTALLecho "        exit" >> $UNINSTALLecho "    fi" >> $UNINSTALLecho "fi" >> $UNINSTALLecho "" >> $UNINSTALLecho "echo \"\"" >> $UNINSTALLecho "echo \"Removing binary installation...\"" >> $UNINSTALLecho "rm -f ${BINDIR}/grass${NAME_VER}" >> $UNINSTALLecho "rm -f ${DESTDIR}/AUTHORS" >> $UNINSTALLecho "rm -f ${DESTDIR}/BUGS" >> $UNINSTALLecho "rm -f ${DESTDIR}/COPYING" >> $UNINSTALLecho "rm -f ${DESTDIR}/NEWS.html" >> $UNINSTALLecho "rm -f ${DESTDIR}/README" >> $UNINSTALLecho "rm -f ${DESTDIR}/REQUIREMENTS.html" >> $UNINSTALLecho "rm -f ${DESTDIR}/TODO.txt" >> $UNINSTALLecho "rm -f ${BINDIR}/${UNINSTALL}" >> $UNINSTALLecho "rm -rf ${DESTDIR}/bin" >> $UNINSTALLecho "rm -rf ${DESTDIR}/bwidget" >> $UNINSTALLecho "rm -rf ${DESTDIR}/dev" >> $UNINSTALLecho "rm -rf ${DESTDIR}/documents" >> $UNINSTALLecho "rm -rf ${DESTDIR}/driver" >> $UNINSTALLecho "rm -rf ${DESTDIR}/etc" >> $UNINSTALLecho "rm -rf ${DESTDIR}/fonts" >> $UNINSTALLecho "rm -rf ${DESTDIR}/locks" >> $UNINSTALLecho "rm -rf ${DESTDIR}/scripts" >> $UNINSTALLecho "rm -rf ${DESTDIR}/tcltkgrass" >> $UNINSTALLecho "rm -rf ${DESTDIR}/txt" >> $UNINSTALLecho "rm -rf ${DESTDIR}/man" >> $UNINSTALLecho "rm -rf ${DESTDIR}/include" >> $UNINSTALLecho "rm -rf ${DESTDIR}/lib" >> $UNINSTALLecho "rmdir ${DESTDIR}" >> $UNINSTALLecho "" >> $UNINSTALLchmod a+x $UNINSTALLcd $CURR_DIR# Print out some messagesecho "Installation finished. Start GRASS $NAME_VER with"echo "    grass$NAME_VER"echo ""echo "The graphical user interface can be started within GRASS GIS."echo ""echo "You can uninstall grass by typing"echo "    sh $UNINSTALL"echo "in the directory $BINDIR"echo ""echo "Welcome to GRASS GIS. Enjoy this open source GNU GRASS GIS!"echo ""

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?