| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# |
| 4 |
# This library is part of the FirebirdSQL project |
| 5 |
# |
| 6 |
# This library is free software; you can redistribute it and/or |
| 7 |
# modify it under the terms of the GNU Lesser General Public |
| 8 |
# License as published by the Free Software Foundation; either |
| 9 |
# version 2.1 of the License, or (at your option) any later version. |
| 10 |
# You may obtain a copy of the Licence at |
| 11 |
# http://www.gnu.org/licences/lgpl.html |
| 12 |
# |
| 13 |
# As a special exception this file can also be included in modules |
| 14 |
# with other source code as long as that source code has been |
| 15 |
# released under an Open Source Initiative certificed licence. |
| 16 |
# More information about OSI certification can be found at: |
| 17 |
# http://www.opensource.org |
| 18 |
# |
| 19 |
# This module is distributed in the hope that it will be useful, |
| 20 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
# GNU Lesser General Public Licence for more details. |
| 23 |
# |
| 24 |
# This module was created by members of the firebird development |
| 25 |
# team. All individual contributions remain the Copyright (C) of |
| 26 |
# those individuals and all rights are reserved. Contributors to |
| 27 |
# this file are either listed below or can be obtained from a CVS |
| 28 |
# history command. |
| 29 |
# |
| 30 |
# Created by: Mark O'Donohue <[email protected]> |
| 31 |
# |
| 32 |
# Contributor(s): |
| 33 |
# |
| 34 |
# |
| 35 |
|
| 36 |
# Install script for Firebird database engine |
| 37 |
# http://www.firebirdsql.org |
| 38 |
|
| 39 |
# This is the new file !!! |
| 40 |
|
| 41 |
|
| 42 |
#------------------------------------------------------------------------ |
| 43 |
# Prompt for response, store result in Answer |
| 44 |
|
| 45 |
Answer="" |
| 46 |
|
| 47 |
AskQuestion() { |
| 48 |
Test=$1 |
| 49 |
DefaultAns=$2 |
| 50 |
echo -n "${1}" |
| 51 |
Answer="$DefaultAns" |
| 52 |
read Answer |
| 53 |
} |
| 54 |
|
| 55 |
#------------------------------------------------------------------------ |
| 56 |
# Prompt for yes or no answer - returns non-zero for no |
| 57 |
|
| 58 |
AskYNQuestion() { |
| 59 |
while echo -n "${*} (y/n): " |
| 60 |
do |
| 61 |
read answer rest |
| 62 |
case $answer in |
| 63 |
[yY]*) |
| 64 |
return 0 |
| 65 |
;; |
| 66 |
[nN]*) |
| 67 |
return 1 |
| 68 |
;; |
| 69 |
*) |
| 70 |
echo "Please answer y or n" |
| 71 |
;; |
| 72 |
esac |
| 73 |
done |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
#------------------------------------------------------------------------ |
| 78 |
# Run process and check status |
| 79 |
|
| 80 |
|
| 81 |
runAndCheckExit() { |
| 82 |
Cmd=$* |
| 83 |
|
| 84 |
# echo $Cmd |
| 85 |
$Cmd |
| 86 |
|
| 87 |
ExitCode=$? |
| 88 |
|
| 89 |
if [ $ExitCode -ne 0 ] |
| 90 |
then |
| 91 |
echo "Uninstall aborted: The command $Cmd " |
| 92 |
echo " failed with error code $ExitCode" |
| 93 |
exit |
| 94 |
fi |
| 95 |
} |
| 96 |
|
| 97 |
#------------------------------------------------------------------------ |
| 98 |
# Check for a previous install |
| 99 |
|
| 100 |
|
| 101 |
checkInstallUser() { |
| 102 |
|
| 103 |
if [ "`whoami`" != "root" ]; |
| 104 |
then |
| 105 |
echo "" |
| 106 |
echo "--- Warning ----------------------------------------------" |
| 107 |
echo "" |
| 108 |
echo " You need to be 'root' user to run uninstall" |
| 109 |
echo "" |
| 110 |
exit |
| 111 |
fi |
| 112 |
} |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
#== Main Program ========================================================== |
| 117 |
|
| 118 |
|
| 119 |
InteractiveInstall=1 |
| 120 |
export InteractiveInstall |
| 121 |
|
| 122 |
|
| 123 |
checkInstallUser |
| 124 |
|
| 125 |
BuildVersion=@FIREBIRD_VERSION@.@FB_BUILD_NUM@ |
| 126 |
PackageVersion=@FIREBIRD_PACKAGE_VERSION@ |
| 127 |
CpuType=@CPU_TYPE@ |
| 128 |
|
| 129 |
FBRootDir=@prefix@ |
| 130 |
|
| 131 |
Version="$BuildVersion-$PackageVersion.$CpuType" |
| 132 |
|
| 133 |
|
| 134 |
cat <<EOF |
| 135 |
|
| 136 |
Firebird SuperServer $Version Uninstall program |
| 137 |
|
| 138 |
Are you sure you want to proceed? |
| 139 |
|
| 140 |
EOF |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
AskQuestion "Press Enter to start uninstall or ^C to abort" |
| 145 |
|
| 146 |
|
| 147 |
# Here we are uninstalling from a install tar file |
| 148 |
|
| 149 |
scriptsDir=$FBRootDir/misc/scripts |
| 150 |
|
| 151 |
|
| 152 |
if [ -e $scriptsDir ] |
| 153 |
then |
| 154 |
echo "Extracting install data" |
| 155 |
|
| 156 |
runAndCheckExit "$scriptsDir/preUninstall.sh" |
| 157 |
runAndCheckExit "$scriptsDir/postUninstall.sh" |
| 158 |
|
| 159 |
# This one is done last since it deletes the script files |
| 160 |
# as well. |
| 161 |
runAndCheckExit "$scriptsDir/tarUninstall.sh" |
| 162 |
|
| 163 |
fi |
| 164 |
|
| 165 |
echo "Uninstall completed" |
| 166 |
|