-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.scpt
57 lines (50 loc) · 2.27 KB
/
main.scpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# By chris1111
# A simple Applescript to (Un)Mount EFI on macOS Ventura 13
# Version "1.0" (Un)Mount EFI Copyright (c) 2022, chris1111 All right reserved
# MountEFI is based on CloverPackage MountESP script (Credit: Rehabman).
set theAction to button returned of (display dialog "
Welcome (Un)Mount EFI
Make a choice
" with icon note buttons {"Quit", "Unmount EFI", "Mount EFI"} cancel button "Quit" default button {"Mount EFI"})
if theAction = "Mount EFI" then
set Volumepath to paragraphs of (do shell script "ls /Volumes")
set Diskpath to choose from list Volumepath with prompt "
Choose the Disk to Mount the EFI partition
Then press the OK button" OK button name "OK"
if Diskpath is false then
display dialog "Quit Mount EFI" with icon note buttons {"EXIT"} default button {"EXIT"}
return
return (POSIX path of Diskpath)
end if
try
delay 1
set file_list to ""
set the_command to quoted form of POSIX path of (path to resource "MountEFI" in directory "MountEFI")
repeat with file_path in Diskpath
set file_list to file_list & " " & quoted form of POSIX path of file_path
end repeat
set the_command to the_command & " " & file_list
try
do shell script the_command with administrator privileges
do shell script "afplay '/System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/System/Volume Mount.aif' &> /dev/null &"
display alert "Mount EFI Partition on Volume" message (Diskpath as text) buttons "Done" default button "Done" giving up after 3
end try
end try
end if
if theAction = "Unmount EFI" then
set Volumepath to paragraphs of (do shell script "ls /Volumes")
set Diskpath to choose from list Volumepath with prompt "
Choose the EFI partition to Unmount
Then press the OK button" OK button name "OK"
if Diskpath is false then
display dialog "Quit Eject EFI" with icon note buttons {"EXIT"} default button {"EXIT"}
return
return POSIX path of Diskpath
end if
try
do shell script ¬
"diskutil unmount /Volumes/\"" & Diskpath & "\""
do shell script "afplay '/System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/System/Volume Unmount.aif' &> /dev/null &"
display alert "Umount Partition" message (Diskpath as text) buttons "Done" default button "Done" giving up after 3
end try
end if