- 论坛徽章:
- 0
|
诸位大侠,我在Solaris8上安装一个工具软件的时候,在一台Ultra5的机器上可以正确安装,在一台E3500的机器上却在运行./SETUP以后报错:
“expr:语句错
./SETUP:Test:需要参数“
下面是SETUP脚本程序,请看一下会有什麽问题,我对Solaris很陌生,请帮助定位一下问题原因和解决方案。
#!/bin/sh
#
# SETUP - the Tornado Setup and Uninstall script
#
# Copyright 1994-1999 Wind River Systems, Inc.
#
# modification history
# --------------------
# 04n,14mar01,j_w Update setup version to 3.1. Update copyright to
# 1999-2001
# 04m,09jan01,wmd Fix check on OS type for Linux to allow 2.*, 3.* versions
# of the kernel.
# 04l,19dec00,wmd Fix typo.
# 04k,19dec00,wmd Remove setting of KDE env var.
# 04j,20oct00,j_w fixed swap space checking for linux host (spr 35312)
# 04i,16oct00,j_w Added the -F option
# 04h,09jun00,bwd Added another host type check for x86-linux2
# 04g,11feb00,wmd Add more paths to LD_LIBRARY_PATH.
# 04f,14dec99,wmd Make sure that SETUP can take command line arguments.
# 04e,09dec99,wmd Fix so at least 1 parameter can be passed in.
# 04d,17nov99,wmd Fix the LD_LIBRARY_PATH for this file for T3.
# 04c,27oct99,bjl removed font cache check.
# 04b,25oct99,bjl added path to whoami, added TEMP to temp directory list.
# 04a,18oct99,bjl removed unzip of MWUITCL.ZIP, modified temp directory code,
# removed hpux patch checking and support, copy
# libuitclcontrols for uninstall.
# 03i,23apr99,bjl added checking for KDE, do not export MWWM for fvwm.
# 03h,01apr99,wmd Add checking for fvwm and set the env var MWWM to fvwm.
# 03g,25mar99,bjl updated tmp space requirements.
# 03f,24mar99,bjl rename UITclSh.
# 03e,21mar99,bjl removed font cache message.
# 03d,19mar99,wmd Remove the $HOME/windows directory if found, it shouldn't
# be required.
# 03c,17mar99,wmd Need to change copyright to 1999.
# 03b,09mar99,wmd fix so that font caching works, add lines to remove TMP dir.
# 03a,03mar99,wmd update library paths for mainwin 3.1.
# 02z,18feb99,tcy prevent HP10.10 users from running SETUP
# 02y,29jan99,bjl added comments and edited for coding conventions.
# 02x,11jan99,bjl terminate color manager when Setup exits (fixes
# spr 24219, 24273).
# 02w,09dec98,bjl added check for necessary HPUX patch.
# 02v,19nov98,bjl restored to run INSTW32.TCL with $CD_ROOT to quicken
# Setup appearance.
# 02u,17nov98,bjl changed tmp directory to $HOME instead of $HOME/tmp
# (fixes spr 23328, 23327), check that TMPDIR and TMP
# are not set to /tmp.
# 02t,16nov98,bjl added rmtmpdir procedure to display msg if tmp dir removal
# is unsucessful, changed rm to /bin/rm, send rm output
# to /dev/null.
# 02s,12nov98,tcy copy setuptcl library from the CD SETUP directory
# 02r,12nov98,bjl unset MWHOME, export SETUP_UNINST for uninstall.
# 02q,12nov98,bjl merged in UNINST script.
# 02p,11nov98,bjl added swap space checking for MainWin, use TMP or home
# directory for temporary files before using /tmp.
# 02o,27oct98,bjl changed INSTW32.TCL to AUTORUN.TCL.
# 02n,23oct98,bjl added copyright message, modified display message.
# 02m,21oct98,bjl tee font cache creation to prevent logout on hpux.
# 02l,20oct98,bjl do not exec MWWRAPPER so TMP is removed on exit for hpux.
# 02k,19oct98,bjl remove background.
# 02j,15oct98,bjl added disk space checking for parisc-hpux10, removed
# sunos4 and parisc-hpux9 from supported platforms.
# 02i,09oct98,bjl removed preparation of files message.
# 02h,05oct98,bjl changed tar command to unzip.
# 02g,20sep98,bjl use /bin/tar, changed tmp file messages, modified handling of
# font cache.
# 02f,14sep98,bjl added checking of disk space for Solaris.
# 02e,09sep98,bjl unset MWFONT_CACHE_DIR to ensure use of Tornado font cache.
# 02d,08sep98,bjl removed -L and -T options, added font cache and temp file
# messages.
# 02c,04sep98,bjl added WIND_BASE.
# 02b,03sep98,bjl changed tmp to reside under home directory.
# 02a,18aug98,wmd modify for mainwin operation.
# 01k,07oct97,pn fixed the host's version ckecking on SunOs.
# 01j,13jun96,pn started using standard TCL/TK shell, cleanup.
# 01i,04mar96,pn allowed patch CD to contain no TCL interpreter.
# 01h,24feb96,pn fixed the broken pipe problem on hpux machine.
# 01g,18dec96,pn change location of "TCL" to "RESOURCE/TCL" on CD
# 01f,05nov96,pn added support for AIX host.
# 01e,21oct96,pn added -L for installing license manager.
# 01d,30aug96,pn invoked correct tcl file base on install mode.
# 01c,29aug96,pn changed to use tcl7.5 and tk4.1.
# 01b,09aug96,pn Use uppercase for file and directory name.
# 01a,12jul96,jc Written.
#
# SYNOPSIS
# .tS
# SETUP [UNINST <WIND_BASE>;]
# .tE
#
# DESCRIPTION
# This shell script executes Tornado Setup or Uninstall for Unix hosts.
#
# OPTIONS
# .IP "UNINST <WIND_BASE>;"
# Run the Uninstall program. <WIND_BASE>; must be set to the root
# of the Tornado tree that is to be uninstalled.
#
#*/
#############################################################################
#
# Perform necessary initialization.
#
# Read arguments and initialize necessary variables.
INST_TYPE="Software"
INST_MODE=gui
if [ "$2" != "" ]
then
WIND_BASE=$2
fi
UNINSTARG=$1
UI=UITcl
ARGV=""
if [ -d $HOME/windows ]
then
windowsDirExisted=1
else
windowsDirExisted=0
fi
# Determine whether to run Setup or Uninstall.
if [ "$UNINSTARG" = "UNINST" ]
then
uninstall=1
setup_type="UNINST"
SETUP_UNINST=1
elif [ "$UNINSTARG" = "/L" -o "$UNINSTARG" = "-L" ]
then
uninstall=0
ARGV=$*
setup_type="SETUP"
elif [ "$UNINSTARG" = "/T" -o "$UNINSTARG" = "-T" ]
then
uninstall=0
ARGV=$*
setup_type="SETUP"
elif [ "$UNINSTARG" = "/F" -o "$UNINSTARG" = "-F" ]
then
uninstall=0
ARGV=$*
setup_type="SETUP"
else
uninstall=0
setup_type="SETUP"
fi
# Display the Copyright message for a Setup installation.
if [ $uninstall = 0 ]
then
echo "Tornado 3.1 Setup"
echo "Copyright (C) 1999-2001, Wind River Systems, Inc."
echo "All Rights Reserved"
echo ""
fi
# Set the usage message.
if [ $uninstall = 1 ]
then
usage="\nUsage: UNINST <Installed Directory>;"
else
usage="\nUsage: $0"
fi
# Make sure the number of arguments is correct.
if [ $uninstall = 1 ]
then
numargs=2
else
numargs=5
fi
if [ $# -gt $numargs ]
then
echo "$usage"
exit 0
fi
# Check for a valid DISPLAY setting.
if [ "$DISPLAY" = "" -a "$INST_MODE" = "gui" ]; then
echo ""
echo "Warning: The DISPLAY environment variable is not set."
echo " Please set the variable and rerun $setup_type."
echo ""
exit
fi
# Checks for a valid WIND_BASE setting.
if [ $uninstall = 1 ]
then
if [ "$WIND_BASE" = "" -o ! -d "$WIND_BASE" ]
then
echo "$usage"
exit 0
else
ROOT=`pwd`
cd $WIND_BASE
WIND_BASE=`pwd`
cd $ROOT
UNINST_HOME=$WIND_BASE/.wind/uninst
fi
fi
# Obtain the CD Setup root directory.
if [ $uninstall = 1 ]
then
CD_ROOT=$WIND_BASE/SETUP
if [ -d $CD_ROOT ]
then
cd $CD_ROOT
else
echo "UNINST: $CD_ROOT does not exist. Please make sure that"
echo "$WIND_BASE is the root of your Tornado tree."
exit 1
fi
CD_ROOT=`pwd`
else
CD_ROOT=`dirname $0`
cd $CD_ROOT
CD_ROOT=`pwd`
fi
# Determine the host type.
case `/bin/uname -srvm` in
SunOS\ 5.*\ sun4*)
CD_BIN=$CD_ROOT/SUN4/SOLARIS2
WIND_HOST_TYPE=sun4-solaris2
;;
Linux*2.*.*)
CD_BIN=$CD_ROOT/X86/LINUX2
WIND_HOST_TYPE=x86-linux2
;;
*)
echo 1>;&2 "### You are logging in to a platform whose type"
echo 1>;&2 "### is not supported by Tornado."
echo 1>;&2 "### Aborting $setup_type."
exit 0
;;
esac
# Determine whether the MainWin color manager is already running.
if [ "$WIND_HOST_TYPE" = sun4-solaris2 ]
then
currentuser=`/usr/ucb/whoami`
else
currentuser=`/usr/bin/whoami`
fi
colormanager_process=`/bin/ps -u $currentuser | /bin/grep -i mwcolor | \
/bin/awk '{print $1}'`
if [ "$colormanager_process" != "" ]
then
colormgr_already_running=1
else
colormgr_already_running=0
fi
# Determine if the KDE window manager is being used.
windowManager=`/bin/ps -u $currentuser | /bin/grep -i kwm | \
/bin/awk '{print $1}'`
#if [ "$windowManager" != "" ]
#then
# SETUP_USEKDE=1
# export SETUP_USEKDE
#fi
# Determine if the fvwm window manager is being used.
windowManager=`/bin/ps -u $currentuser | /bin/grep -i fvwm | \
/bin/awk '{print $1}'`
if [ "$windowManager" != "" ]
then
SETUP_USEFVWM=1
export SETUP_USEFVWM
fi
##############################################################################
#
# The following commands create a temporary directory needed by Setup and
# Uninstall. The temporary directory is removed after SETUP exits.
#
if [ "$TMPDIR" != "" ]; then
TMP=$TMPDIR/Inst$$
elif [ "$TMP" != "" ]; then
TMP=$TMP/Inst$$
elif [ "$TEMP" != "" ]; then
TMP=$TEMP/Inst$$
else
TMP=/tmp/Inst$$
fi
mkdir -p $TMP || mkdir $TMP || exit 0
# Set a default WIND_BASE if it has not yet been set.
if [ "$WIND_BASE" = "" ]
then
WIND_BASE=/usr/wind
fi
#############################################################################
#
# The following commands check to make sure enough swap space is available
# for MainWin.
#
exit_setup=0
# At least 5 megs of swap space is necessary for MainWin.
necessary_swap_space=5
# Check the amount of swap space available.
if [ "$WIND_HOST_TYPE" = "sun4-solaris2" ]
then
swapfree=`/usr/sbin/swap -s | /bin/awk '{print $11}' | /bin/awk -Fk \
'{print $1}`
swapfree=`/bin/expr $swapfree / 1024`
else
swapfree=`/sbin/swapon -s | /bin/awk '/^\// {used=$4; size=$3; \
free = size - used; print free}'`
swapfree=`/usr/bin/expr $swapfree / 1024`
fi
# Print an error message if not enough swap space is available.
if [ $swapfree -lt $necessary_swap_space ]
then
echo
echo "$setup_type has detected that not enough swap space is available"
echo "to proceed. Please make at least $necessary_swap_space megabytes of"
echo "swap space available and rerun $setup_type."
exit_setup=1
fi
#############################################################################
#
# rmtmpdir - This function removes the $TMP directory. It prints a message
# to the display if removing $TMP is unsuccessful.
#
rmtmpdir () {
if /bin/rm -rf $TMP 2>;/dev/null
then
: # Tmp directory was sucessfully removed
else
echo
echo "Warning: $setup_type has detected that it was not allowed to"
echo "remove all temporary files located in $TMP."
echo "These files are no longer needed by $setup_type and may be"
echo "removed."
echo
fi
}
#############################################################################
#
# killcolormanager - This function kills the MainWin Color Manager
# running in the background.
#
killcolormanager () {
if [ "$WIND_HOST_TYPE" = "sun4-solaris2" ]
then
currentuser=`/usr/ucb/whoami`
else
currentuser=`/usr/bin/whoami`
fi
colormanager_process=`/bin/ps -u $currentuser | /bin/grep -i mwcolor | \
/bin/awk '{print $1}'`
if [ "$colormanager_process" != "" ]
then
if /bin/kill -9 $colormanager_process 2>;/dev/null
then
: # kill was successful
else
echo
echo "Setup has detected that it was not allowed to terminate"
echo "the MainWin Color Manager. This may interfere with ejection"
echo "of the CD-ROM. Please kill the process named"
echo "'mwcolormanager' if the CD-ROM does not eject."
echo
fi
fi
}
###############################################################################
#
# exitsetup - This function is called when Setup exits, whether normally
# or through a trap. It calls the rmtmpdir and killcolormanager
# functions to clean up when SETUP exits. See the 'trap' commands
# below.
#
exitsetup () {
# Kill the color manager only if Setup invoked the color manager.
if [ $colormgr_already_running -ne 1 ]
then
killcolormanager
fi
rmtmpdir
}
if [ $exit_setup -eq 1 ]
then
exitsetup
exit 1
fi
#############################################################################
#
# The following commands determine the Tcl interpreter location and
# the Tcl file to be executed.
#
TRY1_GUI=$CD_BIN/UITclSh
TRY2_GUI=$CD_BIN/host/$WIND_HOST_TYPE/bin/UITclSh
TRY3_GUI=$WIND_BASE/host/$WIND_HOST_TYPE/bin/UITclSh
if [ -f "$TRY1_GUI" ]
then
INSTALL=$TRY1_GUI
elif [ -f "$TRY2_GUI" ]
then
INSTALL=$TRY2_GUI
elif [ -f "$TRY3_GUI" ]
then
INSTALL=$TRY3_GUI
else
echo "${TRY1_GUI}: not found"
echo "${TRY2_GUI}: not found"
echo "${TRY3_GUI}: not found"
echo "WIND_BASE=$WIND_BASE"
exit 1
fi
# Set the correct Tcl file for Setup or Uninstall.
if [ $uninstall = 1 ]
then
TCL_FILE=$UNINST_HOME/UNINST.TCL
else
TCL_FILE=$CD_ROOT/RESOURCE/TCL/INSTW32.TCL
fi
# Set the Tcl file used for creating a font cache.
EMPTY_TCL_FILE=$CD_ROOT/RESOURCE/TCL/EMPTY.TCL
#############################################################################
#
# The following commands set up a trap to call the exitsetup function
# when SETUP exits, even when SETUP is terminated abnormally (for example,
# the user stops SETUP with CTRL-C). The exitsetup function will cause
# Setup to clean up after itself.
#
trap exitsetup 0 1 15
trap "" 2
#############################################################################
#
# The following commands set up the environment variables needed for
# executing SETUP.
#
PATH=${CD_BIN} WIND_BASE/host/$WIND_HOST_TYPE/bin PATH
TCL_LIBRARY=${CD_BIN}/lib/tcl
TK_LIBRARY=${CD_BIN}/lib/tk
if [ "$WIND_HOST_TYPE" = sun4-solaris2 ]
then
LD_LIBRARY_PATH=${CD_BIN} {CD_BIN}/mw/lib-optimized {CD_BIN}/mw/lib-sunos5 LD_LIBRARY_PATH
else
LD_LIBRARY_PATH=${CD_BIN} {CD_BIN}/mw/lib-optimized {CD_BIN}/mw/lib-linux LD_LIBRARY_PATH
fi
# Establish XFILESEARCHPATH.
XFSP=$TMP:
if [ "$XFILESEARCHPATH" != "" ]
then
# Save user's XFILESEARCHPATH so it can be restored for spawned programs.
USER_XFILESEARCHPATH=$XFILESEARCHPATH
export USER_XFILESEARCHPATH
XFILESEARCHPATH=${XFSP}${XFILESEARCHPATH}
else
XFILESEARCHPATH=${XFSP}
fi
# Make sure the Tornado font cache is used.
unset MWFONT_CACHE_DIR
# Make sure the correct MWHOME setting is used for Setup.
unset MWHOME
MWHOME=${CD_BIN}/mw
# This setting removes the Setup background.
SETUP_REMOVEBACKGROUND=1
# Export the necessary variables to the environment.
export SETUP_REMOVEBACKGROUND
export XFILESEARCHPATH
export TCL_LIBRARY
export TK_LIBRARY
export LD_LIBRARY_PATH
export WIND_BASE
export WIND_HOST_TYPE
export PATH
export CD_ROOT
export CD_BIN
export TMP
export MWFONT_CACHE_DIR
export MWHOME
if [ $uninstall = 1 ]
then
export UI
export SETUP_UNINST
fi
# Copy shared libraries to the temp directory for Uninstall.
if [ $uninstall = 1 ]
then
cp $CD_BIN/SETUPTCL.SO $TMP/setuptcl.so
cp $CD_BIN/libuitclcontrols.so $TMP/libuitclcontrols.so
fi
#############################################################################
#
# The following commands execute Setup or Uninstall through MWWRAPPER.
#
if [ $uninstall = 1 ]
then
$CD_ROOT/MWWRAPPER $INSTALL $TCL_FILE $WIND_BASE
else
$CD_ROOT/MWWRAPPER $INSTALL $TCL_FILE $CD_ROOT $ARGV
fi
#############################################################################
#
# Just in case, if the temporary directory exists, remove it
#
if [ -d $TMP ]
then
rmtmpdir
fi
if [ -d $HOME/windows -a $windowsDirExisted = 0 ]
then
rm -fr $HOME/windows
fi
实在感激!!! |
|