83 lines
2.5 KiB
TeX
83 lines
2.5 KiB
TeX
[Initial]
|
|
Message=Installiere MDG Visual Studio Code...
|
|
DefVar $Version$
|
|
DefVar $ExitCode$
|
|
DefVar $CreateContextMenuEntry$
|
|
DefVar $ContextMenuArguments$
|
|
DefVar $CreateDesktopShortcut$
|
|
DefVar $DesktopShortcutArgument$
|
|
DefVar $ExtensionList$
|
|
|
|
[Aktionen]
|
|
ShowBitmap "%ScriptPath%\logo.png" "MDG Visual Studio Code"
|
|
Sub_GetProperties
|
|
Sub_ConfigureProperties
|
|
Sub_PrepareInstall
|
|
WinBatch_Setup
|
|
DosInAnIcon_AfterInstall
|
|
Sub_CopySettings
|
|
DosInAnIcon_Extensions
|
|
Sub_HandleExitCode
|
|
|
|
[Sub_GetProperties]
|
|
Set $Version$ = GetValue("productversion", GetProductMap)
|
|
Set $CreateContextMenuEntry$ = GetProductProperty("contextmenuentry", "false")
|
|
Set $CreateDesktopShortcut$ = GetProductProperty("desktopshortcut", "false")
|
|
Set $ExtensionList$ = GetProductProperty("extensions", "")
|
|
|
|
[Sub_ConfigureProperties]
|
|
if ($CreateContextMenuEntry$ = "true")
|
|
Set $ContextMenuArguments$ = ", addcontextmenufiles, addcontextmenufolders"
|
|
else
|
|
Set $ContextMenuArguments$ = ", !addcontextmenufiles, !addcontextmenufolders"
|
|
endif
|
|
|
|
if ($CreateDesktopShortcut$ = "true")
|
|
Set $DesktopShortcutArgument$ = ", desktopicon"
|
|
else
|
|
Set $DesktopShortcutArgument$ = ", !desktopicon"
|
|
endif
|
|
|
|
[Sub_PrepareInstall]
|
|
if (processIsRunning("Code.exe"))
|
|
comment "Killing Process..."
|
|
Killtask "Code.exe"
|
|
sleepSeconds 3
|
|
endif
|
|
|
|
[WinBatch_Setup]
|
|
%ScriptPath%\data\VSCodeSetup-x64-$Version$.exe /VERYSILENT /SUPPRESSMSGBOXES /MERGETASKS="!runcode$ContextMenuArguments$$DesktopShortcutArgument$" /LOG="%opsiLogDir%\vscode-install.log"
|
|
|
|
[DosInAnIcon_AfterInstall]
|
|
; Apply patch to product.json
|
|
; 1. disables telemetry
|
|
; 2. removes "target": "system"
|
|
%ScriptPath%\utils\patch.exe "%ProgramFiles64Dir%\Microsoft VS Code\resources\app\product.json" %ScriptPath%\product.json.diff
|
|
; Create directory for user and extension data
|
|
mkdir "%ProgramFiles64Dir%\Microsoft VS Code\data"
|
|
icacls "%ProgramFiles64Dir%\Microsoft VS Code\data" /grant Benutzer:(OI)(CI)(M,DC) /T > nul
|
|
|
|
[Sub_CopySettings]
|
|
; Disables automatic updates
|
|
; Disables telemetry
|
|
if not (FileExists("%ProgramFiles64Dir%\Microsoft VS Code\data\user-data\User\settings.json"))
|
|
comment "Copying default config file"
|
|
Files_CopySettings
|
|
endif
|
|
|
|
[Files_CopySettings]
|
|
copy "%ScriptPath%\settings.json" "%ProgramFiles64Dir%\Microsoft VS Code\data\user-data\User"
|
|
|
|
|
|
[DosInAnIcon_Extensions]
|
|
"%ScriptPath%\generateExtensionArguments.bat" $ExtensionList$
|
|
|
|
[Sub_HandleExitCode]
|
|
; check return code
|
|
Set $ExitCode$ = GetLastExitCode
|
|
comment "GetLastExitCode: " + $ExitCode$
|
|
if not($ExitCode$ = "0")
|
|
LogError "Fatal: setup returned exit code " + $ExitCode$
|
|
IsFatalError
|
|
endif
|