Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Setup]
- AppName=My Program
- AppVersion=1.5
- DefaultDirName={pf}\My Program
- DisableFinishedPage=yes
- OutputDir=C:\Temp
- [Code]
- var
- NeedRestartFlag: Boolean;
- procedure CurStepChanged(CurStep: TSetupStep);
- var
- ResultCode: Integer;
- begin
- if CurStep = ssInstall then
- begin
- if (FileExists('C:\Windows\System32\bash.exe')) then
- begin
- NeedRestartFlag := True
- Exec(ExpandConstant('dism.exe'), '/quiet /NoRestart /online /Enable-Feature /featurename:Microsoft-Windows-Subsystem-Linux', '', SW_HIDE, ewNoWait, ResultCode);
- Sleep(850)
- end
- else
- begin
- NeedRestartFlag := False
- end
- end;
- end;
- function NeedRestart(): Boolean;
- begin
- if NeedRestartFlag then
- begin
- Log('Need restart');
- Result := True;
- end
- else
- begin
- Log('Do not need restart');
- Result := False;
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement