-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.scpt
173 lines (146 loc) · 6.58 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# By chris1111
#
# Copyright (c) 2021, 2024 chris1111. All Right Reserved
# Credit: Apple
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# Version "1.0" by chris1111
# Vars
set theAction to button returned of (display dialog "
Welcome Create Install Media
You can create a bootable USB key
from OS X Maverick 10.9 to macOS Sonoma 14
Format your USB Drive with Disk Utility
in the format Mac OS Extended (Journaled)
GUID Partition Map
*****************************
You must quit Disk Utility to continue
installation !" with icon note buttons {"Quit", "Create Install Media"} cancel button "Quit" default button {"Create Install Media"})
--If Create Install Media
if theAction = "Create Install Media" then
do shell script "open -F -a 'Disk Utility'"
delay 1
tell application "Disk Utility"
activate
end tell
repeat
if application "Disk Utility" is not running then exit repeat
end repeat
activate me
set Volumepath to paragraphs of (do shell script "ls /Volumes")
set Diskpath to choose from list Volumepath with prompt "
To continue, select the volume you want to use, then press the OK button" OK button name "OK" with multiple selections allowed
if Diskpath is false then
display dialog "Quit Installer " with icon 0 buttons {"EXIT"} default button {"EXIT"}
return
return (POSIX path of Diskpath)
end if
try
--If Continue
set theAction to button returned of (display dialog "
Choose the location of your Install macOS.app" with icon note buttons {"Quit", "10.9 to 10.12", "10.13 to Sonoma 14"} cancel button "Quit" default button {"10.13 to Sonoma 14"})
if theAction = "10.13 to Sonoma 14" then
--If 10.13 to Sonoma 14
display dialog "
Your choice is 10.13 to Sonoma 14
Choose your Install OS X.app
From macOS High Sierra to macOS Sonoma" with icon note buttons {"Quit", "Continue"} cancel button "Quit" default button {"Continue"}
set InstallOSX to choose file of type {"XLSX", "APPL"} default location (path to applications folder) with prompt "Choose your Install macOS.app"
set OSXInstaller to POSIX path of InstallOSX
delay 2
(display dialog "Please confirm your choice?
Create Install Media from --> " & (InstallOSX as text) & "
Install to --> " & (Diskpath as text) with icon note buttons {"Cancel", "OK"} cancel button "Cancel" default button "OK")
set progress description to "Create Install Media
======================================
Installation time 15 to 25 min on a standard USB key
3 to 5 min on a Disk Ext HD
======================================
"
set progress total steps to 7
set progress additional description to "Analysing Install macOS"
delay 2
set progress completed steps to 1
set progress additional description to "Analysing USB Install Media"
delay 2
set progress completed steps to 2
set progress additional description to "Install USB Media OK"
delay 2
set progress completed steps to 3
set progress additional description to "Install in Progress "
delay 1
set progress completed steps to 4
set progress additional description to "Install in Progress Wait . . . 50%
Installing macOS to the disk " & Diskpath & ""
delay 1
--display dialog cmd
set cmd to "sudo \"" & OSXInstaller & "Contents/Resources/createinstallmedia\" --volume /Volumes/\"" & Diskpath & "\" --nointeraction"
do shell script cmd with administrator privileges
set progress completed steps to 5
set progress additional description to "Install in Progress 75%"
delay 1
set progress completed steps to 6
set progress additional description to "Install in Progress 90%"
delay 2
set progress completed steps to 7
set progress additional description to "
Create Install Media Completed ➤ ➤ ➤ 100%
Create Install Media Completed. "
else if theAction = "10.9 to 10.12" then
--If 10.9 to 10.12
display dialog "
10.9 to 10.12
Choose the location of your Install macOS.app
" with icon note buttons {"Quit", "Continue"} cancel button "Quit" default button {"Continue"}
set InstallOSX to choose file of type {"XLSX", "APPL"} default location (path to applications folder) with prompt "Choose your Install macOS.app"
set OSXInstaller to POSIX path of InstallOSX
delay 2
(display dialog "Please confirm your choice?
Create Install Media from --> " & (InstallOSX as text) & "
Install to --> " & (Diskpath as text) with icon note buttons {"Cancel", "OK"} cancel button "Cancel" default button "OK")
set progress description to "Create Install Media
======================================
Installation time 15 to 20 min on a standard USB key
3 to 5 min on a Disk Ext HD
======================================
"
set progress total steps to 7
set progress additional description to "Analysing Install macOS"
delay 2
set progress completed steps to 1
set progress additional description to "Analysing USB Install Media"
delay 2
set progress completed steps to 2
set progress additional description to "Install USB Media OK"
delay 2
set progress completed steps to 3
set progress additional description to "Install in Progress "
delay 1
set progress completed steps to 4
set progress additional description to "Install in Progress Wait . . . 50%
Installing macOS to the disk " & Diskpath & ""
delay 1
--display dialog cmd
set cmd to "sudo \"" & OSXInstaller & "Contents/Resources/createinstallmedia\" --volume /Volumes/\"" & Diskpath & "\" --applicationpath \"" & OSXInstaller & "\" --nointeraction"
do shell script cmd with administrator privileges
set progress completed steps to 5
set progress additional description to "Install in Progress 75%"
delay 1
set progress completed steps to 6
set progress additional description to "Install in Progress 90%"
delay 2
set progress completed steps to 7
set progress additional description to "
Create Install Media Completed ➤ ➤ ➤ 100%
Create Install Media Completed. "
end if
end try
end if