Shell script for fully making mac installation media

Joined
Feb 24, 2022
Messages
3
Reaction score
0
i am trying to create a script to automate building the install media for macs - mont, big sur, catalina, etc.

i run it now many different ways, i have a .sh script where i just have to put in my password and yes to all.

i can just type it into terminal and also type my password and yes to all.

what i'm trying to do is build a .sh script (or .command or shell script in applescript) to run the full command and put in the password and yes to all.

when i run ubuntu commands, it's something like this: sudo echo {password} | sudo -S -y {command}

so i'm looking to do the same thing with mac:
sudo [use given password] [yes to all questions] /Users/home/recovOS/Install-macOS-Big-Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/1100

i can't get the yes and password to work.

i've found this research:

for sudo'ing i've read that it is one of these formats:
echo -n password | sudo -S command
echo password | sudo -S command
sudo -S <<< "password" command

and for yes to all, i've found these:
yes |
or
yes y |
or
yes Y |

but when i put them all together, it doesn't run. it says "...type (Y) then press return: Operation canceled."

i understand i'm storing my password in stdin, but i'm almost always in a close network environment. so i'm fine with the security aspect of putting my password into this shell script.

i also know that i could do something like cliclick to just input the key stroke, but i'm trying to solve this with code in case something else comes up later that might need password and yes to all.

thanks
 

Cory Cooper

Moderator
Joined
May 19, 2004
Messages
11,106
Reaction score
497
Hello and welcome.

I am not very experienced with AppleScript, so I don't have any relevant suggestions. You could try the folks over at MacScripter, or maybe someone here with chime in.

C
 
Joined
Feb 24, 2022
Messages
3
Reaction score
0
i'm not necessarily trying to use apple script - but you can put a shell script in an apple script, so i just put that in there in case someone had done something like that. but i'm looking to create a shell script to accomplish this task.

like i said above, i do this all the time in linux, but i'm trying to run the same kind of shell script/terminal command on mac.
linux: sudo echo {password} | sudo -S -y {command}
mac: ?

but i will post in macscripter too. thanks for the tip.
 
Joined
Feb 24, 2022
Messages
3
Reaction score
0
yup. i have that above. i make installers all the time. i'm trying to automate the process. when running that script in terminal it still needs 2 user inputs, the password and yes to all so it can continue.

i'm looking for the terminal command to add password input and (y) so that i can put that in a .sh/.command/applescript and be able to double click and the process of making the install media will begin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top