Major rework: added Makefile, product.json.diff; added abbility to install extensions automatically; etc.

This commit is contained in:
Kevin Dorner 2020-11-02 23:38:15 +01:00 committed by root
parent d4cee90c4a
commit 677c876dc8
7 changed files with 121 additions and 5 deletions

36
Makefile Normal file
View File

@ -0,0 +1,36 @@
#Config
UPSTREAM_VERSION = 1.50.1
PKG_SUB_RELEASE = 1.0
PKG_FULL_VERSION = ${UPSTREAM_VERSION}-${PKG_SUB_RELEASE}
SOURCE = https://az764295.vo.msecnd.net/stable/d2e414d9e4239a252d1ab117bd7067f125afd80a/VSCodeSetup-x64-${UPSTREAM_VERSION}.exe
CHECKSUM = 0180288d4a51497224997ce0491b1f7335747df3ce858ae9f73458f81f782156
## Download Link and Checksums can be found on https://code.visualstudio.com/Download
install: clean
@[ -d "./data/" ] || mkdir ./data/
@echo "Downloading the VSCode executable..."
@wget -O ./data/VSCodeSetup-x64-${UPSTREAM_VERSION}.exe ${SOURCE}
@echo "${CHECKSUM} ./data/VSCodeSetup-x64-${UPSTREAM_VERSION}.exe" | sha256sum -c && echo "SUCCESS: Checksums match" || { ec=$$?; echo "ERROR: Checksum mismatch" >&2; exit $$ec; }
@[ -d "./utils/" ] || mkdir ./utils/
@echo "Downloading Utilities..."
## Installing diff.exe and patch.exe from https://sourceforge.net/projects/unxutils/files/unxutils/current/
@wget -O ./utils/UnxUtils.zip https://jztkft.dl.sourceforge.net/project/unxutils/unxutils/current/UnxUtils.zip
@echo "f6a83c372110276f535a1963fa9701a547ef5342 ./utils/UnxUtils.zip" | sha1sum -c && echo "SUCCESS: Checksums match" || { ec=$$?; echo "ERROR: Checksum mismatch" >&2; exit $$ec; }
@echo "Extracting diff.exe from archive..."
@unzip -p ./utils/UnxUtils.zip usr/local/wbin/diff.exe > ./utils/diff.exe
@echo "Extracting patch.exe from archive..."
@unzip -p ./utils/UnxUtils.zip usr/local/wbin/patch.exe > ./utils/patch.exe
@echo "Removing temp archive..."
@rm -f ./utils/UnxUtils.zip
clean:
@echo "Cleaning ./data/"
@rm -rf ./data/
@echo "Cleaning ./utils/"
@rm -rf ./utils/
package:
@echo "MEEP!"
.PHONY: install clean package

View File

@ -3,7 +3,7 @@ type: localboot
id: mdg-visual-studio-code
name: MDG Visual Studio Code
description: VSCode ist eine von Microsoft entwickelte, weit verbreitete Entwicklungsumgebung mit Unterstützung für eine Vielzahl an Erweiterungen. Der Großteil des Programms ist quelloffen.
advice: Erweiterungen werden im Verzeichnes %USERPROFILE%\.vscode\extensions und somit im Windows-Profil des Nutzers installiert.
advice: Erweiterungen und alle Einstellungen werden im data Verzeichnis gespeichert und sind somit für alle Nutzer des Computers gleich.
version: 1.50.1
packageVersion: 1.0
setupScript: install.ins
@ -27,3 +27,10 @@ type: bool
description: Windows-Explorer Kontextmenüeintrag erstellen
helptext: Dieser Kontextmenüeintrag wird für Dateien und Ordner im Windows-Explorer erzeugt.
default: False
[ProductProperty]
name: extensions
type: unicode
description: Eindeutiger Identifikator der zu installierenden Erweiterungen.
helptext: Die Erweiterungen werden einmalig bei der Installation des Programms installiert. Zum Hinzufügen von neuen Erweiterungen kann einfach eine Neuinstallation vorgenommen werden. Der Identifier wird mit Kommata getrennt und kann auf https://marketplace.visualstudio.com/ unter Unique Identifier entnommen werden. Nutzer können weiterhin Erweiterungen über die GUI installieren und deinstallieren.
pattern: ritwickdey.LiveServer, felixfbecker.php-pack, formulahendry.auto-rename-tag

View File

