8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 15:23:02 +01:00
firebird-mirror/builds/install/arch-specific/darwin/install-script

145 lines
4.7 KiB
Plaintext
Raw Normal View History

2007-03-09 11:32:58 +01:00
#!/bin/sh
#
# Script args:
# $0: full path to script
# $1: full path to top level package dir, no trailing slash
# $2: full path to installed location
# $3: ????? Path to install Volume????
# $4: ?????
2007-12-07 13:19:37 +01:00
# MacOS Notes
# 10.7 Lion
# 10.8 Mountain Lion
# 10.9 Mavericks - Clang not gcc
# 10.10 Yosemite - No longer uses StartupItems
# 10.11 El Capitan - Old installer deprecated -pkgbuild
2007-12-07 13:19:37 +01:00
OSVERSION=`sw_vers -productVersion | awk -F '.' '{print $2}'`
echo "OSVersion =" $OSVERSION
2007-12-07 13:19:37 +01:00
2007-06-11 16:21:33 +02:00
FB_FW="/Library/Frameworks/Firebird.framework"
2007-03-09 11:32:58 +01:00
FB_RES="$FB_FW/Versions/A/Resources"
2007-12-07 13:19:37 +01:00
# Now create the firebird group
echo "Create the Firebird group 10.7+"
2007-12-07 13:19:37 +01:00
if dscl localhost -read /Local/Default/Groups/firebird 2&>1 /dev/null; then
2019-11-28 16:54:50 +01:00
echo "Group Found"
2007-12-07 13:19:37 +01:00
else
gid=501
2019-11-28 16:54:50 +01:00
dscl localhost -search /Local/Default/Groups PrimaryGroupID $gid | grep $gid
while [ "$?" = "0" ]; do
2007-12-07 13:19:37 +01:00
let "gid =$gid+1"
dscl localhost -search /Local/Default/Groups PrimaryGroupID $gid | grep $gid
done
dscl localhost -create /Local/Default/Groups/firebird
dscl localhost -create /Local/Default/Groups/firebird Password "*"
dscl localhost -create /Local/Default/Groups/firebird PrimaryGroupID $gid
dscl localhost -create /Local/Default/Groups/firebird RecordName firebird
fi
# Now create the firebird user
echo "Create the Firebird user 10.7+"
2007-12-07 13:19:37 +01:00
if dscl localhost -read /Local/Default/Users/firebird 2&>1 /dev/null; then
echo "User Found"
else
ugid=501
2019-11-28 16:54:50 +01:00
dscl localhost -search /Local/Default/Users UniqueID $ugid | grep $ugid
while [ "$?" = "0" ]; do
2007-12-07 13:19:37 +01:00
let "ugid=$ugid+1"
2019-11-28 16:54:50 +01:00
dscl localhost -search /Local/Default/Users UniqueID $ugid | grep $ugid
2007-12-07 13:19:37 +01:00
done
echo "create the firebird user 10.7+"
2007-12-07 13:19:37 +01:00
dscl localhost -create /Local/Default/Users/firebird
dscl localhost -create /Local/Default/Users/firebird NFSHomeDirectory /Library/Frameworks/firebird.framework
dscl localhost -create /Local/Default/Users/firebird Password "*"
dscl localhost -create /Local/Default/Users/firebird UserShell /bin/tcsh
dscl localhost -create /Local/Default/Users/firebird RecordName firebird
2019-11-28 16:54:50 +01:00
dscl localhost -create /Local/Default/Users/firebird PrimaryGroupID $gid
2007-12-07 13:19:37 +01:00
dscl localhost -create /Local/Default/Users/firebird UniqueID $ugid
dscl localhost -create /Local/Default/Users/firebird RealName "Firebird Database"
2007-03-09 11:32:58 +01:00
fi
# Shutdown any existing servers
2007-06-11 16:21:33 +02:00
echo "Shutdown any existing servers"
2007-03-09 11:32:58 +01:00
if [ -x /sbin/service ]; then
service firebird stop
fi
# Install the framework
2007-06-11 16:21:33 +02:00
echo "Install the framework"
2007-12-07 13:19:37 +01:00
chown -R firebird:firebird "$FB_FW"
2007-03-09 11:32:58 +01:00
# set the permissions correctly
2007-06-11 16:21:33 +02:00
echo "Set the permissions correctly"
2019-11-28 16:54:50 +01:00
chmod 777 "$FB_FW/Resources/"
chmod 660 "$FB_FW/Resources/security4.fdb"
chmod 444 "$FB_FW/Resources/help/help.fdb"
2007-03-09 11:32:58 +01:00
# Remove all older traces of Classic first
echo "Remove all older traces of Classic first"
2007-03-09 11:32:58 +01:00
if [ -f /etc/inetd.conf ]; then
grep -s gds_db /etc/inetd.conf > /dev/null 2>&1
if test $? != 0 ; then
cat /etc/inetd.conf | grep -v gds_db > /etc/.firebird.temp.install.inetd.conf
mv /etc/.firebird.temp.install.inetd.conf /etc/inetd.conf
2007-03-09 11:32:58 +01:00
HUPNEEDED='y'
fi
fi
if [ -f /etc/xinetd.d/firebird ]; then
rm /etc/xinetd.d/firebird
HUPNEEDED='y'
fi
2019-11-28 16:54:50 +01:00
# Install the saved security2 database, if any
echo "Install the saved security2 database"
if test -f /tmp/fb-security-database-update2fdb; then
mv -f /tmp/fb-security-database-update2.fdb "$FB_RES/security2.fdb"
fi
2007-03-09 11:32:58 +01:00
# Install the saved security database, if any
2007-06-11 16:21:33 +02:00
echo "Install the saved security database"
2019-11-28 16:54:50 +01:00
if test -f /tmp/fb-security-database-update4.fdb; then
mv -f /tmp/fb-security-database-update4.fdb "$FB_RES/security4.fdb"
rm -f /tmp/fb-security-database-update4.fdb
2007-03-09 11:32:58 +01:00
fi
#Install the saved aliases.conf, if any
echo "Install the saved aliases.conf file"
if test -f /tmp/fb-aliases.conf; then
mv -f /tmp/fb-aliases.conf "$FB_RES/English.lproj/var/aliases.conf"
fi
2019-11-28 16:54:50 +01:00
#Install the saved databases.conf, if any
echo "Install the saved databases.conf file"
if test -f /tmp/fb-databases.conf; then
mv -f /tmp/fb-databases.conf "$FB_RES/databases.conf"
fi
#Install the saved UDF libraries, if any
echo "Install the saved UDF libraries"
2019-11-28 16:54:50 +01:00
cp /tmp/UDF_Save/*.* $FB_RES/UDF/
rm -fr /tmp/UDF_save
2019-11-28 16:54:50 +01:00
# Test for saved security database
if test -f "$FB_FW/Versions/A/Resources/security2.fdb"; then
echo "Legacy 2.x Security database has been preserved"
fi
2019-11-28 16:54:50 +01:00
if test -f "$FB_FW/Versions/A/Resources/security4.fdb"; then
echo "Security database has been preserved"
fi
# Initilise the security database with default user
echo "Add SYSDBA and password"
$FB_FW/Versions/A/Resources/bin/gsec -add sysdba -pw masterkey -user sysdba
rm -fr /tmp/firebird
# And last but not least, start the Server
echo "Start the Server via launchctl"
cp $FB_FW/Resources/org.firebird.gds.plist /Library/LaunchDaemons/org.firebird.gds.plist
2019-11-28 16:54:50 +01:00
launchctl load /Library/LaunchDaemons/org.firebird.gds.plist