lavinnyv

About

Username
lavinnyv
Joined
Visits
0
Last Active
Roles
member
Badges
0
Posts
1

Activity

  • i am trying to create a script to automate building the install media for macs - mont, big sur, catalina, etc.

    i have the code, example just for big sur:
    sudo /Users/home/recovOS/Install\ macOS\ Big\ Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/1100

    (i've also started to rename the installer to get rid of spaces:
    sudo /Users/home/recovOS/Install-macOS-Big-Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/1100


    what i'm trying to do is automate the full process of making the creation media in a .sh script or a .command script or even an applescript. and i've made each of those type of scripts with the install media by itself but it prompts me to input twice to complete the process.

    i'm trying to code the .sh/.command/applescript with all 3 of these commands together:

    the password
    yes to all
    the command to make the creation media

    **i know there are apps out there that do this as well, but i'd like to figure out how to accomplish what i'm trying to accomplish here.


    i have a bin/bash .sh that just makes the creation script:
    sudo /Users/home/recovOS/Install-macOS-Big-Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/1100

    i double click that and i get terminal to open and then it asks for my password, then y and enter to complete the process. i have to type in 2 lines and that's fine, but i'm trying to go the next steps to just let it do it's thing and then close terminal when it's done by just double clicking my script. i'm trying to fully automate this process so i can have employees in the field create these easier and they are not familiar with using the command line and terminal.

    so in linux it would be something like this - sudo [password code] -y(for yes to the questions) [command]. i run all kinds of shell scripts like this.

    i have found a few ways to input the password in mac:
    echo -n password | sudo -S command
    echo password | sudo -S command
    sudo -S <<< "password" command

    these seem to work with a few commands that i tested, but what i tested, might not have needed sudo - like i did a cp test and it worked. so they seemed like they worked, but maybe they didn't.

    ** i know i'll get the "this is unsafe to write your password to stdin" response - but this is a closed environment computer that does not go online. and i wipe them after every project, so even if someone got into the computer local, it's wiped clean within a month. and there is nothing for anyone to get out of these computers. they run a video and that's it. they're pretty stripped down.


    i've read that you can do something like this for mac for yes to all the questions:

    yes |
    or
    yes y |
    or
    yes Y |


    and it seems to works when i test that out with a script, but when i do all three, sudo pword, yes, and the command, it runs the code like it normally would and it seems like the sudo worked, and it asks me to continue but then stops as this:
    ...type (Y) then press return: Operation canceled.
    back to prompt

    i also use cliclick as a cli keyboard emulator, but i'm trying to solve this outside of telling terminal to key letters and Y and enter, i'm trying to do this whole process with common terminal code.


    so ultimately i'm trying to accomplish:

    sudo [use given password] [yes to all questions] /Users/home/recovOS/Install-macOS-Big-Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/1100

    thanks
    February 2022