Debian Codegraph @

builds/install/arch-specific/darwin/install-script

raw
1 #!/bin/sh
2 #
3 # Script args:
4 # $0: full path to script
5 # $1: full path to top level package dir, no trailing slash
6 # $2: full path to installed location
7 # $3: ????? Path to install Volume????
8 # $4: ?????
9
10 # MacOS Notes
11 # 10.7 Lion
12 # 10.8 Mountain Lion
13 # 10.9 Mavericks - Clang not gcc
14 # 10.10 Yosemite - No longer uses StartupItems
15 # 10.11 El Capitan - Old installer deprecated -pkgbuild
16
17 OSVERSION=`sw_vers -productVersion | awk -F '.' '{print $2}'`
18 echo "OSVersion =" $OSVERSION
19
20 FB_FW="/Library/Frameworks/Firebird.framework"
21 FB_RES="$FB_FW/Versions/A/Resources"
22
23 # Now create the firebird group
24 echo "Create the Firebird group 10.7+"
25 if dscl localhost -read /Local/Default/Groups/firebird 2&>1 /dev/null; then
26 gid=$(dscl localhost -read /Local/Default/Groups/firebird PrimaryGroupID | awk '($1 == "PrimaryGroupID:") { print $2 }')
27 echo "Group Found $gid"
28 else
29 gid=501
30 dscl localhost -search /Local/Default/Groups PrimaryGroupID $gid | grep $gid
31 while [ "$?" = "0" ]; do
32 let "gid =$gid+1"
33 dscl localhost -search /Local/Default/Groups PrimaryGroupID $gid | grep $gid
34 done
35 dscl localhost -create /Local/Default/Groups/firebird
36 dscl localhost -create /Local/Default/Groups/firebird Password "*"
37 dscl localhost -create /Local/Default/Groups/firebird PrimaryGroupID $gid
38 dscl localhost -create /Local/Default/Groups/firebird RecordName firebird
39 fi
40
41
42 # Now create the firebird user
43 echo "Create the Firebird user 10.7+"
44 if dscl localhost -read /Local/Default/Users/firebird 2&>1 /dev/null; then
45 echo "User Found"
46 else
47 ugid=501
48 dscl localhost -search /Local/Default/Users UniqueID $ugid | grep $ugid
49 while [ "$?" = "0" ]; do
50 let "ugid=$ugid+1"
51 dscl localhost -search /Local/Default/Users UniqueID $ugid | grep $ugid
52 done
53 echo "create the firebird user 10.7+"
54 dscl localhost -create /Local/Default/Users/firebird
55 dscl localhost -create /Local/Default/Users/firebird NFSHomeDirectory /Library/Frameworks/firebird.framework
56 dscl localhost -create /Local/Default/Users/firebird Password "*"
57 dscl localhost -create /Local/Default/Users/firebird UserShell /bin/tcsh
58 dscl localhost -create /Local/Default/Users/firebird RecordName firebird
59 dscl localhost -create /Local/Default/Users/firebird PrimaryGroupID $gid
60 dscl localhost -create /Local/Default/Users/firebird UniqueID $ugid
61 dscl localhost -create /Local/Default/Users/firebird RealName "Firebird Database"
62 fi
63
64 # Shutdown any existing servers
65 echo "Shutdown any existing servers"
66 if [ -x /sbin/service ]; then
67 service firebird stop
68 fi
69
70 # Install the framework
71 echo "Install the framework"
72 chown -R firebird:firebird "$FB_FW"
73
74 # set the permissions correctly
75 echo "Set the permissions correctly"
76 chmod 777 "$FB_FW/Resources/"
77 chmod 660 "$FB_FW/Resources/security4.fdb"
78 chmod 444 "$FB_FW/Resources/help/help.fdb"
79
80 # Remove all older traces of Classic first
81 echo "Remove all older traces of Classic first"
82 if [ -f /etc/inetd.conf ]; then
83 grep -s gds_db /etc/inetd.conf > /dev/null 2>&1
84 if test $? != 0 ; then
85 cat /etc/inetd.conf | grep -v gds_db > /etc/.firebird.temp.install.inetd.conf
86 mv /etc/.firebird.temp.install.inetd.conf /etc/inetd.conf
87 HUPNEEDED='y'
88 fi
89 fi
90
91 if [ -f /etc/xinetd.d/firebird ]; then
92 rm /etc/xinetd.d/firebird
93 HUPNEEDED='y'
94 fi
95
96 # Install the saved security2 database, if any
97 echo "Install the saved security2 database"
98 if test -f /tmp/fb-security-database-update2fdb; then
99 mv -f /tmp/fb-security-database-update2.fdb "$FB_RES/security2.fdb"
100 fi
101 # Install the saved security database, if any
102 echo "Install the saved security database"
103 if test -f /tmp/fb-security-database-update4.fdb; then
104 mv -f /tmp/fb-security-database-update4.fdb "$FB_RES/security4.fdb"
105 rm -f /tmp/fb-security-database-update4.fdb
106 fi
107
108 #Install the saved aliases.conf, if any
109 echo "Install the saved aliases.conf file"
110 if test -f /tmp/fb-aliases.conf; then
111 mv -f /tmp/fb-aliases.conf "$FB_RES/English.lproj/var/aliases.conf"
112 fi
113
114 #Install the saved databases.conf, if any
115 echo "Install the saved databases.conf file"
116 if test -f /tmp/fb-databases.conf; then
117 mv -f /tmp/fb-databases.conf "$FB_RES/databases.conf"
118 fi
119
120 #Install the saved UDF libraries, if any
121 echo "Install the saved UDF libraries"
122 cp /tmp/UDF_Save/*.* $FB_RES/UDF/
123
124 rm -fr /tmp/UDF_save
125
126 # Test for saved security database
127 if test -f "$FB_FW/Versions/A/Resources/security2.fdb"; then
128 echo "Legacy 2.x Security database has been preserved"
129 fi
130
131 if test -f "$FB_FW/Versions/A/Resources/security4.fdb"; then
132 echo "Security database has been preserved"
133 fi
134
135 # Initilise the security database with default user
136 echo "Add SYSDBA and password"
137 $FB_FW/Versions/A/Resources/bin/gsec -add sysdba -pw masterkey -user sysdba
138 rm -fr /tmp/firebird
139
140 # And last but not least, start the Server
141 echo "Start the Server via launchctl"
142
143 cp $FB_FW/Resources/org.firebird.gds.plist /Library/LaunchDaemons/org.firebird.gds.plist
144 launchctl load /Library/LaunchDaemons/org.firebird.gds.plist
145