Skip to content

Commit

Permalink
Merge pull request #1900 from luckyh/winupdate
Browse files Browse the repository at this point in the history
finish.bat: Add optional step to accomplish windows updates
  • Loading branch information
luckyh authored Jul 22, 2019
2 parents abc6fed + 3514f4e commit edc0ff1
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 33 deletions.
77 changes: 44 additions & 33 deletions shared/deps/finish/finish.bat
Original file line number Diff line number Diff line change
@@ -1,33 +1,44 @@
taskkill /IM serialport.exe /F

:check_net
if [%2]==[] goto check_process

set ping_host=%2
echo Check network status > COM1
ping %ping_host%

if errorlevel 1 goto check_net

:check_process
if [%1]==[] goto end

set process=%1
echo Check %process% status > COM1
tasklist /FO List> C:\log
type C:\log|find "%process%"

if errorlevel 1 goto end
if errorlevel 0 goto check_process

:end
reg add "HKLM\System\CurrentControlSet\Control\CrashControl" /v AutoReboot /d 0 /t REG_DWORD /f
reg add "HKLM\System\CurrentControlSet\Control\CrashControl" /v CrashDumpEnabled /d 2 /t REG_DWORD /f
reg add "HKLM\System\CurrentControlSet\Control\CrashControl" /v NMICrashDump /d 1 /t REG_DWORD /f
reg add "HKLM\System\CurrentControlSet\Control\CrashControl" /v DumpFile /d %SystemRoot%\Memory.dmp /t REG_EXPAND_SZ /f
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /v bsod /d "D:\autoit3.exe D:\dump_control.au3" /t REG_SZ /f
reg add "HKLM\System\CurrentControlSet\Control\CrashControl" /v AlwaysKeepMemoryDump /d 1 /t REG_DWORD /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\Windows Error Reporting" /v Disabled /d 1 /t REG_DWORD /f
reg add "HKLM\SYSTEM\CurrentControlSet\Services\vds" /v Start /t REG_DWORD /d 3 /f

for /L %%i in (1,1,3) do (echo Post set up finished> COM1)
taskkill /IM serialport.exe /F

if [%~3]==[-AccomplishWinUpdates] (
set has_update=1
) else (
set has_update=0
)

:check_net
if [%~2]==[] goto check_process

set ping_host=%~2
echo Check network status > COM1
ping %ping_host%

if errorlevel 1 goto check_net

:check_process
if [%~1]==[] goto end

set process=%~1
echo Check %process% status > COM1
tasklist /FO List> C:\log
type C:\log|find "%process%"

if errorlevel 1 goto end
if errorlevel 0 goto check_process

:end
reg add "HKLM\System\CurrentControlSet\Control\CrashControl" /v AutoReboot /d 0 /t REG_DWORD /f
reg add "HKLM\System\CurrentControlSet\Control\CrashControl" /v CrashDumpEnabled /d 2 /t REG_DWORD /f
reg add "HKLM\System\CurrentControlSet\Control\CrashControl" /v NMICrashDump /d 1 /t REG_DWORD /f
reg add "HKLM\System\CurrentControlSet\Control\CrashControl" /v DumpFile /d %SystemRoot%\Memory.dmp /t REG_EXPAND_SZ /f
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Run" /v bsod /d "D:\autoit3.exe D:\dump_control.au3" /t REG_SZ /f
reg add "HKLM\System\CurrentControlSet\Control\CrashControl" /v AlwaysKeepMemoryDump /d 1 /t REG_DWORD /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\Windows Error Reporting" /v Disabled /d 1 /t REG_DWORD /f
reg add "HKLM\SYSTEM\CurrentControlSet\Services\vds" /v Start /t REG_DWORD /d 3 /f

if [%has_update%]==[1] (
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v PostSetupEvent /d "cmd /c """for %%i in ^(1,1,5^) do ^(echo Post set up finished^> COM1^)"" /t REG_SZ /f
shutdown /r /f /t 0
) else (
for /L %%i in (1,1,3) do (echo Post set up finished> COM1)
)
4 changes: 4 additions & 0 deletions virttest/tests/unattended_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ def __init__(self, test, params, vm):
for a in self.attributes:
setattr(self, a, params.get(a, ''))

# Make finish.bat work well with positional arguments
if not self.process_check.strip(): # pylint: disable=E0203
self.process_check = '""' # pylint: disable=E0203

# Will setup the virtio attributes
v_attributes = ['virtio_floppy', 'virtio_scsi_path',
'virtio_storage_path', 'virtio_network_path',
Expand Down

0 comments on commit edc0ff1

Please sign in to comment.