/var/opt/nydus/ops/customer_local_ops/operating_system/powershell
NameSizeModeActions
add_user.ps121790644editdlrm
add_user_to_group.ps18930644editdlrm
change_password.ps116400644editdlrm
collect_packages.ps144750644editdlrm
collect_processes_services.ps17470644editdlrm
configure_port.ps115030644editdlrm
cpu_utilization.ps11410644editdlrm
enable_winexe.ps111960644editdlrm
extend_disk.ps120670644editdlrm
get_disk_info.ps155280644editdlrm
get_system_info.ps129770644editdlrm
install_devcon.ps133460644editdlrm
install_panopta.ps11880644editdlrm
install_qemu_agent.ps122850644editdlrm
memory_utilization.ps11800644editdlrm
reset_vm_properties.ps15200644editdlrm
setNetwork.ps130270644editdlrm
shutdown_ovh_vm.ps19580644editdlrm
update_invalid_resolvers.ps153700644editdlrm
Edit: /var/opt/nydus/ops/customer_local_ops/operating_system/powershell/install_devcon.ps1 (3346B)
param( [Parameter(Mandatory)] [String] $package_url, [Parameter(Mandatory)] [String] $vertDriver_url ) function Retry-Download { [cmdletbinding()] param([parameter(ValueFromPipeline)][ValidateNotNullorEmpty()][string]$url, [ValidateNotNullorEmpty()][string]$storageDir = "C:\\Windows\\Temp", [ValidateNotNullorEmpty()][int]$maxDownloadAttemptsCount = 20) begin { # We need this change to be able to make requests to urls (e.g. http://hfs-public.secureserver.net), as non-encrypted requests are blocked [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls11 -bor [System.Net.SecurityProtocolType]::Tls12; $webclient = New-Object System.Net.WebClient } Process { $filename = $url.Substring($url.LastIndexOf('/') + 1) if ($filename.indexof('?') -gt -1) { $filename = $filename.split('?')[0] } $file = "$storageDir\\$filename" $count = 0 do { $lastErrMsg = "" start-sleep -seconds ($count * 10) "Downloading: $file Attempt: $($count+1)" try { $webclient.DownloadFile($url, $file) } catch { $lastErrMsg = $_.Exception.Message "$lastErrMsg" } $count++ }while (($count -lt $maxDownloadAttemptsCount) -and (($lastErrMsg -like "*The remote name could not be resolved:*") -or ($lastErrMsg -like "*Unable to connect to the remote server*") -or ($lastErrMsg -like "*The remote server returned an error: (404) Not Found.*"))) if ($lastErrMsg -ne "") { "$lastErrMsg" } } } function InstallDriver { try { Start-Process -Wait -FilePath "C:\Windows\Temp\virtio-win-gt-x64.msi" -ArgumentList "/quiet" } catch { $_.Exception.Message exit 1 } } function IsDevInitialized { $state = 1 try { $state = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\vioscsi' -Name Start).Start } catch { $state = 1 } return $state } function RemoveDriver { try { Start-Process -FilePath "C:\Windows\Temp\devcon.exe" -ArgumentList "install", '"C:\Program Files\Virtio-Win\Vioscsi\vioscsi.inf"', '"PCI\VEN_1AF4&DEV_1048&SUBSYS_11001AF4&REV_01"' -NoNewWindow $devID = (Get-PnpDevice -Class SCSIAdapter -FriendlyName 'Red Hat VirtIO*' | Select-Object *).HardwareID[0] if ($devID -ne $null) { Start-Process -Wait -FilePath "C:\Windows\Temp\devcon.exe" -ArgumentList "remove $devID" -NoNewWindow $status = IsDevInitialized if ($status -ne 0) { return $false } } else { return $false } } catch { return $false } return $true } Retry-Download $package_url Retry-Download $vertDriver_url $status = IsDevInitialized if ($status -ne 0) { echo "not Initialize" InstallDriver } $path = Test-Path 'C:\Program Files\Virtio-Win\Vioscsi\vioscsi.inf' if ($path -is [bool] ) { $dev = RemoveDriver if ($dev -is [bool]) { exit 0 } else { exit 1 } }