View | Details | Raw Unified | Return to issue 63630
Collapse All | Expand All

(-)instsetoo_native.3.fix_versions/macosx/application/PostInstall.applescript (-299 lines)
Lines 1-299 Link Here
1
(*************************************************************************
2
 *
3
 *  OpenOffice.org - a multi-platform office productivity suite
4
 *
5
 *  $RCSfile: PostInstall.applescript,v $
6
 *
7
 *  $Revision: 1.4 $
8
 *
9
 *  last change: $Author: vg $ $Date: 2006/11/22 11:56:14 $
10
 *
11
 *  The Contents of this file are made available subject to
12
 *  the terms of GNU Lesser General Public License Version 2.1.
13
 *
14
 *		
15
 *    GNU Lesser General Public License Version 2.1
16
 *    =============================================
17
 *    Copyright 2005 by Sun Microsystems, Inc.
18
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
19
 *
20
 *    This library is free software; you can redistribute it and/or
21
 *    modify it under the terms of the GNU Lesser General Public
22
 *    License version 2.1, as published by the Free Software Foundation.
23
 *
24
 *    This library is distributed in the hope that it will be useful,
25
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
26
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27
 *    Lesser General Public License for more details.
28
 *
29
 *    You should have received a copy of the GNU Lesser General Public
30
 *    License along with this library; if not, write to the Free Software
31
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32
 *    MA  02111-1307  USA
33
 *
34
 *************************************************************************)
35
36
-- This is the PostInstall -script for .pkg installation
37
-- 
38
-- Currently this script does the following things:
39
--   1) Uses fondu to extract and convert .dfont -fonts from Mac OS X system to .ttf -fonts for OpenOffice.org
40
41
42
(*==== (global variables as get-functions) ====*)
43
44
on getOOInstallPath()
45
	-- return (((path to applications folder from system domain) as string) & "OpenOffice XXXOOO_VER_MAJORMINORXXX.app:" & "Contents:MacOS:")
46
	return (((path to me) as string) & "Contents:MacOS:")
47
end getOOInstallPath
48
49
on getOOResourcesPath()
50
	return (((path to me) as string) & "Contents:Resources:")
51
end getOOResourcesPath
52
53
on getOOProgramPath()
54
	return (getOOInstallPath() & "program:")
55
end getOOProgramPath
56
57
-- OSXSystemFontPathList : {"/System/Library/Fonts/", "/Library/Fonts/"}
58
-- OSXUserFontPathList : {"~/Library/Fonts/"}
59
60
on getOSXSystemFontPathList()
61
	return {(path to fonts folder from system domain) as string, Â
62
		(path to fonts folder from local domain) as string}
63
end getOSXSystemFontPathList
64
65
on getOSXUserFontPathList()
66
	return {(path to fonts folder from user domain) as string}
67
end getOSXUserFontPathList
68
69
on getOOSystemFontPath()
70
	return (getOOInstallPath() & "share:fonts:truetype:")
71
end getOOSystemFontPath
72
73
on getOOUserSettingsPath()
74
	return (((path to home folder) as string) & "Library:Application Support:OpenOffice.org:XXXOOO_VER_MAJORXXX:")
75
end getOOUserSettingsPath
76
77
on getOOUserFontPath()
78
	return (getOOUserSettingsPath() & "user:fonts:")
79
end getOOUserFontPath
80
81
82
on getOOCookieSystemFondu()
83
	-- nosystemfondu : file does exist if user does not want to use fondu for system fonts
84
	return "no_system_fondu"
85
end getOOCookieSystemFondu
86
87
on getOOCookieSystemFonduDone()
88
	-- systemfondudone : file does exist if native fonts already extracted from system fonts
89
	return "system_fondu_done"
90
end getOOCookieSystemFonduDone
91
92
on getOOCookieUserFondu()
93
	-- nouserfondu : file does exist if user does not want to use fondu for user fonts
94
	return "no_user_fondu"
95
end getOOCookieUserFondu
96
97
on getOOCookieUserFonduDone()
98
	-- userfondudone : file does exist if native fonts already extracted from user fonts
99
	return "user_fondu_done"
100
end getOOCookieUserFonduDone
101
102
--
103
-- the default handler: run
104
--
105
106
on run
107
	-- Check for that OOo can be found
108
	if (not isRealPath(getOOProgramPath())) then
109
		logEvent("(scripts/PostInstall) ERROR: could not find OOo installation from " & POSIX path of getOOProgramPath())
110
		return
111
	end if
112
	
113
	-- checks are ok, now we can start doing the real stuff
114
	firstLaunch()
115
	runSystemFondu()
116
	runUserFondu()
117
	
118
	return
119
end run
120
121
122
-------------------------------------------------------------
123
124
125
on runSystemFondu()
126
	-- check if user does not want font conversion 
127
	if (isRealPath(getOOSystemFontPath() & getOOCookieSystemFondu())) then
128
		return
129
	end if
130
	
131
	-- check if font conversion was already run
132
	if (isRealPath(getOOSystemFontPath() & getOOCookieSystemFonduDone())) then
133
		return
134
	end if
135
	
136
	logEvent("(scripts/PostInstall) Extracting system fonts...")
137
	-- else try to create footprint
138
	if (setCookie(getOOSystemFontPath(), getOOCookieSystemFonduDone())) then
139
		-- call fondu for each font (i.e. without wildcard), so if it crashes only one font is missing
140
		fonduConvertFonts(getOOSystemFontPath(), getOSXSystemFontPathList())
141
	end if
142
	logEvent("(scripts/PostInstall) Extracting system fonts completed.")
143
end runSystemFondu
144
145
146
on runUserFondu()
147
	-- check if user does not want font conversion 
148
	if (isRealPath(getOOUserFontPath() & getOOCookieUserFondu())) then
149
		return
150
	end if
151
	
152
	-- check if font conversion was already run
153
	if (isRealPath(getOOUserFontPath() & getOOCookieUserFonduDone())) then
154
		return
155
	end if
156
	
157
	logEvent("(scripts/PostInstall) Extracting user fonts...")
158
	-- try to create footprint
159
	if (setCookie(getOOUserFontPath(), getOOCookieUserFonduDone())) then
160
		-- call fondu for each font (i.e. without wildcard), so if it crashes only one font is missing
161
		fonduConvertFonts(getOOUserFontPath(), getOSXUserFontPathList())
162
	end if
163
	logEvent("(scripts/PostInstall) Extracting user fonts completed.")
164
end runUserFondu
165
166
167
on firstLaunch()
168
	-- continue only if OOSysFontdir exists	
169
	if (not isRealPath(getOOSystemFontPath())) then
170
		logEvent("(scripts/PostInstall) ERROR: could not find System font folder from " & POSIX path of getOOSystemFontPath())
