Files
web-installer/windows-installer.hta
root 7b0c980295
All checks were successful
continuous-integration/drone/push Build is passing
docker run
2024-08-05 14:11:41 +02:00

206 lines
4.9 KiB
HTML

<html>
<head>
<title>Webinstaller</title>
<HTA:APPLICATION
APPLICATIONNAME="webinstaller"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
<STYLE>
body {
padding-top:20px;
text-align:center;
}
td,input {
font-family:Verdana;
font-size:12pt;
}
a {
font-size:9pt;
font-family:Verdana;
}
</STYLE>
<SCRIPT LANGUAGE=VBScript>
Set objNetwork = CreateObject("Wscript.Network")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")
Sub Window_OnLoad
Dim X, Y, strComputer, objWMIService, colItems, objItem, intHorizontal, strYear, wcRegPath
X=500
Y=420
window.resizeTo X,Y
' resize the HTA
strComputer = "."
Set objWMIService = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
window.moveTo (intHorizontal - X) / 2, (intVertical - Y) / 2
' centre it
'txtName.value=objNetwork.UserName
txtHost.focus
wcRegPath = "HKLM\SYSTEM\CurrentControlSet\Services\WebClient\Parameters\"
'WriteToRegistry wcRegPath & "BasicAuthLevel", 1, "REG_DWORD"
'WriteToRegistry wcRegPath & "FileAttributesLimitInBytes", 10000000, "REG_DWORD"
'WriteToRegistry wcRegPath & "FileSizeLimitInBytes", 512000000, "REG_DWORD"
'WriteToRegistry wcRegPath & "InternetServerTimeoutInSec", 600, "REG_DWORD"
'WriteToRegistry wcRegPath & "LocalServerTimeoutInSec", 600, "REG_DWORD"
'WriteToRegistry wcRegPath & "SendReceiveTimeoutInSec", 600, "REG_DWORD"
'WriteToRegistry wcRegPath & "ServerNotFoundCacheLifeTimeInSec", 0, "REG_DWORD"
'WriteToRegistry wcRegPath & "SupportLocking", 1, "REG_DWORD"
End Sub
Sub btnConfigure_OnClick
StartWSL
If txtHost.value="" Then
MsgBox "Please enter hostname",16,"ERROR"
txtHost.focus
Exit Sub
End If
If txtPort.value="" Then
MsgBox "Please enter port number",16,"ERROR"
txtPort.focus
Exit Sub
End If
MsgBox "TEST STARTED",64,"DONE"
End Sub
Sub StartWSL()
WSL = "wsl.exe --user root --exec docker ps > C:\Users\wslresult.txt"
intReturn = objShell.Run(WSL, 0, True)
If Err.Number <> 0 Then
MsgBox (Err.number & "-" & err.Description)
else
MsgBox "Docker ps OK"
End If
WSL = "wsl.exe --user root --exec docker run -d -v /var/run/docker.sock:/var/run/docker.sock registry.format.hu/framework-scheduler"
intReturn = objShell.Run(WSL, 0, True)
If Err.Number <> 0 Then
MsgBox (Err.number & "-" & err.Description)
else
MsgBox "Docker run OK"
End If
End Sub
Sub MapDrive(DriveLetter,DrivePath)
If objFSO.DriveExists(DriveLetter) Then
objNetwork.RemoveNetworkDrive DriveLetter,true
End If
objNetwork.MapNetworkDrive DriveLetter, DrivePath, false, txtName.value,txtPassword.value
End Sub
Sub DeleteCredential(Target)
CredentialDelete = "cmdkey.exe /delete:" & Target
intReturn = objShell.Run(CredentialDelete, 0, True)
End Sub
Sub AddHost(Host)
Dim Exists, NewRow, HostsPath, fileREAD, fileAPPEND, TextLine
Exists = false
NewRow = "192.168.0.1 " & Host
HostsPath = "C:\Windows\System32\drivers\etc\hosts"
'Set oHosts = objFSO.GetFile(HostsPath)
'MsgBox oHosts.attributes
'1-read, 2-write, 8-append
Set fileREAD = objFSO.OpenTextFile(HostsPath, 1)
Do While fileREAD.AtEndOfStream <> True
TextLine = Trim(fileREAD.ReadLine)
If TextLine=NewRow Then
Exists = true
Else
Exists = false
End If
Loop
'MsgBox Exists
If Not Exists Then
Set fileAPPEND = objFSO.OpenTextFile(HostsPath, 8)
fileAPPEND.Write(vbCrLf & NewRow)
fileAPPEND.Close()
Set fileAPPEND = Nothing
End If
End Sub
Sub WriteToRegistry(path,value,vtype)
str1 = ReadFromRegistry(path)
strModify = objShell.RegWrite(path, value, vtype)
If Err.number <> 0 then
MsgBox Err.Number & vbcr & Err.Description,vbCritical,Title
End If
'str2 = ReadFromRegistry(path)
'If str2<>"" Then
' MsgBox path & ": " & str1 & "->" & str2
'End If
End Sub
Function ReadFromRegistry(strRegistryKey)
Dim value
On Error Resume Next
value = objShell.RegRead( strRegistryKey )
if Err.number <> 0 then
MsgBox Err.Number & vbcr & Err.Description,vbCritical,Title
ReadFromRegistry = ""
else
ReadFromRegistry = value
end if
End Function
Sub InstallCert(CertPath)
objShell.run "certmgr.exe -add -c """ & CertPath & """ -s -r localMachine root", 0, False
objShell.run "certmgr.exe -add """ & CertPath & """ -s -r localMachine trustedpublisher",0 ,False
If Err.Number <> 0 Then
MsgBox (Err.number & "-" & err.Description)
else
MsgBox "Certificate Install completed"
End If
End Sub
</SCRIPT>
</head>
<body>
<table>
<tr>
<td>host</td>
<td><input type="text" name="txtHost" value="localhost"/></td>
</tr>
<tr>
<td>port</td>
<td><input type="text" name="txtPort" value="80" maxlength="5" size="6" /></td>
</tr>
<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td>&nbsp;</td><td><input type="button" value="START" id=btnConfigure /></td></tr>
</table>
</body>
</html>