Skip to content

Commit

Permalink
test brew
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfleischer committed Oct 26, 2023
1 parent 155188f commit 9946eff
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cloudmesh/common/Shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,21 @@ def install_brew():
return True
except subprocess.CalledProcessError:
Console.info("Installing Homebrew...")


content = """#!/bin/bash
pw="$(osascript -e 'Tell application "System Events" to display dialog "Password:" default answer "" with hidden answer' -e 'text returned of result' 2>/dev/null)" && echo "$pw"
"""

askpass = os.path.expanduser('~/bin/pw.sh')
if not os.path.isfile(askpass):
writefile(askpass, content)
os.system('chmod +x ~/bin/pw.sh')

print('test')
print(command)
# command = 'NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"'
command = 'osascript -e \'tell application "Terminal" to do script "/bin/bash -c \\"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\\""\''
command = 'osascript -e \'tell application "Terminal" to do script "/bin/bash -c \\"SUDO_ASKPASS=${HOME}/bin/pw.sh $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\\""\''

try:
subprocess.run(command, shell=True, check=True)
Expand Down

0 comments on commit 9946eff

Please sign in to comment.