171
		return
172
	end if
173
	
174
	if (setCookie(getOOSystemFontPath(), getOOCookieSystemFondu() & ".in_progress")) then
175
		-- Has user already decided that he does not want to extract system fonts ?
176
		if (not isRealPath(getOOSystemFontPath() & getOOCookieSystemFondu())) then
177
			-- Are system fonts already extracted ?
178
			if (not isRealPath(getOOSystemFontPath() & getOOCookieSystemFonduDone())) then
179
				-- ask if the user wants to use fondu to extract system fonts
180
				set yesKey to getMessage("YES_KEY")
181
				set noKey to getMessage("NO_KEY")
182
				display dialog getMessage("OOO_EXTRACT_NATIVE_SYSFONTS") buttons {noKey, yesKey} default button yesKey
183
				set theResult to the button returned of the result
184
				if theResult is noKey then
185
					-- not use fondu for system fonts extraction !
186
					setCookie(getOOSystemFontPath(), getOOCookieSystemFondu())
187
					logEvent("(scripts/PostInstall) Setting: no system fonts")
188
				end if
189
			end if
190
		end if
191
	end if
192
	
193
	-- continue only if OOUserFontdir exists	
194
	if (not isRealPath(getOOUserFontPath())) then
195
		logEvent("(scripts/PostInstall) ERROR: could not find User font folder from " & POSIX path of getOOUserFontPath())
196
		return
197
	end if
198
	
199
	-- Has user already decided that he does not want to extract user fonts ?
200
	if (not isRealPath(getOOUserFontPath() & getOOCookieUserFondu())) then
201
		-- Are system fonts already extracted ?
202
		if (not isRealPath(getOOUserFontPath() & getOOCookieUserFonduDone())) then
203
			-- ask if the user wants to use fondu to extract user fonts
204
			set yesKey to getMessage("YES_KEY")
205
			set noKey to getMessage("NO_KEY")
206
			display dialog getMessage("OOO_EXTRACT_NATIVE_USERFONTS") buttons {noKey, yesKey} default button yesKey
207
			set theResult to the button returned of the result
208
			if theResult is noKey then
209
				-- not use fondu for user fonts extraction !
210
				setCookie(getOOUserFontPath(), getOOCookieUserFondu())
211
				logEvent("(scripts/PostInstall) Setting: no user fonts")
212
			end if
213
		end if
214
	end if
215
	
216
end firstLaunch
217
218
219
on fonduConvertFonts(targetPath, sourcePathList)
220
	
221
	-- define the location of fondu
222
	set fondu to quoted form of (POSIX path of getOOProgramPath() & "fondu")
223
	
224
	-- first go to the target directory
225
	set fonduCmd to "cd " & (quoted form of POSIX path of targetPath) & "; "
226
	
227
	repeat with q from 1 to number of items in sourcePathList
228
		set aPath to POSIX path of (item q of sourcePathList)
229
		set fonduCmd to fonduCmd & "for i in " & aPath & "*; do " & fondu & " -force \"$i\" >> /dev/null 2>&1; done; "
230
	end repeat
231
	try
232
		-- ignore errors
233
		-- with admin privileges does not work well on panther
234
		do shell script "sh -c " & quoted form of fonduCmd
235
	end try
236
	logEvent("fonduCMD: " & fonduCmd)
237
	
238
end fonduConvertFonts
239
240
241
(* ===== (Helper functions) ======= *)
242
243
-- set a cookiefile. The content is empty.
244
on setCookie(aPath, cookieFile)
245
	try
246
		if (isRealPath(aPath)) then
247
			set newFile to (aPath & cookieFile)
248
			open for access file newFile
249
			close access file newFile
250
			return true
251
		else
252
			return false
253
		end if
254
	on error
255
		return false
256
	end try
257
end setCookie
258
259
-- get a localized string
260
on getMessage(aKey)
261
	try
262
		if (aKey is equal to "YES_KEY") then
263
			return "Yes"
264
		end if
265
		
266
		if (aKey is equal to "NO_KEY") then
267
			return "No"
268
		end if
269
		
270
		if (aKey is equal to "OOO_EXTRACT_NATIVE_SYSFONTS") then
271
			return "Do you want OpenOffice.org to use the Apple system fonts?"
272
		end if
273
		
274
		if (aKey is equal to "OOO_EXTRACT_NATIVE_USERFONTS") then
275
			return "Do you want OpenOffice.org to use the fonts you have installed on this system?"
276
		end if
277
	end try
278
end getMessage
279
280
-- function for checking if a path exists
281
on isRealPath(aPath)
282
	try
283
		alias aPath
284
		return true
285
	on error
286
		-- error number -43 from aPath
287
		-- display dialog "NotRP -- " & aPath
288
		return false
289
	end try
290
end isRealPath
291
292
-- function for logging script messages
293
on logEvent(themessage)
294
	set theLine to (do shell script Â
295
		"date  +'%Y-%m-%d %H:%M:%S'" as string) Â
296
		& " " & themessage
297
	do shell script "echo " & quoted form of theLine & Â
298
		" >> ~/Library/Logs/OpenOfficeXXXOOO_VER_MAJORXXX.log"
299
end logEvent
(-)instsetoo_native.3.fix_versions/macosx/application/main.applescript (-30 lines)
Lines 118-153 Link Here
118
		return false
118
		return false
119
	end if
119
	end if
120
	
120
	
121
	-- Migrate the old user preference folder, if possible. (~/Library/Application Support/OpenOffice.org 2.0/)
122
	if (not isRealPath(getOOUserSettingsPath())) then
123
		set oldPrefsPath to (((path to home folder) as string) & "Library:Application Support:OpenOffice.org 2.0:")
124
		migrateUserPrefs(oldPrefsPath)
125
	end if
126
	
127
	-- Migrate the old user preference folder, if possible. (~/.openoffice.org2/)
128
	if (not isRealPath(getOOUserSettingsPath())) then
129
		set oldPrefsPath to (((path to home folder) as string) & ".openoffice.org2:")
130
		migrateUserPrefs(oldPrefsPath)
131
	end if
132
	
133
	if (not isRealPath(getOOUserFontPath())) then
134
		set createUserFont to "mkdir -p " & (quoted form of POSIX path of getOOUserFontPath()) & "; "
135
		do shell script createUserFont
136
	end if
137
	-- If no crash occured before, ~/Library/Logs does not exist, and OpenOffice.org cannot be started
138
	if (not isRealPath(getUserLogsPath())) then
139
		set createUserLogsPath to "mkdir -p " & (quoted form of POSIX path of getUserLogsPath()) & "; "
140
		do shell script createUserLogsPath
141
	end if
142
	-- Checks are ok, now do the PostInstall stuff (e.g. fondu)
143
	
144
	-- load helper library
145
	set postinstall to load script alias Â
146
		(getScriptPath() & "PostInstall.scpt")
147
	-- execute the postinstall script
148
	run of postinstall
149
	
150
	
151
	return true
121
	return true
152
end preRun
122
end preRun
153
123
(-)instsetoo_native.3.fix_versions/macosx/application/main.applescript~ (+391 lines)
Line 0 Link Here
1
(*************************************************************************
2
 *
3
 *  OpenOffice.org - a multi-platform office productivity suite
4
 *
5
 *  $RCSfile: main.applescript,v $
6
 *
7
 *  $Revision: 1.7 $
8
 *
9
 *  last change: $Author: vg $ $Date: 2006/11/22 11:56:26 $
10
 *
11
 *  The Contents of this file are made available subject to
12
 *  the terms of GNU Lesser General Public License Version 2.1.
13
 *
14
 *		
15
 *    GNU Lesser General Public License Version 2.1
16
 *    =============================================
17
 *    Copyright 2005 by Sun Microsystems, Inc.
18
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
19
 *
20
 *    This library is free software; you can redistribute it and/or
21
 *    modify it under the terms of the GNU Lesser General Public
22
 *    License version 2.1, as published by the Free Software Foundation.
23
 *
24
 *    This library is distributed in the hope that it will be useful,
25
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
26
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27
 *    Lesser General Public License for more details.
28
 *
29
 *    You should have received a copy of the GNU Lesser General Public
30
 *    License along with this library; if not, write to the Free Software
31
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32
 *    MA  02111-1307  USA
33
 *
34
 *************************************************************************)
35
36
(*==== (global variables as get-functions) ====*)
37
38
on getOOInstallPath()
39
	-- return (((path to applications folder from system domain) as string) & "OpenOffice XXXOOO_VER_MAJORMINORXXX.app:" & "Contents:MacOS:")
40
	return (((path to me) as string) & "Contents:MacOS:")
41
end getOOInstallPath
42
43
on getOOResourcesPath()
44
	return (((path to me) as string) & "Contents:Resources:")
45
end getOOResourcesPath
46
47
on getOOProgramPath()
48
	return (getOOInstallPath() & "program:")
49
end getOOProgramPath
50
51
on getScriptPath()
52
	-- set this to absolute path when debugging
53
	return (((path to me) as string) & "Contents:Resources:Scripts:")
54
end getScriptPath
55
56
on getOOUserSettingsPath()
57
	return (((path to home folder) as string) & "Library:Application Support:OpenOffice.org:XXXOOO_VER_MAJORXXX:")
58
end getOOUserSettingsPath
59
60
on getOOUserFontPath()
61
	return (getOOUserSettingsPath() & "user:fonts:")
62
end getOOUserFontPath
63
64
on getUserLogsPath()
65
	return (((path to home folder) as string) & "Library:Logs:")
66
end getUserLogsPath
67
68
on shellTerminator()
69
	return (" &>/dev/null & echo $!") as string
70
end shellTerminator
71
72
--
73
-- the default handlers: run, open, idle, quit
74
--
75
76
on run
77
	if (preRun()) then
78
		logEvent("(Scripts/main) Running OpenOffice.org")
79
		openSoffice("-")
80
	end if
81
end run
82
83
on open (theFiles)
84
	if (preRun()) then
85
		openFiles(theFiles)
86
	end if
87
end open
88
89
on idle
90
	-- close icon only if ooo has terminated
91
	if (hasOOoQuit()) then
92
		tell me to quit
93
	end if
94
	-- check all x seconds if ok to quit
95
	return 3
96
end idle
97
98
on quit
99
	if (hasOOoQuit()) then
100
		continue quit
101
	end if
102
end quit
103
104
-------------------------------------------------------------
105
106
on preRun()
107
	
108
	
109
	-- Check for the required version of Mac OS X
110
	if (not atLeastOSXVersion(10, 3, 0)) then
111
		display dialog getMessage("ERROR_NEED_PANTHER")
112
		return false
113
	end if
114
	
115
	-- Check for that OOo can be found
116
	if (not isRealPath(getOOProgramPath())) then
117
		display dialog getMessage("ERROR_OOO_NOT_FOUND")
118
		return false
119
	end if
120
	
121
	-- Migrate the old user preference folder, if possible. (~/Library/Application Support/OpenOffice.org 2.0/)
122
	if (not isRealPath(getOOUserSettingsPath())) then
123
		set oldPrefsPath to (((path to home folder) as string) & "Library:Application Support:OpenOffice.org 2.0:")
124
		migrateUserPrefs(oldPrefsPath)
125
	end if
126
	
127
	-- Migrate the old user preference folder, if possible. (~/.openoffice.org2/)
128
	if (not isRealPath(getOOUserSettingsPath())) then
129
		set oldPrefsPath to (((path to home folder) as string) & ".openoffice.org2:")
130
		migrateUserPrefs(oldPrefsPath)
131
	end if
132
	
133
	if (not isRealPath(getOOUserFontPath())) then
134
		set createUserFont to "mkdir -p " & (quoted form of POSIX path of getOOUserFontPath()) & "; "
135
		do shell script createUserFont
136
	end if
137
	-- If no crash occured before, ~/Library/Logs does not exist, and OpenOffice.org cannot be started
138
	if (not isRealPath(getUserLogsPath())) then
139
		set createUserLogsPath to "mkdir -p " & (quoted form of POSIX path of getUserLogsPath()) & "; "
140
		do shell script createUserLogsPath
141
	end if
142
	-- Checks are ok, now do the PostInstall stuff (e.g. fondu)
143
	
144
	-- load helper library
145
	set postinstall to load script alias Â
146
		(getScriptPath() & "PostInstall.scpt")
147
	-- execute the postinstall script
148
	run of postinstall
149
	
150
	
151
	return true
152
end preRun
153
154
155
on hasOOoQuit()
156
	if (isRealPath(getOOProgramPath())) then
157
		-- set the location of soffice binary
158
		set soffice to (quoted form of (POSIX path of getOOProgramPath() & "soffice"))
159
		
160
		set isRunning to do shell script "_FOUND_=`ps -wx -o command | grep " & soffice & " | grep -v grep`; echo $_FOUND_"
161
		if isRunning ­ "" then
162
			return false
163
		else
164
			return true
165
		end if
166
	else
167
		return true
168
	end if
169
end hasOOoQuit
170
171
172
on openSoffice(aFile)
173
	set theDisplay to startXServer()
174
	if (theDisplay is equal to "error") then
175
		return
176
	end if
177
	set theEnv to "DISPLAY=" & theDisplay & " ; export DISPLAY; "
178
	set theCmd to "sh " & (quoted form of (POSIX path of getOOProgramPath() & "soffice")) & " "
179
	do shell script theEnv & theCmd & aFile & shellTerminator()
180
	-- logEvent("open CMD: " & theEnv & theCmd & aFile)
181
end openSoffice
182
183
184
-- helper function to start X11 server
185
on startXServer()
186
	
187
	-- get X settings
188
	set XSettingsList to findXServer()
189
	set whichserver to item 1 of XSettingsList
190
	set Xserverloc to item 2 of XSettingsList
191
	
192
	-- debug:
193
	-- logEvent("(scripts/main) X settings: " & whichserver & "--" & POSIX path of Xserverloc)
194
	-- set whichserver to "NOXSERVER"
195
	
196
	-- if nothing really was found, display an error message.
197
	if (whichserver is equal to "NOXSERVER") then
198
		display dialog getMessage("ERROR_NEED_X11")
199
		return "error"
200
	end if
201
	
202
	set now_running to ""
203
	set now_running to do shell script "INX=`ps -wcx | grep  " & quoted form of (whichserver & "$") & "`; echo $INX"
204
	if whichserver = "NOXSERVER" then
205
		-- display dialog "No XServer Found"
206
		set now_running to "Skip"
207
	end if
208
	if now_running = "" then
209
		if whichserver = "X11" then
210
			set x11cmd to quoted form of (Xserverloc & "/Contents/MacOS/X11") & shellTerminator()
211
			do shell script x11cmd
212
			-- save process id
213
			set x11pid to the result
214
			-- wait until the window manager is started which is the second child process of x11
215
			set numchildrencmd to "ps -x -o ppid | grep " & x11pid & " | wc -l"
216
			set numchildren to 0
217
			set d to current date
218
			set t1 to time of d
219
			repeat while numchildren ­ 2
220
				set d to current date
221
				set t2 to time of d
222
				-- give up after 30 seconds
223
				if t2 - t1 > 30 then
224
					display dialog "Command timed out"
225
					exit repeat
226
				end if
227
				set result to do shell script numchildrencmd
228
				set numchildren to result as integer
229
			end repeat
230
		else -- startup XDarwin
231
			do shell script "open " & quoted form of Xserverloc & shellTerminator()
232
			do shell script "sleep 4"
233
		end if
234
	end if
235
	if whichserver is equal to "X11" then
236
		-- the DISPLAY variable is different for every user currently logged in
237
		-- X11 passes the DISPLAY as the last command line parameter to its child process
238
		-- we can use ps to read the command line and parse the trailing :0, :1, or whatever
239
		set xdisplay to do shell script "ps -wx -o command | grep X11.app | grep \":.$\" | sed \"s/^.*:/:/g\""
240
		--display dialog xdisplay
241
		return xdisplay
242
	else
243
		-- TODO: find out how XDarwin does it
244
		return ":0"
245
	end if
246
end startXServer
247
248
249
on openFiles(fileList)
250
	if (count of fileList) > 0 then
251
		repeat with i from 1 to the count of fileList
252
			set theDocument to (item i of fileList)
253
			set theFilePath to (quoted form of POSIX path of theDocument)
254
			set theFileInfo to (info for theDocument)
255
			openSoffice(theFilePath)
256
			logEvent("(Scripts/main) Open file: " & theFilePath)
257
		end repeat
258
	end if
259
end openFiles
260
261
262
(* ===== (Helper functions) ======= *)
263
264
-- get a localized string
265
on getMessage(aKey)
266
	try
267
		if (aKey is equal to "YES_KEY") then
268
			return "Yes"
269
		end if
270
		
271
		if (aKey is equal to "NO_KEY") then
272
			return "No"
273
		end if
274
		
275
		if (aKey is equal to "ERROR_OOO_NOT_FOUND") then
276
			return "OpenOffice.org was not found on your system. Please (re-)install OpenOffice.org first."
277
		end if
278
		
279
		if (aKey is equal to "ERROR_NEED_PANTHER") then
280
			return "This build of OpenOffice.org cannot be run on this system, OpenOffice.org requires MacOSX 10.3 (Panther) or newer system"
281
		end if
282
		
283
		if (aKey is equal to "ERROR_NEED_X11") then
284
			return "OpenOffice.org cannot be started, because X11 is not installed. Please install Apple X11 first."
285
		end if
286
	end try
287
end getMessage
288
289
290
-- function for logging script messages
291
on logEvent(themessage)
292
	set theLine to (do shell script Â
293
		"date  +'%Y-%m-%d %H:%M:%S'" as string) Â
294
		& " " & themessage
295
	do shell script "echo " & quoted form of theLine & Â
296
		" >> ~/Library/Logs/OpenOfficeXXXOOO_VER_MAJORXXX.log"
297
end logEvent
298
299
300
-- function for checking if a path exists
301
on isRealPath(aPath)
302
	try
303
		alias aPath
304
		return true
305
	on error
306
		-- error number -43 from aPath
307
		-- display dialog "NotRP -- " & aPath
308
		return false
309
	end try
310
end isRealPath
311
312
-- try to find X11 server on the Mac OS X system
313
-- return value: the found server or "NOXSERVER"
314
on findXServer()
315
	-- First try standard X11 location, then try standard XDarwin location
316
	
317
	set whichserver to "NOXSERVER"
318
	--Utilities folder of system
319
	set Xserverloc to ((path to utilities folder from system domain) as string) & "X11.app:"
320
	--display dialog " Xserverloc" & Xserverloc
321
	if (isRealPath(Xserverloc)) then
322
		set whichserver to "X11"
323
		set Xserverloc to (POSIX path of Xserverloc)
324
	else
325
		--Applications folder of system
326
		set Xserverloc to ((path to applications folder from system domain) as string) & "XDarwin.app:"
327
		if (isRealPath(Xserverloc)) then
328
			set whichserver to "XDarwin"
329
			set Xserverloc to (POSIX path of Xserverloc)
330
		end if
331
	end if
332
	
333
	-- if nothing found yet try using locate, first with X11.app and then with XDarwin.app
334
	if (whichserver is equal to "NOXSERVER") then
335
		set Xserverloc to do shell script "locate X11.app/Contents/MacOS/X11 | sed -e 's-/Contents/MacOS/X11--g'"
336
		if Xserverloc ­ "" then
337
			set whichserver to "X11"
338
		end if
339
	end if
340
	
341
	if (whichserver is equal to "NOXSERVER") then
342
		set Xserverloc to do shell script "locate XDarwin.app/Contents/MacOS/XDarwin | sed -e 's-/Contents/MacOS/XDarwin--g'"
343
		if Xserverloc ­ "" then
344
			set whichserver to "XDarwin"
345
		end if
346
	end if
347
	
348
	return {whichserver, Xserverloc}
349
end findXServer
350
351
352
-- Test for a minimum version of Mac OS X
353
on atLeastOSXVersion(verMajor, verMinor, verStep)
354
	-- The StandardAdditions's 'system attribute' used to be the Finder's 'computer' command.
355
	tell application "Finder" to set sysv to (system attribute "sysv")
356
	
357
	-- Generate sysv-compatible number from given version
358
	set reqVer to ((verMajor div 10) * 4096 + (verMajor mod 10) * 256 + verMinor * 16 + verStep)
359
	
360
	-- DEBUGGING:	
361
	-- display dialog ("RV:" & reqVer & " < " & sysv as string)
362
	
363
	-- set major to ((sysv div 4096) * 10 + (sysv mod 4096 div 256))
364
	-- set minor to (sysv mod 256 div 16)
365
	-- set step to (sysv mod 16)
366
	-- display dialog ("Your Mac OS X version: " & major & "." & minor & "." & step)
367
	
368
	if (reqVer > sysv) then
369
		return false
370
	else
371
		return true
372
	end if
373
end atLeastOSXVersion
374
375
-- Migrate older user pref dir paths, if possible
376
on migrateUserPrefs(oldpath)
377
	-- if the old prefs can be found...
378
	if (isRealPath(oldpath)) then
379
		set newPathParent to (((path to home folder) as string) & "Library:Application Support:OpenOffice.org:")
380
		-- check if the new base user prefs directory exists, and create the folder if it doesn't
381
		if (not isRealPath(newPathParent)) then
382
			set createUserPrefsBasePath to "mkdir -p " & (quoted form of POSIX path of newPathParent) & "; "
383
			do shell script createUserPrefsBasePath
384
		end if
385
		-- migrate the old prefs to the new folder
386
		set newPath to (quoted form of POSIX path of getOOUserSettingsPath())
387
		set migratePrefs to "mv " & (quoted form of POSIX path of oldpath) & " " & newPath & "; "
388
		do shell script migratePrefs
389
	end if
390
end migrateUserPrefs
391
(-)instsetoo_native.3.fix_versions/macosx/installer_openoffice/Description.plist (+12 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
<plist version="1.0">
4
<dict>
5
	<key>IFPkgDescriptionDescription</key>
6
	<string>OpenOffice.org for Mac OS X.
7
8
Mac OS X 10.4 or later is required.  </string>
9
	<key>IFPkgDescriptionTitle</key>
10
	<string>OpenOffice.org</string>
11
</dict>
12
</plist>
(-)instsetoo_native.3.fix_versions/macosx/installer_openoffice/Info.plist (+46 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
<plist version="1.0">
4
<dict>
5
	<key>CFBundleGetInfoString</key>
6
	<string>XXXOOO_VER_MAJORMINORXXX, OpenOffice.org</string>
7
	<key>CFBundleIdentifier</key>
8
	<string>org.openoffice.office</string>
9
	<key>CFBundleShortVersionString</key>
10
	<string>XXXOOO_VER_MAJORMINORXXX</string>
11
	<key>IFMajorVersion</key>
12
	<integer>1</integer>
13
	<key>IFMinorVersion</key>
14
	<integer>0</integer>
15
	<key>IFPkgFlagAllowBackRev</key>
16
	<false/>
17
	<key>IFPkgFlagAuthorizationAction</key>
18
	<string>AdminAuthorization</string>
19
	<key>IFPkgFlagBackgroundAlignment</key>
20
	<string>topleft</string>
21
	<key>IFPkgFlagBackgroundScaling</key>
22
	<string>none</string>
23
	<key>IFPkgFlagDefaultLocation</key>
24
	<string>/Applications</string>
25
	<key>IFPkgFlagFollowLinks</key>
26
	<true/>
27
	<key>IFPkgFlagInstallFat</key>
28
	<false/>
29
	<key>IFPkgFlagInstalledSize</key>
30
	<integer>300</integer>
31
	<key>IFPkgFlagIsRequired</key>
32
	<false/>
33
	<key>IFPkgFlagOverwritePermissions</key>
34
	<false/>
35
	<key>IFPkgFlagRelocatable</key>
36
	<false/>
37
	<key>IFPkgFlagRestartAction</key>
38
	<string>NoRestart</string>
39
	<key>IFPkgFlagRootVolumeOnly</key>
40
	<true/>
41
	<key>IFPkgFlagUpdateInstalledLanguages</key>
42
	<false/>
43
	<key>IFPkgFormatVersion</key>
44
	<real>0.10000000149011612</real>
45
</dict>
46
</plist>
(-)instsetoo_native.3.fix_versions/macosx/installer_openoffice/Install_Resources/PostInstall.applescript.template (+319 lines)
Line 0 Link Here
1
(*************************************************************************
2
 *
3
 *  OpenOffice.org - a multi-platform office productivity suite
4
 *
5
 *  $RCSfile: PostInstall.applescript,v $
6
 *
7
 *  $Revision: 1.4 $
8
 *
9
 *  last change: $Author: vg $ $Date: 2006/11/22 11:56:14 $
10
 *
11
 *  The Contents of this file are made available subject to
12
 *  the terms of GNU Lesser General Public License Version 2.1.
13
 *
14
 *		
15
 *    GNU Lesser General Public License Version 2.1
16
 *    =============================================
17
 *    Copyright 2005 by Sun Microsystems, Inc.
18
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
19
 *
20
 *    This library is free software; you can redistribute it and/or
21
 *    modify it under the terms of the GNU Lesser General Public
22
 *    License version 2.1, as published by the Free Software Foundation.
23
 *
24
 *    This library is distributed in the hope that it will be useful,
25
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
26
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27
 *    Lesser General Public License for more details.
28
 *
29
 *    You should have received a copy of the GNU Lesser General Public
30
 *    License along with this library; if not, write to the Free Software
31
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32
 *    MA  02111-1307  USA
33
 *
34
 *************************************************************************)
35
36
-- This is the PostInstall -script for .pkg installation
37
-- 
38
-- Currently this script does the following things:
39
--   1) Uses fondu to extract and convert .dfont -fonts from Mac OS X system to .ttf -fonts for OpenOffice.org
40
41
42
(*==== (global variables as get-functions) ====*)
43
44
on getOOInstallPath()
45
	return (((path to applications folder from system domain) as string) & "OpenOffice XXXOOO_VER_MAJORMINORXXX.app:" & "Contents:MacOS:")
46
	-- return (((path to me) as string) & "Contents:MacOS:")
47
end getOOInstallPath
48
49
on getOOProgramPath()
50
	return (getOOInstallPath() & "program:")
51
end getOOProgramPath
52
53
-- OSXSystemFontPathList : {"/System/Library/Fonts/", "/Library/Fonts/"}
54
-- OSXUserFontPathList : {"~/Library/Fonts/"}
55
56
on getOSXSystemFontPathList()
57
	return {(path to fonts folder from system domain) as string, Â
58
		(path to fonts folder from local domain) as string}
59
end getOSXSystemFontPathList
60
61
on getOSXUserFontPathList()
62
	return {(path to fonts folder from user domain) as string}
63
end getOSXUserFontPathList
64
65
on getOOSystemFontPath()
66
	return (getOOInstallPath() & "share:fonts:truetype:")
67
end getOOSystemFontPath
68
69
on getOOUserSettingsPath()
70
	return (((path to home folder) as string) & "Library:Application Support:OpenOffice.org:XXXOOO_VER_MAJORXXX:")
71
end getOOUserSettingsPath
72
73
on getOOUserFontPath()
74
	return (getOOUserSettingsPath() & "user:fonts:")
75
end getOOUserFontPath
76
77
78
on getOOCookieSystemFondu()
79
	-- nosystemfondu : file does exist if user does not want to use fondu for system fonts
80
	return "no_system_fondu"
81
end getOOCookieSystemFondu
82
83
on getOOCookieSystemFonduDone()
84
	-- systemfondudone : file does exist if native fonts already extracted from system fonts
85
	return "system_fondu_done"
86
end getOOCookieSystemFonduDone
87
88
on getOOCookieUserFondu()
89
	-- nouserfondu : file does exist if user does not want to use fondu for user fonts
90
	return "no_user_fondu"
91
end getOOCookieUserFondu
92
93
on getOOCookieUserFonduDone()
94
	-- userfondudone : file does exist if native fonts already extracted from user fonts
95
	return "user_fondu_done"
96
end getOOCookieUserFonduDone
97
98
--
99
-- the default handler: run
100
--
101
102
on run
103
	-- Check for that OOo can be found
104
	if (not isRealPath(getOOProgramPath())) then
105
		logEvent("(scripts/PostInstall) ERROR: could not find OOo installation from " & POSIX path of getOOProgramPath())
106
		return
107
	end if
108
	
109
	-- Migrate the old user preference folder, if possible. (~/Library/Application Support/OpenOffice.org 2.0/)
110
	if (not isRealPath(getOOUserSettingsPath())) then
111
		set oldPrefsPath to (((path to home folder) as string) & "Library:Application Support:OpenOffice.org 2.0:")
112
		migrateUserPrefs(oldPrefsPath)
113
	end if
114
	
115
	-- Migrate the old user preference folder, if possible. (~/.openoffice.org2/)
116
	if (not isRealPath(getOOUserSettingsPath())) then
117
		set oldPrefsPath to (((path to home folder) as string) & ".openoffice.org2:")
118
		migrateUserPrefs(oldPrefsPath)
119
	end if
120
	
121
	if (not isRealPath(getOOUserFontPath())) then
122
		set createUserFont to "mkdir -p " & (quoted form of POSIX path of getOOUserFontPath()) & "; "
123
		do shell script createUserFont
124
	end if
125
126
	-- If no crash occured before, ~/Library/Logs does not exist, and OpenOffice.org cannot be started
127
	if (not isRealPath(getUserLogsPath())) then
128
		set createUserLogsPath to "mkdir -p " & (quoted form of POSIX path of getUserLogsPath()) & "; "
129
		do shell script createUserLogsPath
130
	end if
131
132
133
	-- checks are ok, now we can start doing the real stuff
134
	firstLaunch()
135
	runSystemFondu()
136
	runUserFondu()
137
	
138
	return
139
end run
140
141
142
-------------------------------------------------------------
143
144
145
on runSystemFondu()
146
	-- check if user does not want font conversion 
147
	if (isRealPath(getOOSystemFontPath() & getOOCookieSystemFondu())) then
148
		return
149
	end if
150
	
151
	-- check if font conversion was already run
152
	if (isRealPath(getOOSystemFontPath() & getOOCookieSystemFonduDone())) then
153
		return
154
	end if
155
	
156
	logEvent("(scripts/PostInstall) Extracting system fonts...")
157
	-- else try to create footprint
158
	if (setCookie(getOOSystemFontPath(), getOOCookieSystemFonduDone())) then
159
		-- call fondu for each font (i.e. without wildcard), so if it crashes only one font is missing
160
		fonduConvertFonts(getOOSystemFontPath(), getOSXSystemFontPathList())
161
	end if
162
	logEvent("(scripts/PostInstall) Extracting system fonts completed.")
163
end runSystemFondu
164
165
166
on runUserFondu()
167
	-- check if user does not want font conversion 
168
	if (isRealPath(getOOUserFontPath() & getOOCookieUserFondu())) then
169
		return
170
	end if
171
	
172
	-- check if font conversion was already run
173
	if (isRealPath(getOOUserFontPath() & getOOCookieUserFonduDone())) then
174
		return
175
	end if
176
	
177
	logEvent("(scripts/PostInstall) Extracting user fonts...")
178
	-- try to create footprint
179
	if (setCookie(getOOUserFontPath(), getOOCookieUserFonduDone())) then
180
		-- call fondu for each font (i.e. without wildcard), so if it crashes only one font is missing
181
		fonduConvertFonts(getOOUserFontPath(), getOSXUserFontPathList())
182
	end if
183
	logEvent("(scripts/PostInstall) Extracting user fonts completed.")
184
end runUserFondu
185
186
187
on firstLaunch()
188
	-- continue only if OOSysFontdir exists	
189
	if (not isRealPath(getOOSystemFontPath())) then
190
		logEvent("(scripts/PostInstall) ERROR: could not find System font folder from " & POSIX path of getOOSystemFontPath())
191
		return
192
	end if
193
	
194
	if (setCookie(getOOSystemFontPath(), getOOCookieSystemFondu() & ".in_progress")) then
195
		-- Has user already decided that he does not want to extract system fonts ?
196
		if (not isRealPath(getOOSystemFontPath() & getOOCookieSystemFondu())) then
197
			-- Are system fonts already extracted ?
198
			if (not isRealPath(getOOSystemFontPath() & getOOCookieSystemFonduDone())) then
199
				-- ask if the user wants to use fondu to extract system fonts
200
				set yesKey to getMessage("YES_KEY")
201
				set noKey to getMessage("NO_KEY")
202
				display dialog getMessage("OOO_EXTRACT_NATIVE_SYSFONTS") buttons {noKey, yesKey} default button yesKey
203
				set theResult to the button returned of the result
204
				if theResult is noKey then
205
					-- not use fondu for system fonts extraction !
206
					setCookie(getOOSystemFontPath(), getOOCookieSystemFondu())
207
					logEvent("(scripts/PostInstall) Setting: no system fonts")
208
				end if
209
			end if
210
		end if
211
	end if
212
	
213
	-- continue only if OOUserFontdir exists	
214
	if (not isRealPath(getOOUserFontPath())) then
215
		logEvent("(scripts/PostInstall) ERROR: could not find User font folder from " & POSIX path of getOOUserFontPath())
216
		return
217
	end if
218
	
219
	-- Has user already decided that he does not want to extract user fonts ?
220
	if (not isRealPath(getOOUserFontPath() & getOOCookieUserFondu())) then
221
		-- Are system fonts already extracted ?
222
		if (not isRealPath(getOOUserFontPath() & getOOCookieUserFonduDone())) then
223
			-- ask if the user wants to use fondu to extract user fonts
224
			set yesKey to getMessage("YES_KEY")
225
			set noKey to getMessage("NO_KEY")
226
			display dialog getMessage("OOO_EXTRACT_NATIVE_USERFONTS") buttons {noKey, yesKey} default button yesKey
227
			set theResult to the button returned of the result
228
			if theResult is noKey then
229
				-- not use fondu for user fonts extraction !
230
				setCookie(getOOUserFontPath(), getOOCookieUserFondu())
231
				logEvent("(scripts/PostInstall) Setting: no user fonts")
232
			end if
233
		end if
234
	end if
235
	
236
end firstLaunch
237
238
239
on fonduConvertFonts(targetPath, sourcePathList)
240
	
241
	-- define the location of fondu
242
	set fondu to quoted form of (POSIX path of getOOProgramPath() & "fondu")
243
	
244
	-- first go to the target directory
245
	set fonduCmd to "cd " & (quoted form of POSIX path of targetPath) & "; "
246
	
247
	repeat with q from 1 to number of items in sourcePathList
248
		set aPath to POSIX path of (item q of sourcePathList)
249
		set fonduCmd to fonduCmd & "for i in " & aPath & "*; do " & fondu & " -force \"$i\" >> /dev/null 2>&1; done; "
250
	end repeat
251
	try
252
		-- ignore errors
253
		-- with admin privileges does not work well on panther
254
		do shell script "sh -c " & quoted form of fonduCmd
255
	end try
256
	logEvent("fonduCMD: " & fonduCmd)
257
	
258
end fonduConvertFonts
259
260
261
(* ===== (Helper functions) ======= *)
262
263
-- set a cookiefile. The content is empty.
264
on setCookie(aPath, cookieFile)
265
	try
266
		if (isRealPath(aPath)) then
267
			set newFile to (aPath & cookieFile)
268
			open for access file newFile
269
			close access file newFile
270
			return true
271
		else
272
			return false
273
		end if
274
	on error
275
		return false
276
	end try
277
end setCookie
278
279
-- get a localized string
280
on getMessage(aKey)
281
	try
282
		if (aKey is equal to "YES_KEY") then
283
			return "Yes"
284
		end if
285
		
286
		if (aKey is equal to "NO_KEY") then
287
			return "No"
288
		end if
289
		
290
		if (aKey is equal to "OOO_EXTRACT_NATIVE_SYSFONTS") then
291
			return "Do you want OpenOffice.org to use the Apple system fonts?"
292
		end if
293
		
294
		if (aKey is equal to "OOO_EXTRACT_NATIVE_USERFONTS") then
295
			return "Do you want OpenOffice.org to use the fonts you have installed on this system?"
296
		end if
297
	end try
298
end getMessage
299
300
-- function for checking if a path exists
301
on isRealPath(aPath)
302
	try
303
		alias aPath
304
		return true
305
	on error
306
		-- error number -43 from aPath
307
		-- display dialog "NotRP -- " & aPath
308
		return false
309
	end try
310
end isRealPath
311
312
-- function for logging script messages
313
on logEvent(themessage)
314
	set theLine to (do shell script Â
315
		"date  +'%Y-%m-%d %H:%M:%S'" as string) Â
316
		& " " & themessage
317
	do shell script "echo " & quoted form of theLine & Â
318
		" >> ~/Library/Logs/OpenOfficeXXXOOO_VER_MAJORXXX.log"
319
end logEvent
(-)instsetoo_native.3.fix_versions/macosx/installer_openoffice/Install_Resources/postflight (+7 lines)
Line 0 Link Here
1
#!/bin/csh
2
#
3
# run the PostInstall.applescript
4
5
osascript PostInstall.scpt
6
7
exit 0
(-)instsetoo_native.3.fix_versions/macosx/installer_openoffice/create_pkg.sh (+68 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
 ########################################################################
4
 #
5
 #  OpenOffice.org - a multi-platform office productivity suite
6
 #
7
 #  $RCSfile: create_pkg.sh,v $
8
 #
9
 #  $Revision: 1.1 $
10
 #
11
 #  last change: $Author: mox $ $Date: 2006/12/07 12:23:29 $
12
 #
13
 #  The Contents of this file are made available subject to
14
 #  the terms of GNU Lesser General Public License Version 2.1.
15
 #
16
 #
17
 #    GNU Lesser General Public License Version 2.1
18
 #    =============================================
19
 #    Copyright 2005 by Sun Microsystems, Inc.
20
 #    901 San Antonio Road, Palo Alto, CA 94303, USA
21
 #
22
 #    This library is free software; you can redistribute it and/or
23
 #    modify it under the terms of the GNU Lesser General Public
24
 #    License version 2.1, as published by the Free Software Foundation.
25
 #
26
 #    This library is distributed in the hope that it will be useful,
27
 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
28
 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
29
 #    Lesser General Public License for more details.
30
 #
31
 #    You should have received a copy of the GNU Lesser General Public
32
 #    License along with this library; if not, write to the Free Software
33
 #    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34
 #    MA  02111-1307  USA
35
 #
36
 #######################################################################
37
38
# 
39
# create_pkg.sh - create pkg-installer for OpenOffice.org Spotlight Plugin
40
#
41
# Note: the final installation path is formed by combining the
42
# IFPkgFlagDefaultLocation -key in Info.plist with the contents of the $ROOTPATH
43
#
44
# Currently: "/Applications/OpenOffice.org <version>.app"
45
46
PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
47
48
OOOVER="XXXOOO_VER_MAJORMINORXXX"
49
DESTPATH="../OpenOffice.org ${OOOVER}.pkg"
50
ROOTPATH=../application
51
RESOURCES=./Install_Resources
52
53
# XXX HACK
54
if [ -d "../OpenOffice.org.app" ]; then
55
   mv "../OpenOffice.org.app" "${ROOTPATH}/OpenOffice.org ${OOOVER}.app"
56
fi
57
58
if [ ! -d "${ROOTPATH}/OpenOffice.org ${OOOVER}.app" ]; then
59
    echo "create_pkg.sh ERROR: Cannot find the OpenOffice.org application"
60
    exit
61
fi
62
63
if [ -d "$DESTPATH" ]; then
64
    rm -rf "$DESTPATH"
65
fi
66
67
"${PACKAGEMAKER}" -build -p "$DESTPATH" -f "$ROOTPATH" -ds -v -r "$RESOURCES" -d Description.plist -i Info.plist
68
(-)instsetoo_native.3.fix_versions/macosx/makefile.mk (-11 / +41 lines)
Lines 49-61 Link Here
49
49
50
.ELSE           # "$(OS)"!="MACOSX"
50
.ELSE           # "$(OS)"!="MACOSX"
51
51
52
# ----  .app building ----
53
52
BUNDLE = $(MISC)$/OpenOffice.org.app
54
BUNDLE = $(MISC)$/OpenOffice.org.app
53
CONTENTS = $(BUNDLE)$/Contents
55
CONTENTS = $(BUNDLE)$/Contents
54
VERSIONED = $(MISC)$/application
56
VERSIONED = $(MISC)$/application
55
57
56
scriptfiles = \
58
scriptfiles = \
57
	$(CONTENTS)$/Resources$/Scripts$/main.scpt	\
59
	$(CONTENTS)$/Resources$/Scripts$/main.scpt
58
	$(CONTENTS)$/Resources$/Scripts$/PostInstall.scpt
59
60
60
plistfiles  = $(CONTENTS)$/Info.plist \
61
plistfiles  = $(CONTENTS)$/Info.plist \
61
		$(CONTENTS)$/Resources$/InfoPlist.strings		
62
		$(CONTENTS)$/Resources$/InfoPlist.strings		
Lines 71-85 Link Here
71
CREATOR_TYPE=OOO2
72
CREATOR_TYPE=OOO2
72
.ENDIF
73
.ENDIF
73
74
74
.ENDIF		# "$(OS)"!="MACOSX"	
75
# ---- .pkg installer ----
76
77
INSTALLER = $(MISC)$/installer
78
INSTRESOURCES = $(INSTALLER)$/Install_Resources
79
SOLVERPATH = $(SOLARVER)$/$(INPATH)
80
81
installerfiles = $(INSTALLER)$/Info.plist \
82
	         $(INSTALLER)$/Description.plist \
83
	         $(INSTALLER)$/create_pkg.sh
84
75
85
76
# --- Targets --------------------------------------------------
86
# --- Targets --------------------------------------------------
77
87
78
.INCLUDE : target.mk
88
.INCLUDE : target.mk
79
89
80
.IF "$(OS)"=="MACOSX"
90
# Make sure everything is built before zipping
81
91
$(ZIP1TARGETN) : $(scriptfiles) $(plistfiles) $(INSTALLER).done
82
$(ZIP1TARGETN) : $(scriptfiles) $(plistfiles)
83
92
84
$(plistfiles) : $(scriptfiles)
93
$(plistfiles) : $(scriptfiles)
85
94
Lines 92-102 Link Here
92
	echo "APPL$(CREATOR_TYPE)" > $(CONTENTS)$/PkgInfo
101
	echo "APPL$(CREATOR_TYPE)" > $(CONTENTS)$/PkgInfo
93
	$(RM) "$(CONTENTS)$/Info.plist" "$(VERSIONED)/main.applescript"
102
	$(RM) "$(CONTENTS)$/Info.plist" "$(VERSIONED)/main.applescript"
94
103
95
$(CONTENTS)$/Resources$/Scripts$/%.scpt : application/%.applescript
96
	make_versioned.sh "$<" "$(VERSIONED)/tmp.applescript"
97
	osacompile -d -o "$@" "$(VERSIONED)/tmp.applescript"
98
	$(RM) "$(VERSIONED)/tmp.applescript"
99
100
# Info.plist is just versioned and copied into the bundle	
104
# Info.plist is just versioned and copied into the bundle	
101
$(CONTENTS)$/%.plist : application/%.plist
105
$(CONTENTS)$/%.plist : application/%.plist
102
	make_versioned.sh "$<" "$@"
106
	make_versioned.sh "$<" "$@"
Lines 108-113 Link Here
108
	make_versioned.sh "$(VERSIONED)/tmp.utf8" "$(VERSIONED)/tmp.utf8.versioned"
112
	make_versioned.sh "$(VERSIONED)/tmp.utf8" "$(VERSIONED)/tmp.utf8.versioned"
109
	iconv -f UTF-8 -t UTF-16 "$(VERSIONED)/tmp.utf8.versioned" > "$@"
113
	iconv -f UTF-8 -t UTF-16 "$(VERSIONED)/tmp.utf8.versioned" > "$@"
110
	$(RM) "$(VERSIONED)/tmp.utf8" "$(VERSIONED)/tmp.utf8.versioned"
114
	$(RM) "$(VERSIONED)/tmp.utf8" "$(VERSIONED)/tmp.utf8.versioned"
115
116
117
# --- Installer ---
118
119
$(INSTALLER).done : $(INSTRESOURCES).done $(installerfiles)
120
	touch "$@"
121
122
# create installer folder and copy all resources
123
$(INSTRESOURCES).done : 
124
	mkdir -p "$(INSTALLER)"
125
	test ! -d "$(INSTRESOURCES)" || rm -r "$(INSTRESOURCES)"
126
	cp -r installer_openoffice/Install_Resources "$(INSTALLER)$/"
127
	make_versioned.sh "$(INSTRESOURCES)$/PostInstall.applescript.template" "$(INSTRESOURCES)$/PostInstall.applescript"
128
	rm "$(INSTRESOURCES)$/PostInstall.applescript.template"
129
	cp "$(SOLVERPATH)$/bin$/osl$/LICENSE_en-US" "$(INSTRESOURCES)$/License.txt"
130
	cp "$(SOLVERPATH)$/bin$/osl$/README_en-US.html" "$(INSTRESOURCES)$/Welcome.html"
131
	touch "$@"
132
133
# all .plist files are just versioned and copied into the bundle	
134
$(INSTALLER)$/%.plist : installer_openoffice/%.plist
135
	make_versioned.sh "$<" "$@"
136
137
# all shell scripts are just copied
138
$(INSTALLER)$/%.sh : installer_openoffice/%.sh
139
	make_versioned.sh "$<" "$@"
140
111
	
141
	
112
.ENDIF		# "$(OS)"!="MACOSX"	
142
.ENDIF		# "$(OS)"!="MACOSX"	
113
143

Return to issue 63630