From 9946eff0e2be06e59ecee33344c2810ab2dcbf40 Mon Sep 17 00:00:00 2001 From: "J.P" <70083705+stapmoshun@users.noreply.github.com> Date: Thu, 26 Oct 2023 06:46:07 -0400 Subject: [PATCH] test brew --- cloudmesh/common/Shell.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cloudmesh/common/Shell.py b/cloudmesh/common/Shell.py index 0a4714ae..0a53cfea 100755 --- a/cloudmesh/common/Shell.py +++ b/cloudmesh/common/Shell.py @@ -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)