📄 stafinst
字号:
if [ "$TCPOPTION" = "IPV4_IPV6" ] then TCPDIR="IPv6" else TCPDIR="IPv4" fi SRCFILE="$TARGET_PATH/lib/$TCPDIR/libSTAF$SUFFIX" ALIASFILE="$TARGET_PATH/lib/libSTAF$SUFFIX" [ "$VERBOSE" = "YES" ] && echo "Creating link $ALIASFILE to $SRCFILE..." Exec "$LINK $SRCFILE $ALIASFILE" && \ echo "$REMV $ALIASFILE >/dev/null 2>&1" >> $UNINST_FILE SRCFILE="$TARGET_PATH/lib/$TCPDIR/libSTAFTCP$SUFFIX" ALIASFILE="$TARGET_PATH/lib/libSTAFTCP$SUFFIX" [ "$VERBOSE" = "YES" ] && echo "Creating link $ALIASFILE to $SRCFILE..." Exec "$LINK $SRCFILE $ALIASFILE" && \ echo "$REMV $ALIASFILE >/dev/null 2>&1" >> $UNINST_FILE [ "$LIB_PATH" != "" ] && \ SRCFILE="$TARGET_PATH/lib/libSTAF$SUFFIX" && \ ALIASFILE="$LIB_PATH/libSTAF$SUFFIX" && \ Exec "$LINK $SRCFILE $ALIASFILE" && \ echo "$REMV $ALIASFILE >/dev/null 2>&1" >> $UNINST_FILE && \ SRCFILE="$TARGET_PATH/lib/libSTAFTCP$SUFFIX" && \ ALIASFILE="$LIB_PATH/libSTAFTCP$SUFFIX" && \ Exec "$LINK $SRCFILE $ALIASFILE" && \ echo "$REMV $ALIASFILE >/dev/null 2>&1" >> $UNINST_FILE return 0}###############################################################################Register() { [ "$REGISTR" = "NO" ] && return 0 [ "$VERBOSE" = "YES" ] && echo "Writing registration file ..." [ "$PREVIEW" = "YES" ] && return 0 echo "name: "$NAME > $REGINF_FILE echo "email: "$MAIL >> $REGINF_FILE echo "org: "$ORGN >> $REGINF_FILE return 0}###############################################################################CreateScript() { OS=`uname` if [ "$OS" = "Linux" ] then LIBPATHVAR=LD_LIBRARY_PATH elif [ "$OS" = "AIX" ] then LIBPATHVAR=LIBPATH elif [ "$OS" = "HP-UX" ] then LIBPATHVAR=SHLIB_PATH elif [ "$OS" = "OS/390" ] then LIBPATHVAR=LIBPATH elif [ "$OS" = "SunOS" ] then LIBPATHVAR=LD_LIBRARY_PATH elif [ "$OS" = "FreeBSD" ] then LIBPATHVAR=LD_LIBRARY_PATH else LIBPATHVAR=LIBPATH fi echo '#!/bin/sh' > $SH_FILE echo '# STAF environment variables' >> $SH_FILE echo 'PATH='$TARGET_PATH'/bin:$PATH' >> $SH_FILE echo $LIBPATHVAR'='$TARGET_PATH'/lib:$'$LIBPATHVAR >> $SH_FILE echo 'CLASSPATH='$TARGET_PATH'/lib/JSTAF.jar:'$TARGET_PATH'/samples/demo/STAFDemo.jar:$CLASSPATH' >> $SH_FILE echo 'STAFCONVDIR='$TARGET_PATH'/codepage' >> $SH_FILE echo 'if [ $# = 0 ]' >> $SH_FILE echo 'then' >> $SH_FILE echo ' STAF_INSTANCE_NAME=STAF' >> $SH_FILE echo 'else' >> $SH_FILE echo ' STAF_INSTANCE_NAME=$1' >> $SH_FILE echo 'fi' >> $SH_FILE echo 'export PATH' $LIBPATHVAR 'CLASSPATH STAFCONVDIR STAF_INSTANCE_NAME' >> $SH_FILE}################################################################################ ENTRY - parse options and values, bail on failure###############################################################################OPTNAME="name"OPTMAIL="email"OPTORGN="org"###############################################################################while [ $# -gt 0 ]do case "$1" in -source|-s) [ -z "$2" ] && Bail "-source option needs an argument, source path" SOURCE_PATH="$2" shift;; -target|-t) [ -z "$2" ] && Bail "-target option needs an argument, target path" [ -z "$2" ] && 2="/usr/local/staf" TARGET_PATH="$2" shift;; -bin|-b) [ -z "$2" ] && Bail "-bin option needs an argument, bin directory" BIN_PATH="$2" shift;; -lib|-l) [ -z "$2" ] && Bail "-lib option needs an argument, lib directory" LIB_PATH="$2" shift;; -type) [ -z "$2" ] && \ Bail "-type option needs an argument from" \ " m|r|f" [ "$2" != "f" -a "$2" != "r" -a "$2" != "m" ] && \ Bail "-type option has unknown value, must use one of" \ " m|r|f" [ "$2" = "f" ] && \ INSTALL_SET="FULL" [ "$2" = "r" ] && \ INSTALL_SET="RECM" [ "$2" = "m" ] && \ INSTALL_SET="MINM" shift;; -ro) [ -z "$2" ] && Bail "-ro option needs an argument, permission bits" RO_PERM="$2" shift;; -rw) [ -z "$2" ] && Bail "-rw option needs an argument, permission bits" RW_PERM="$2" shift;; -rx) [ -z "$2" ] && Bail "-rx option needs an argument, permission bits" RX_PERM="$2" shift;; -dp) [ -z "$2" ] && Bail "-dp option needs an argument, permission bits" DP_PERM="$2" shift;; -preview) VERBOSE="YES" PREVIEW="YES" ;; -verbose) VERBOSE="YES" ;; -warn) WARNING="END" ;; -noreg) REGISTR="NO" ;; -"$OPTNAME"|-"$OPTMAIL"|-"$OPTORGN") [ "$1" = "-name" ] && OPTION="name" [ "$1" = "-email" ] && OPTION="email" [ "$1" = "-org" ] && OPTION="org" [ -z "$2" ] && \ Bail "-$OPTION option needs an argument, your $OPTION" [ "$REGISTR" = "NO" ] && \ Bail "-$OPTION cannot be used if -noreg has been specified" REGISTR="YES" [ "$OPTION" = "$OPTNAME" ] && NAME="$2" [ "$OPTION" = "$OPTMAIL" ] && MAIL="$2" [ "$OPTION" = "$OPTORGN" ] && ORGN="$2" shift;; -acceptlicense) ACCEPTLICENSE="YES" ;; -option) OPTION="$2" if [ "$OPTION" = "TCP=IPV4" ] then TCPOPTION="IPV4" elif [ "$OPTION" = "TCP=IPV4_IPV6" ] then TCPOPTION="IPV4_IPV6" fi shift;; -*) Usage ;; esac shiftdone################################################################################ check that all required conditions are met or bail with error message###############################################################################[ ! -d "$SOURCE_PATH" ] && \Bail "Directory $SOURCE_PATH does not exist"###############################################################################[ "$SOURCE_PATH" = "$TARGET_PATH" ] && \echo "The STAF tar.gz installer file should be untarred into a " && \echo "temporary directory from which you run the STAFInst command." && \echo "This temporary directory (the source directory) cannot be" && \echo "the same as the target directory ($TARGET_PATH)." && \Bail "Source and target directories are the same"[ "$SOURCE_PATH" = "." ] &&\[ "$PWD" = "$TARGET_PATH" ] && \echo "The STAF tar.gz installer file should be untarred into a " && \echo "temporary directory from which you run the STAFInst command." && \echo "This temporary directory (the source directory) cannot be" && \echo "the same as the target directory ($TARGET_PATH)." && \Bail "Source and target directories are the same."###############################################################################[ -f "$TARGET_PATH/bin/STAFProc" ] && \echo "If you are migrating to a new release of STAF or " && \echo "reinstalling STAF, please copy your STAF.cfg file " && \echo "to a safe location and then run $TARGET_PATH/STAFUninst. " && \echo "Then execute STAFInst again." && \Bail "STAF is already installed"###############################################################################MANFST_PATH="$SOURCE_PATH"/"$MANFST_FILE"[ ! -f "$MANFST_PATH" ] && \[ ! -f ./"$MANFST_FILE" ] && Bail "couldn't find $MANFST_FILE"###############################################################################REGINF_FILE=$TARGET_PATH/$REGINF_FILEREGCMP_FILE=$TARGET_PATH/$REGCMP_FILEUNINST_FILE=$TARGET_PATH/$UNINST_FILESH_FILE=$TARGET_PATH/$SH_FILE###############################################################################DisplayLicense && CreateUninstall && DoInstall && HandleOptions && CloseUninstall && Register && CreateScript###############################################################################
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -