summaryrefslogtreecommitdiff
path: root/setup_native/scripts/osx_install_languagepack.applescript
diff options
context:
space:
mode:
authorRelease Engineers <releng@openoffice.org>2009-08-26 06:41:14 +0000
committerRelease Engineers <releng@openoffice.org>2009-08-26 06:41:14 +0000
commitb84d6fb52b4ad1972a8158abdd18b2750538f6d1 (patch)
tree8b56854c97627cc9a9fc039c8c68181377d59cf8 /setup_native/scripts/osx_install_languagepack.applescript
parent68e8dec50fdde6095ea3f57d048f58f5e75f9743 (diff)
CWS-TOOLING: integrate CWS native262
2009-08-18 16:35:06 +0200 is r275118 : #i102939# differ between ok-label and install-label 2009-08-13 17:24:47 +0200 is r274960 : #i102939# mac languagepacks 2009-08-13 17:22:22 +0200 is r274959 : #i102939# mac languagepacks 2009-08-13 17:15:01 +0200 is r274958 : #i102939# mac languagepacks 2009-08-13 17:13:36 +0200 is r274957 : #i102939# mac languagepacks 2009-08-13 17:12:57 +0200 is r274956 : #i102939# mac languagepacks 2009-08-13 17:12:20 +0200 is r274955 : #i102939# mac languagepacks 2009-08-13 17:11:41 +0200 is r274954 : #i102939# mac languagepacks 2009-08-13 17:10:52 +0200 is r274953 : #i102939# mac languagepacks
Diffstat (limited to 'setup_native/scripts/osx_install_languagepack.applescript')
-rw-r--r--setup_native/scripts/osx_install_languagepack.applescript115
1 files changed, 115 insertions, 0 deletions
diff --git a/setup_native/scripts/osx_install_languagepack.applescript b/setup_native/scripts/osx_install_languagepack.applescript
new file mode 100644
index 000000000000..33d376adec1b
--- /dev/null
+++ b/setup_native/scripts/osx_install_languagepack.applescript
@@ -0,0 +1,115 @@
+(*
+This script is meant to
+ 1) Identify installed instances of the product
+ 2) check whether the user has write-access (and if not
+ ask for authentification)
+ 3) install the shipped tarball
+*)
+
+-- strings for localisations - to be meant to be replaced
+-- by a makefile or similar
+set OKLabel to "[OKLabel]"
+set InstallLabel to "[InstallLabel]"
+set AbortLabel to "[AbortLabel]"
+set intro to "[IntroText1]
+
+[IntroText2]
+
+[IntroText3]"
+set chooseMyOwn to "[ChooseMyOwnText]"
+set listPrompt to "[ListPromptText]"
+set chooseManual to "[ChooseManualText]"
+set listOKLabel to "[ListOKLabelText]"
+set listCancelLabel to "[ListCancelLabel]"
+set appInvalid to "[AppInvalidText1]
+
+[AppInvalidText2]" -- string will begin with the chosen application's name
+set startInstall to "[StartInstallText1]
+
+[StartInstallText2]"
+set IdentifyQ to "[IdentifyQText]
+
+[IdentifyQText2]"
+set IdentifyYES to "[IdentifyYES]"
+set IdentifyNO to "[IdentifyNO]"
+set installFailed to "[InstallFailedText]"
+set installComplete to "[InstallCompleteText]
+
+[InstallCompleteText2]"
+
+set sourcedir to (do shell script "dirname " & quoted form of POSIX path of (path to of me))
+
+display dialog intro buttons {AbortLabel, InstallLabel} default button 2
+
+if (button returned of result) is AbortLabel then
+ return 2
+end if
+
+set the found_ooos to (do shell script "mdfind \"kMDItemContentType == 'com.apple.application-bundle' && kMDItemDisplayName == '[PRODUCTNAME]*' && kMDItemDisplayName != '[FULLPRODUCTNAME].app'\"") & "
+" & chooseMyOwn
+
+-- the choice returned is of type "list"
+-- Show selection dialog only if more than one or no product was found
+if (get first paragraph of found_ooos) is "" then
+ set the choice to (choose from list of paragraphs in found_ooos default items (get last paragraph of found_ooos) with prompt listPrompt OK button name listOKLabel cancel button name listCancelLabel)
+ if choice is false then
+ -- do nothing, the user cancelled the installation
+ return 2 --aborted by user
+ else if (choice as string) is chooseMyOwn then
+ -- yeah, one needs to use "choose file", otherwise
+ -- the user would not be able to select the .app
+ set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles)
+ end if
+else if (get second paragraph of found_ooos) is chooseMyOwn then
+ -- set choice to found installation
+ set the choice to (get first paragraph of found_ooos)
+else
+ 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)
+ if choice is false then
+ -- do nothing, the user cancelled the installation
+ return 2 --aborted by user
+ else if (choice as string) is chooseMyOwn then
+ -- yeah, one needs to use "choose file", otherwise
+ -- the user would not be able to select the .app
+ set the choice to POSIX path of (choose file with prompt chooseManual of type "com.apple.application-bundle" without showing package contents and invisibles)
+ end if
+end if
+
+-- now only check whether the path is really from [PRODUCTNAME]
+try
+ do shell script "grep '<string>[PRODUCTNAME] [PRODUCTVERSION]' " & quoted form of (choice as string) & "/Contents/Info.plist"
+on error
+ display dialog (choice as string) & appInvalid buttons {InstallLabel} default button 1 with icon 0
+ return 3 --wrong target-directory
+end try
+
+(*
+display dialog startInstall buttons {AbortLabel, InstallLabel} default button 2
+
+if (button returned of result) is AbortLabel then
+ return 2
+end if
+*)
+
+set tarCommand to "/usr/bin/tar -C " & quoted form of (choice as string) & " -xjf " & quoted form of sourcedir & "/tarball.tar.bz2"
+try
+ do shell script tarCommand
+
+on error errMSG number errNUM
+ display dialog IdentifyQ buttons {IdentifyYES, IdentifyNO} with icon 2
+ if (button returned of result) is IdentifyYES then
+ try
+ do shell script tarCommand with administrator privileges
+ on error errMSG number errNUM
+ display dialog installFailed buttons {OKLabel} default button 1 with icon 0
+ -- -60005 username/password wrong
+ -- -128 aborted by user
+ -- 2 error from tar - tarball not found (easy to test)
+ return errNUM
+ end try
+ else
+ return 2 -- aborted by user
+ end if
+end try
+
+display dialog installComplete buttons {OKLabel} default button 1