📄 install.ksh
字号:
#!/usr/bin/ksh# The contents of this file are subject to the Interbase Public# License Version 1.0 (the "License"); you may not use this file# except in compliance with the License. You may obtain a copy# of the License at http://www.Inprise.com/IPL.html## Software distributed under the License is distributed on an# "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express# or implied. See the License for the specific language governing# rights and limitations under the License.## The Original Code was created by Inprise Corporation# and its predecessors. Portions created by Inprise Corporation are# Copyright (C) Inprise Corporation.## All Rights Reserved.# Contributor(s): ______________________________________.## Install script for UNIX InterBase software## Copyright (c)1998,1999, InterBase Software Corporation# All Rights Reserved#############################################################################PATH=$PATH:/usr/ucb:/usr/bsd:/bin:/usr/binexport PATHSHLIB_PATH=/usr/libexport SHLIB_PATHLogFile="ibinstall.log"TmpLogFile="/tmp/$LogFile"DefaultInstDir="/opt"IBSymLink="/usr/interbase"SUPERSERVER=""#Note: TarFile must contain the absolute path nameTarFile=""ExitError(){echo "\n*** Install completed with errors ***" | tee -a $TmpLogFileecho "Install log can be found at $TmpLogFile"exit 1}ExitSuccess(){echo "\nInstall completed successfully" | tee -a $INTERBASE/$LogFileecho "Install log can be found at $INTERBASE/$LogFile"exit 0}Quit(){echo "\nInstall is not complete." | tee -a $TmpLogFileecho "You may run the install at a later time to complete the installation." | tee -a $TmpLogFileecho "Install log can be found at $TmpLogFile"exit 2}CheckInstallDir(){if [ ! -z "$1" ]; then if [ ! -d "$1" ]; then while true; do echo "\nDirectory \"$IBINSTALL\" does not exist." | tee -a $TmpLogFile echo "Do you want to create it now? (default: y) [y, n, q] : \c" | tee -a $TmpLogFile read response echo "$response" >> $TmpLogFile case $response in y|Y|yes|Yes|YES|"" ) mkdir -p $IBINSTALL echo "\nmkdir -p $IBINSTALL" >> $TmpLogFile break;; n|N|no|NO|No ) IBINSTALL="" break;; q|Q|quit|Quit|QUIT ) Quit;; * ) echo "\nERROR: Invalid response, expected \"y\", \"n\" or \"q\"" | tee -a $TmpLogFile ;; esac done else if [ -d "$1/interbase" ]; then while true; do echo "\nDirectory \"$IBINSTALL/interbase\" already exists." | tee -a $TmpLogFile echo "Do you want to continue? (default: n) [y, n, q] : \c" | tee -a $TmpLogFile read response echo "$response" >> $TmpLogFile case $response in y|Y|yes|Yes|YES ) break;; n|N|no|NO|No|"" ) IBINSTALL="" break;; q|Q|quit|Quit|QUIT ) Quit;; * ) echo "\nERROR: Invalid response, expected \"y\", \"n\" or \"q\"" | tee -a $TmpLogFile ;; esac done fi fifi}GetInstallDir(){while [ -z "$IBINSTALL" ] ; do echo "\nEnter the absolute path name of the install directory" | tee -a $TmpLogFile echo "[$DefaultInstDir] : \c" | tee -a $TmpLogFile read inst_dir echo "$inst_dir" >> $TmpLogFile case $inst_dir in "" ) IBINSTALL="$DefaultInstDir";; /* ) IBINSTALL="$inst_dir";; * ) echo "\nERROR: The specified pathname \"$inst_dir\" is not the absolute." | tee -a $TmpLogFile echo " Please try again." | tee -a $TmpLogFile continue;; esac CheckInstallDir $IBINSTALL if [ -z "$IBINSTALL" ]; then continue fidone}## Main entry#if [ -f $TmpLogFile ]; then mv $TmpLogFile $TmpLogFile.old echo "Old $TmpLogFile moved to $TmpLogFile.old\n" >> $TmpLogFilefiecho "***********************************************" >> $TmpLogFileecho "InterBase Install in progress" >> $TmpLogFileecho "`date`" >> $TmpLogFileecho "***********************************************" >> $TmpLogFileif [ "`whoami`" != "root" ]; then echo "ERROR: No permissions to perform operation." | tee -a $TmpLogFile echo " Log in as root and try again." | tee -a $TmpLogFile ExitErrorfiif [ -f /bin/ps ]; then PS="/bin/ps -ef"else if [ -f /usr/ucb/ps ]; then PS="/usr/ucb/ps -ax" else PS="ps -ef" fifi ibserver=`$PS|grep ibserver|grep -c -v grep`gds_inet_server=`$PS|grep gds_inet_server|grep -c -v grep`if [ $ibserver -ne 0 -o $gds_inet_server -ne 0 ]; then echo "ERROR: Detected another Interbase server running on the system." | tee -a $TmpLogFile echo " Shutdown the InterBase server and try again." | tee -a $TmpLogFile ExitErrorfiif [ $# -gt 2 ]; then echo "ERROR: too many parameters." | tee -a $TmpLogFile echo "Usage: $0 [-c | -s] AbsolutePathOfTheTarFile" | tee -a $TmpLogFile ExitErrorfifor i in $1 $2 ; do case $i in -c | -C ) SUPERSERVER="";; -s | -S ) SUPERSERVER="SUPERSERVER";; * ) TarFile="$i";; esacdoneif [ -z "$TarFile" ]; then echo "ERROR: Syntax error, expected archive file." | tee -a $TmpLogFile echo "Usage: $0 [-c | -s] AbsolutePathOfTheTarFile" | tee -a $TmpLogFile ExitErrorfiif [ -z "$IBINSTALL" ]; then GetInstallDirelse case "$IBINSTALL" in /* ) CheckInstallDir $IBINSTALL if [ -z "$IBINSTALL" ]; then GetInstallDir fi ;; * ) echo "ERROR: The specified pathname \"$IBINSTALL\" is not the absolute." IBINSTALL="" GetInstallDir;; esacficd $IBINSTALLif [ ! -f $TarFile ]; then echo "ERROR: File \"$TarFile\" not found." | tee -a $TmpLogFile ExitErrorfiINTERBASE="$IBINSTALL/interbase"## Extract files from a tar archive#echo "----------------------------\n" >> $TmpLogFileecho "\nExtracting files" >> $TmpLogFileecho "\nExtracting files... \c"tar vxf $TarFile >> $TmpLogFile 2>&1if [ $? -ne 0 ]; then echo "ERROR: Can't extract the files from the archive." | tee -a $TmpLogFile ExitErrorfiecho "Done"echo "----------------------------\n" >> $TmpLogFile## If no switches were specified then set SUPERSERVER depending on the# content of the tar file#if [ $# -ne 2 ]; then if [ -f $INTERBASE/bin/ibserver ]; then SUPERSERVER="SUPERSERVER" else SUPERSERVER="" fifi## Make sure the top level ($INTERBASE) is 777#echo "Updating access permissions... \c"echo "Updating access permissions" >> $TmpLogFilechmod 777 $INTERBASEecho "chmod 777 $INTERBASE" >> $TmpLogFile## Protect security, examples and QLI help databases#if [ "$SUPERSERVER" ]; then chmod uog=rw $INTERBASE/isc4.gdb chmod uog=rw $INTERBASE/help/help.gdb chmod uog=rw $INTERBASE/examples/employee.gdb chmod uog=rw $INTERBASE/examples/intlemp.gdb chmod 4755 $INTERBASE/bin/gstat echo "chmod uog=rw $INTERBASE/isc4.gdb" >> $TmpLogFile
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -