Skip to content

Commit fef4eab

Browse files
authored
Correcao da instalacao do chocolatey
1 parent 60f866e commit fef4eab

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

functions.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,25 @@ def addtodomain(self, dominio, usuario, senha):
5252

5353
# Executa instalacao de programas
5454
def installprograma(self, diretorioarcom, programa):
55+
comando_cmd_script = '''
56+
@echo off
57+
58+
SET DIR=%~dp0%
59+
60+
::download install.ps1
61+
%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "((new-object net.webclient).DownloadFile('https://community.chocolatey.org/install.ps1','%DIR%install.ps1'))"
62+
::run installer
63+
%systemroot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& '%DIR%install.ps1' %*"
64+
'''
65+
cmd_script_name = 'install_chocolatey.bat'
66+
cmd_script_path = diretorioarcom + '\\' + cmd_script_name
5567
if not os.path.isfile(self.chocolateypath):
5668
self.reportar("Executando instalação do chocolatey")
69+
with open(cmd_script_path, 'w') as file:
70+
file.write(comando_cmd_script)
5771
self.executar(
58-
'@"%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString(\'https://chocolatey.org/install.ps1\'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\\chocolatey\\bin"'
59-
)
72+
cmd_script_path
73+
)
6074
self.executar(
6175
self.chocolateypath + " config set cacheLocation " + diretorioarcom
6276
)

0 commit comments

Comments
 (0)