Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit f82fb79

Browse files
Add a fake installer to the OSX DMG
This installer launches an AppleScript that opens a Finder window on the DMG so the user can drag it to their Applications folder. This is needed to that old auto-updaters that try to launch an installer in the DMG do something useful rather than failing silently.
1 parent 5316536 commit f82fb79

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

builder/tools_builder.livecodescript

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,20 @@ command toolsBuilderMakeAppBundle pVersion, pEdition, pPlatform
498498
throw "failure"
499499
end if
500500

501+
-- Copy a shell script and AppleScript into the app bundle to catch attempts
502+
-- from old auto-updaters to launch the installer
503+
builderLog "message", "Adding installer shim to app bundle"
504+
get shell ("install -m755" && escapeArg(builderCommunityResourceFolder() & "/dmg/fake-installer.sh") && escapeArg(tAppBundle & "/Contents/MacOS/installer"))
505+
if the result is not zero then
506+
builderLog "error", "Failed to copy installer stub shell script:" && it
507+
throw "failure"
508+
end if
509+
get shell ("osacompile" && "-o" && escapeArg(tAppBundle & "/Contents/MacOS/installer.scpt") && escapeArg(builderCommunityResourceFolder() & "/dmg/open-dmg.applescript"))
510+
if the result is not zero then
511+
builderLog "error", "Failed to compile installer stub AppleScript:" && it
512+
throw "failure"
513+
end if
514+
501515
-- Find the signing identity and sign the app bundle
502516
get findSigningIdentity()
503517
if it is not empty then

engine/rsrc/dmg/fake-installer.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
#
3+
# This script is used to provide a bridge for old LiveCode auto-updaters that
4+
# expect the LiveCode update DMG to contain an installer rather than the app
5+
# bundle that is now is. It fires off an AppleScript that opens a Finder
6+
# window on the DMG so that the user can drag the app bundle to their
7+
# Applications folder.
8+
9+
# Location of this script file
10+
# <something>.app/Contents/MacOS/installer
11+
self=${BASH_SOURCE[0]}
12+
selfdir=$(dirname "${self}")
13+
14+
# Location of the AppleScript
15+
# <something>.app/Contents/MacOS/installer.scpt
16+
script="${selfdir}"/installer.scpt
17+
18+
# Directory to open in Finder
19+
# AppleScript can only deal with absolute paths and doesn't like '..'
20+
target=$(cd "${selfdir}/../../.." && pwd)
21+
22+
osascript "${script}" "${target}"
23+
exit $?
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
on run argv
2+
if the number of items of argv is not 1 then
3+
return "Error: invalid parameters"
4+
end if
5+
6+
set folderPath to POSIX file (item 1 of argv)
7+
8+
tell application "Finder"
9+
tell folder folderPath
10+
-- Open a Finder window on the DMG
11+
open
12+
13+
-- Bring that window to the front
14+
activate
15+
end tell
16+
end tell
17+
end run

0 commit comments

Comments
 (0)