Mac KVASD-installer, don't lock in temporary directory location

Merged from wsjtx-1.4 branch.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4766 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2014-12-05 23:11:15 +00:00
parent 2cce5d6a96
commit b9047ba603
3 changed files with 15 additions and 12 deletions

View File

@ -50,17 +50,20 @@ end script
-- kvasd looks after fetching kvasd files from the web source -- kvasd looks after fetching kvasd files from the web source
script kvasd script kvasd
property serverPath : "https://svn.code.sf.net/p/wsjt/wsjt/trunk/kvasd-binary/" property serverPath : "https://svn.code.sf.net/p/wsjt/wsjt/trunk/kvasd-binary/"
property destination : (system attribute "TMPDIR") & "/"
property targetName : "kvasd" property targetName : "kvasd"
on destination()
return system attribute "TMPDIR"
end destination
on fetchEULA() on fetchEULA()
return curl's download(serverPath,targetName & "_eula.txt",destination) return curl's download(serverPath,targetName & "_eula.txt",my destination())
end fetchEULA end fetchEULA
on fetchBinary() on fetchBinary()
set |url| to serverPath & do shell script "echo `uname -s`-`uname -m`" & "/" set |url| to serverPath & do shell script "echo `uname -s`-`uname -m`" & "/"
set md5Sum to curl's downloadMD5(|url|,targetName) set md5Sum to curl's downloadMD5(|url|,targetName)
set |file| to curl's download(|url|,targetName,destination) set |file| to curl's download(|url|,targetName,my destination())
set md5Calc to do shell script "md5 " & (POSIX path of |file|) & " | cut -d' ' -f4" set md5Calc to do shell script "md5 " & (POSIX path of |file|) & " | cut -d' ' -f4"
if md5Calc md5Sum then if md5Calc md5Sum then
error "KVASD download corrupt MD5 hash check" & return & return ¬ error "KVASD download corrupt MD5 hash check" & return & return ¬
@ -75,21 +78,21 @@ script kvasd
with prompt "Specify folder to save license to" ¬ with prompt "Specify folder to save license to" ¬
default location (path to documents folder) default location (path to documents folder)
tell application "Finder" to ¬ tell application "Finder" to ¬
duplicate (destination & targetName & "_eula.txt") as POSIX file to dest duplicate (my destination() & targetName & "_eula.txt") as POSIX file to dest
end saveLicense end saveLicense
on printLicense() on printLicense()
tell application "Finder" to ¬ tell application "Finder" to ¬
print (destination & targetName & "_eula.txt") as POSIX file print (my destination() & targetName & "_eula.txt") as POSIX file
end printLicense end printLicense
on cleanUp() on cleanUp()
tell application "Finder" tell application "Finder"
if exists (destination & targetName & "_eula.txt") as POSIX file then if exists (my destination() & targetName & "_eula.txt") as POSIX file then
delete (destination & targetName & "_eula.txt") as POSIX file delete (my destination() & targetName & "_eula.txt") as POSIX file
end if end if
if exists (destination & targetName) as POSIX file then if exists (my destination() & targetName) as POSIX file then
delete (destination & targetName) as POSIX file delete (my destination() & targetName) as POSIX file
end if end if
end tell end tell
end cleanUp end cleanUp
@ -98,8 +101,6 @@ end script
script WSJTAppDelegate script WSJTAppDelegate
property parent : class "NSObject" property parent : class "NSObject"
property licenceAgreed : false
property mainWindow : missing value property mainWindow : missing value
property eulaTextView : missing value property eulaTextView : missing value
property progressBar : missing value property progressBar : missing value
@ -112,6 +113,7 @@ script WSJTAppDelegate
property bundlesToProcess : {} property bundlesToProcess : {}
global defaultNotificationCentre global defaultNotificationCentre
global licenceAgreed
on split(theText,theDelimiters) on split(theText,theDelimiters)
set oldDelimiters to AppleScript's text item delimiters set oldDelimiters to AppleScript's text item delimiters
@ -137,7 +139,7 @@ script WSJTAppDelegate
if button returned of result = "Ok" then if button returned of result = "Ok" then
try try
set target to installRoot & "/Contents/MacOS/" & kvasd's targetName set target to installRoot & "/Contents/MacOS/" & kvasd's targetName
do shell script "cp " & kvasd's destination & kvasd's targetName & space & target do shell script "cp " & kvasd's destination() & kvasd's targetName & space & target
repeat with theLine in paragraphs of (do shell script "otool -L " & target) repeat with theLine in paragraphs of (do shell script "otool -L " & target)
if theLine contains ".dylib" and not theLine contains "libSystem" then if theLine contains ".dylib" and not theLine contains "libSystem" then
set theDylib to 2nd item of split(theLine,{tab,space}) set theDylib to 2nd item of split(theLine,{tab,space})
@ -167,6 +169,7 @@ script WSJTAppDelegate
-- mainWindow's registerForDraggedTypes_({"public.file-url"}) -- mainWindow's registerForDraggedTypes_({"public.file-url"})
set defaultNotificationCentre to current application's NSNotificationCenter's defaultCenter() set defaultNotificationCentre to current application's NSNotificationCenter's defaultCenter()
set licenceAgreed to false
eulaTextView's setEditable_(false) eulaTextView's setEditable_(false)
script downloadEula script downloadEula