Skip to content

Commit af96cb1

Browse files
Merge pull request #9 from galaxy4public/catalina
Catalina support
2 parents fa1691f + e59d121 commit af96cb1

File tree

4 files changed

+49
-11
lines changed

4 files changed

+49
-11
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
1.2.0
2+
-----
3+
- Replaced some calls to "osascript" where AppleScript was hitting new security
4+
measures introduced in Catalina with JXA (Javascript for Apps). This should
5+
enable the package to work on Catalina.
6+
17
1.1.0
28
-----
39
- Switched to (Semantic Versioning)[https://semver.org/] for the package

build/Distribution.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
22
<installer-gui-script minSpecVersion="2">
33
<title>BootUnlock</title>
4-
<product id="au.com.openwall.BootUnlock" version="1.0" />
4+
<product id="au.com.openwall.BootUnlock" version="1.2.0" />
55
<background file="background.png" scaling="proportional" alignment="bottomleft"/>
66
<welcome file="welcome.rtf"/>
77
<readme file="readme.rtf"/>
@@ -20,5 +20,5 @@
2020
<choice id="au.com.openwall.BootUnlock" visible="false">
2121
<pkg-ref id="au.com.openwall.BootUnlock"/>
2222
</choice>
23-
<pkg-ref id="au.com.openwall.BootUnlock">BootUnlock-1.1.0-dist.pkg</pkg-ref>
23+
<pkg-ref id="au.com.openwall.BootUnlock">BootUnlock-1.2.0-dist.pkg</pkg-ref>
2424
</installer-gui-script>

build/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ NAME="BootUnlock"
77
IDENTIFIER="au.com.openwall.$NAME"
88

99
# Package version number.
10-
VERSION="1.1.0"
10+
VERSION="1.2.0"
1111

1212
# The location to copy the contents of files.
1313
INSTALL_LOCATION="/Library/PrivilegedHelperTools/$IDENTIFIER"

files/update.sh

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,16 @@ for V in "${VOLUME[@]}" ; do
4848
VOLUME_LIST="$VOLUME_LIST${VOLUME_LIST:+, }\"$DEVICE > $NAME\""
4949
done
5050

51-
RESPONSE=$(osascript -e "
52-
set volumeList to { $VOLUME_LIST }
53-
set unlockList to choose from list volumeList with title \"BootUnlock\" with prompt \"
54-
Please select volume(s) you want to be automatically unlocked during the boot (you can select multiple volumes by holding the Option key)\" multiple selections allowed true empty selection allowed true
51+
RESPONSE=$(osascript -l JavaScript -e "
52+
var app = Application.currentApplication()
53+
app.includeStandardAdditions = true
54+
volumeList = [ $VOLUME_LIST ]
55+
app.chooseFromList(volumeList,
56+
{
57+
withPrompt: 'Please select volume(s) you want to be automatically unlocked during the boot (you can select multiple volumes by holding the Command key)',
58+
multipleSelectionsAllowed: true,
59+
emptySelectionAllowed: true
60+
})
5561
")
5662

5763
if [ -z "$RESPONSE" -o "$RESPONSE" = false ]; then
@@ -75,12 +81,38 @@ for V in "${VOLUME[@]}" ; do
7581
printf '%s' "$RESPONSE" | grep -E "^$DEVICE\$" &>/dev/null || continue
7682

7783
while : ; do # This is a wrapper in case user provides a wrong password
78-
PASSPHRASE=$(osascript -e "
79-
display dialog \"Please provide the passphrase for volume '$NAME':\" with title \"BootUnlock\" buttons { \"Skip\", \"Unlock\" } default button \"Unlock\" with icon file ((path to \"apps\" as text) & \"Utilities:Disk Utility.app:Contents:Resources:AppIcon.icns\") default answer \"\" hidden answer true
84+
PASSPHRASE=$(osascript -l JavaScript -e "
85+
var app = Application.currentApplication()
86+
app.includeStandardAdditions = true
87+
ObjC.import('Foundation')
88+
/*
89+
iconPath = Path(
90+
ObjC.deepUnwrap(
91+
$.NSBundle.bundleWithIdentifier(
92+
Application('Disk Utility').id()
93+
).pathsForResourcesOfTypeInDirectory('icns', $()))[0])
94+
*/
95+
function promptPassword(text, defaultAnswer) {
96+
var options = {
97+
defaultAnswer: defaultAnswer || '',
98+
withTitle: 'BootUnlock',
99+
buttons: [ 'Skip', 'Unlock' ],
100+
defaultButton: 'Unlock',
101+
// withIcon: iconPath,
102+
hiddenAnswer: true
103+
}
104+
try {
105+
let result = app.displayDialog(text, options)
106+
if (result.buttonReturned == 'Unlock')
107+
return result.textReturned
108+
return ''
109+
} catch (e) {
110+
return null
111+
}
112+
}
113+
promptPassword('Please provide the passphrase for volume \"$NAME\":')
80114
")
81115

82-
PASSPHRASE=$(printf '%s' "$PASSPHRASE" | cut -f3- -d:)
83-
84116
if printf '%s' "$PASSPHRASE" | diskutil apfs unlock "$DEVICE" -stdinpassphrase -verify -user "$UUID"; then
85117
printf 'Adding password for volume "%s" with UUID %s to the System keychain...\n' "$NAME" "$UUID"
86118
if sudo /usr/bin/security add-generic-password \

0 commit comments

Comments
 (0)