@ -0,0 +1,14 @@
@echo off
:: Skip extension installation if none are being passed on
if "%~1"=="" (
echo INFO: No arguments were passed - skipping extension installation
goto :eof
) else echo INFO: Arguments were passed - extensions are being installed
:: Loop through all extensions and prepend --install-extension; then set it as %allExtensions%
for /f "tokens=*" %%i in ('cmd /v /c "set allExtensions= &&(@for %%a in (%*) do @set allExtensions=!allExtensions! --install-extension %%a) && echo!allExtensions!"') do set allExtensions=%%i
:: Execute code command with generated args
echo INFO: Executing "%ProgramW6432%\Microsoft VS Code\bin\code.cmd %allExtensions% --force"
"%ProgramW6432%\Microsoft VS Code\bin\code.cmd" %allExtensions% --force

View File

@ -6,6 +6,7 @@ DefVar $CreateContextMenuEntry$
DefVar $ContextMenuArguments$
DefVar $CreateDesktopShortcut$
DefVar $DesktopShortcutArgument$
DefVar $ExtensionList$
[Aktionen]
ShowBitmap "%ScriptPath%\logo.png" "MDG Visual Studio Code"
@ -13,12 +14,16 @@ 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")
@ -43,9 +48,29 @@ endif
[WinBatch_Setup]
%ScriptPath%\data\VSCodeSetup-x64-$Version$.exe /VERYSILENT /SUPPRESSMSGBOXES /MERGETASKS="!runcode$ContextMenuArguments$$DesktopShortcutArgument$" /LOG="%opsiLogDir%\vscode-install.log"
; VERYSILENT unterdrückt das Installationsfenster
; SUPPRESSMSGBOXES unterdrückt Benachrichtigungsfenster
; MERGETASKS verhindert das automatische Starten des Programms nach der Installation
[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

21
product.json.diff Normal file
View File

@ -0,0 +1,21 @@
--- product.json Tue Oct 13 14:30:48 2020
+++ product-modified.json Thu Oct 29 15:22:46 2020
@@ -936,7 +936,7 @@
"linux-x64": "appcenter://code?aid=fba07a4d-84bd-4fc8-a125-9640fc8ce171",
"darwin": "appcenter://code?aid=860d6632-f65b-490b-85a8-3e72944f7774"
},
- "enableTelemetry": true,
+ "enableTelemetry": false,
"aiConfig": {
"asimovKey": "AIF-444c3af9-8e69-4462-ab49-4191e6ad1916"
},
@@ -1214,6 +1214,5 @@
"vs/code/electron-browser/workbench/workbench.html": "DCAx76TE79oJvbVEouBCXQ",
"vs/code/electron-browser/workbench/workbench.js": "EWRP4AdsNbp965Vz0YEmAA"
},
- "settingsSearchBuildId": 1500100728140,
- "target": "system"
-}
\ No newline at end of file
+ "settingsSearchBuildId": 1500100728140
+}

View File

@ -1,11 +1,13 @@
[Initial]
Message=Deinstalliere MDG Visual Studio Code...
DefVar $ExitCode$
DefVar $UninstallExecutablePath$
[Aktionen]
ShowBitmap "%ScriptPath%\logo.png" "MDG Visual Studio Code"
Sub_PrepareRemove
WinBatch_Setup
Files_Cleanup
Sub_HandleExitCode
[Sub_PrepareRemove]
@ -15,12 +17,18 @@ if (processIsRunning("Code.exe"))
sleepSeconds 3
endif
; Retrieve Uninstall executable Path
Set $UninstallExecutablePath$ = getRegistryValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{EA457B21-F73E-494C-ACAB-524FDE069978}_is1", "UninstallString","64bit")
[WinBatch_Setup]
"%ProgramFiles64Dir%\Microsoft VS Code\unins000.exe" /VERYSILENT /SUPPRESSMSGBOXES /LOG="%opsiLogDir%\vscode-uninstall.log"
$UninstallExecutablePath$ /VERYSILENT /SUPPRESSMSGBOXES /LOG="%opsiLogDir%\vscode-uninstall.log"
; VERYSILENT unterdrückt das Installationsfenster
; SUPPRESSMSGBOXES unterdrückt Benachrichtigungsfenster
[Files_Cleanup]
delete -sf "%ProgramFiles64Dir%\Microsoft VS Code\"
[Sub_HandleExitCode]
; check return code
Set $ExitCode$ = GetLastExitCode

5
settings.json Normal file
View File

@ -0,0 +1,5 @@
{
"telemetry.enableTelemetry": false,
"telemetry.enableCrashReporter": false,
"update.mode": "none"
}