?? postuninstall.sh
字號:
fi}#------------------------------------------------------------------------# Display message if this is being run interactively.displayMessage() { msgText=$1 if [ ! -z "$InteractiveInstall" ] then echo $msgText fi}#------------------------------------------------------------------------# Archive any existing prior installed files.# The 'cd' stuff is to avoid the "leading '/' removed message from tar.# for the same reason the DestFile is specified without the leading "/"archivePriorInstallSystemFiles() { if [ -z ${ArchiveMainFile} ] then echo "Variable ArchiveMainFile not set - exiting" exit 1 fi oldPWD=`pwd` archiveFileList="" cd / DestFile=${FBRootDir#/} # strip off leading / if [ -e "$DestFile" ] then echo "" echo "" echo "" echo "--- Warning ----------------------------------------------" echo " The installation target directory: $FBRootDir" echo " Already contains a prior installation of InterBase/Firebird." echo " This and files found in /usr/include and /usr/lib will be" echo " archived in the file : ${ArchiveMainFile}" echo "" if [ ! -z "$InteractiveInstall" ] then AskQuestion "Press return to continue or ^C to abort" fi if [ -e $DestFile ] then archiveFileList="$archiveFileList $DestFile" fi fi for i in ibase.h ib_util.h do DestFile=usr/include/$i if [ -e $DestFile ] then archiveFileList="$archiveFileList $DestFile" fi done for i in libib_util.so libfbclient.so* do for DestFile in usr/lib/$i do if [ -e $DestFile ] then archiveFileList="$archiveFileList $DestFile" fi done done# for i in `cat manifest.txt`# do# if [ ! -d /$i ] # Ignore directories # then# if [ -e /$i ]# then# archiveFileList="$archiveFileList $i" # fi# fi# done for i in usr/sbin/rcfirebird etc/init.d/firebird etc/rc.d/init.d/firebird do DestFile=./$i if [ -e /$DestFile ] then archiveFileList="$archiveFileList $DestFile" fi done if [ ! -z "$archiveFileList" ] then displayMessage "Archiving..." runAndCheckExit "tar -czf $ArchiveMainFile $archiveFileList" displayMessage "Done." displayMessage "Deleting..." for i in $archiveFileList do rm -rf $i done displayMessage "Done." fi cd $oldPWD}#------------------------------------------------------------------------# removeInstalledFiles# removeInstalledFiles() { manifestFile=$FBRootDir/misc/manifest.txt if [ ! -f $manifestFile ] then return fi origDir=`pwd` cd / for i in `cat $manifestFile` do if [ -f $i -o -L $i ] then rm -f $i #echo $i fi done cd "$origDir"}#------------------------------------------------------------------------# removeUninstallFiles# Under the install directory remove all the empty directories # If some files remain then removeUninstallFiles() { # remove the uninstall scripts files. #echo $FBRootDir/misc/scripts rm -rf $FBRootDir/misc/scripts rm -f $FBRootDir/misc/manifest.txt rm -f $FBRootDir/bin/uninstall.sh}#------------------------------------------------------------------------# removeEmptyDirs# Under the install directory remove all the empty directories # If some files remain then # This routine loops, since deleting a directory possibly makes# the parent empty as wellremoveEmptyDirs() { dirContentChanged='yes' while [ ! -z $dirContentChanged ] do dirContentChanged='' for i in `find $FBRootDir -empty -type d -print` do rmdir $i dirContentChanged=$i done if [ ! -d $FBRootDir ] # end loop if the FBRootDir was deleted. then dirContentChanged='' fi done}# classicLibrary.sh#!/bin/sh#------------------------------------------------------------------------# init defaultsDefaultLibrary=libfbembed#------------------------------------------------------------------------# fixFilePermissions# Change the permissions to restrict access to server programs to # firebird group only. This is MUCH better from a saftey point of # view than installing as root user, even if it requires a little # more work.fixFilePermissions() { chown -R $RunUser:$RunGroup $FBRootDir # Turn other access off. chmod -R o= $FBRootDir # Now fix up the mess. # fix up directories for i in `find $FBRootDir -print` do FileName=$i if [ -d $FileName ] then chmod o=rx $FileName fi done # set up the defaults for bin cd $FBBin for i in `ls` do chmod ug=rx,o= $i done # User can run these programs, they need to talk to server though. # and they cannot actually create a database. chmod a=rx isql chmod a=rx qli # Root SUID is still needed for group direct access. # General users cannot run though. for i in fb_lock_mgr do if [ -f $i ] then chown root $i chmod ug=rx,o= $i chmod ug+s $i fi done # set up libraries cd $FBRootDir cd lib chmod a=rx lib* # set up include files cd $FBRootDir cd include chmod a=r * # Fix lock files cd $FBRootDir for i in isc_init1 isc_lock1 isc_event1 isc_monitor1 do FileName=$i.`hostname` touch $FileName chown $RunUser:$RunUser $FileName chmod ug=rw,o= $FileName done # Fix the rest touch firebird.log chmod ug=rw,o= firebird.log chmod a=r aliases.conf chmod a=r firebird.conf chmod a=r firebird.msg chmod a=r help/help.fdb chmod ug=rw,o= $SecurityDatabase if [ "$RunUser" = "root" ] # In that case we must open databases to the world... # That's a pity, but required if root RunUser choosen. then chmod a=rw $SecurityDatabase fi # fix up examples' permissions cd examples # set a default of read all files in examples for i in `find . -name '*' -type f -print` do chmod a=r $i done # set a default of read&search all dirs in examples for i in `find . -name '*' -type d -print` do chmod a=rx $i done # make examples db's writable by group for i in `find . -name '*.fdb' -print` do chown $RunUser:$RunUser $i chmod ug=rw,o= $i done # fix up doc permissions fixDocPermissions cd $FBRootDir}#------------------------------------------------------------------------# changeXinetdServiceUser# Change the run user of the xinetd servicechangeXinetdServiceUser() { InitFile=/etc/xinetd.d/firebird if [ -f $InitFile ] then editFile $InitFile user "\tuser\t\t\t= $RunUser" fi}#------------------------------------------------------------------------# Update inetd service entry# This just adds/replaces the service entry lineupdateInetdEntry() { newLine="gds_db stream tcp nowait.30000 $RunUser $FBBin/fb_inet_server fb_inet_server # Firebird Database Remote Server" replaceLineInFile /etc/inetd.conf "$newLine" "^gds_db"}#------------------------------------------------------------------------# Update xinetd service entryupdateXinetdEntry() { cp $FBRootDir/misc/firebird.xinetd /etc/xinetd.d/firebird changeXinetdServiceUser}#------------------------------------------------------------------------# Update inetd service entry # Check to see if we have xinetd installed or plain inetd. # Install differs for each of them.updateInetdServiceEntry() { if [ -d /etc/xinetd.d ] then updateXinetdEntry else updateInetdEntry fi}#------------------------------------------------------------------------# change init.d RunUserchangeInitRunUser() { # do nothing for CS return 0}#------------------------------------------------------------------------# start init.d servicestartService() { # do nothing for CS return 0}# linuxLibrary.sh#!/bin/shRunUser=firebirdexport RunUserRunGroup=firebirdexport RunGroupPidDir=/var/run/firebirdexport PidDir#------------------------------------------------------------------------# Add new user and groupTryAddGroup() { AdditionalParameter=$1 testStr=`grep firebird /etc/group` if [ -z "$testStr" ] then groupadd $AdditionalParameter firebird fi }TryAddUser() { AdditionalParameter=$1 testStr=`grep firebird /etc/passwd` if [ -z "$testStr" ] then useradd $AdditionalParameter -d $FBRootDir -s /bin/false \ -c "Firebird Database Owner" -g firebird firebird fi}addFirebirdUser() { TryAddGroup "-g 84 -r" >/dev/null 2>&1 TryAddGroup "-g 84" >/dev/null 2>&1 TryAddGroup "-r" >/dev/null 2>&1 TryAddGroup " " TryAddUser "-u 84 -r -M" >/dev/null 2>&1 TryAddUser "-u 84 -M" >/dev/null 2>&1 TryAddUser "-r -M" >/dev/null 2>&1 TryAddUser "-M" TryAddUser "-u 84 -r" >/dev/null 2>&1 TryAddUser "-u 84" >/dev/null 2>&1 TryAddUser "-r" >/dev/null 2>&1 TryAddUser " "}#------------------------------------------------------------------------# Detect Distribution.# AP: very beautiful, but unused. Let's keep alive for a while. (2005)detectDistro() { # it's not provided... if [ -z "$linuxDistro" ] then if [ -e /etc/SuSE-release ] then # SuSE linuxDistro="SuSE" elif [ -e /etc/mandrake-release ] then # Mandrake linuxDistro="MDK" elif [ -e /etc/debian_version ] then # Debian linuxDistro="Debian" elif [ -e /etc/gentoo-release ] then # Debian linuxDistro="Gentoo" elif [ -e /etc/rc.d/init.d/functions ] then # very likely Red Hat linuxDistro="RH" elif [ -d /etc/rc.d/init.d ] then # generic Red Hat linuxDistro="G-RH" elif [ -d /etc/init.d ] then # generic SuSE linuxDistro="G-SuSE" fi fi}#------------------------------------------------------------------------# print location of init scriptgetInitScriptLocation() { if [ -f /etc/rc.d/init.d/firebird ] then echo -n /etc/rc.d/init.d/firebird elif [ -f /etc/rc.d/rc.firebird ] then echo -n /etc/rc.d/rc.firebird elif [ -f /etc/init.d/firebird ] then echo -n /etc/init.d/firebird fi}#------------------------------------------------------------------------# stop super server if it is runningstopSuperServerIfRunning() { checkString=`ps -efww| egrep "\b(fbserver|fbguard)\b" |grep -v grep` if [ ! -z "$checkString" ] then init_d=`getInitScriptLocation` if [ -x "$init_d" ] then $init_d stop fi fi}#!/bin/sh## This library is part of the Firebird project## This library is free software; you can redistribute it and/or# modify it under the terms of the GNU Lesser General Public# License as published by the Free Software Foundation; either# version 2.1 of the License, or (at your option) any later version.# You may obtain a copy of the Licence at# http://www.gnu.org/licences/lgpl.html# # As a special exception this file can also be included in modules# with other source code as long as that source code has been # released under an Open Source Initiative certificed licence. # More information about OSI certification can be found at: # http://www.opensource.org # # This module is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU Lesser General Public Licence for more details.# # This module was created by members of the firebird development # team. All individual contributions remain the Copyright (C) of # those individuals and all rights are reserved. Contributors to # this file are either listed below or can be obtained from a CVS # history command.# # Created by: Mark O'Donohue <mark.odonohue@ludwig.edu.au># # Contributor(s):# # # $Id: postuninstall.sh.in,v 1.4 2005/08/16 10:04:11 alexpeshkoff Exp $# # The post uninstall routine for Firebird Classic.if [ "$1"=0 ] then removeLinksForBackCompatibility removeInetdServiceEntryfi
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -