2 This script is meant to
3 1) Identify installed instances of OOo
4 2) check whether the user has write-access (and if not
5 ask for authentification)
6 3) install the shipped tarball
9 -- strings for localisations - to be meant to be replaced
10 -- by a makefile or similar
12 set AbortLabel
to "Abort"
13 set intro
to "Welcome to the OpenOffice.org Languagepack Installer
15 The next step will try to detect installed versions of OpenOffice.org
16 This might take a moment"
17 set chooseMyOwn
to "not listed (choose location in an extra step)"
18 set listPrompt
to "Choose the installation for which you want to install the languagepack"
19 set chooseManual
to "Point the dialog to your OOo installation"
20 set listOKLabel
to "Continue"
21 set listCancelLabel
to "Abort installation"
22 set appInvalid
to " doesn't look like an OpenOffice.org installation
23 If the chosen application really is OpenOffice.org, please contact the developers. Otherwise just run the installer again and choose a valid OpenOffice.org installation" -- string will begin with the chosen application's name
24 set startInstall
to "Click " & OKLabel &
" to start the installation
26 (installation might take a minute...)"
27 set IdentifyQ
to "Installation failed, most likely your account doesn't have the necessary privileges. Do you want to identify as administrator and try again?"
28 set IdentifyYES
to "Yes, identify"
29 set IdentifyNO
to "No, abort installation"
30 set installFailed
to "Installation failed"
31 set installComplete
to "Installation is completed - you should now be able to switch the UI language"
33 set sourcedir
to (do shell
script "dirname " & quoted form
of POSIX
path of (
path to of me))
35 display dialog intro
buttons {AbortLabel, OKLabel}
default button 2
37 if (
button returned
of result)
is AbortLabel
then
41 set the found_ooos
to (do shell
script "mdfind \"kMDItemContentType == 'com.apple.application-bundle' && kMDItemDisplayName == 'OpenOffice.org*' && kMDItemDisplayName != 'OpenOffice.org Languagepack.app'\"") &
"
44 -- the choice returned is of type "list"
45 set the choice
to (
choose from list of paragraphs
in found_ooos
default items (
get first paragraph
of found_ooos)
with prompt listPrompt OK
button name listOKLabel cancel
button name listCancelLabel)
47 if choice
is false then
48 -- do nothing, the user cancelled the installation
49 return 2 --aborted by user
50 else if (choice
as string)
is chooseMyOwn
then
51 -- yeah, one needs to use "choose file", otherwise
52 -- the user would not be able to select the .app
53 set the choice
to POSIX
path of (
choose file with prompt chooseManual
of type
"com.apple.application-bundle" without showing package
contents and invisibles)
56 -- now only check whether the path is really from OOo
59 do shell
script "grep '<string>org.openoffice.script</string>' " & quoted form
of (choice
as string) &
"/Contents/Info.plist"
61 display dialog (choice
as string) & appInvalid
buttons {OKLabel}
default button 1 with icon 0
62 return 3 --wrong target-directory
65 display dialog startInstall
buttons {AbortLabel, OKLabel}
default button 2
67 if (
button returned
of result)
is AbortLabel
then
71 set tarCommand
to "/usr/bin/tar -C " & quoted form
of (choice
as string) &
" -xjf " & quoted form
of sourcedir &
"/tarball.tar.bz2"
73 do shell
script tarCommand
75 on error errMSG
number errNUM
76 display dialog IdentifyQ
buttons {IdentifyYES, IdentifyNO}
with icon 2
77 if (
button returned
of result)
is IdentifyYES
then
79 do shell
script tarCommand
with administrator privileges
80 on error errMSG
number errNUM
81 display dialog installFailed
buttons {OKLabel}
default button 1 with icon 0
82 -- -60005 username/password wrong
83 -- -128 aborted by user
84 -- 2 error from tar - tarball not found (easy to test)
88 return 2 -- aborted by user
92 display dialog installComplete
buttons {OKLabel}
default button 1