softboiler / copier-pipeline

Copier template for research data pipelines
https://softboiler.org/copier-pipeline/
MIT License
4 stars 0 forks source link

Document `winget` usage in new computer setup guide #296

Closed blakeNaccarato closed 5 months ago

blakeNaccarato commented 1 year ago

The built-in Windows package manager winget is stable as of two weeks ago. Python and PowerShell 7 are available on it, as well as Git.

blakeNaccarato commented 1 year ago

The default installation isn't really appropriate, you can't configure anything. Will need to pass git executable the --override string from winget something like /components ... look at /verysilent flag and others, and this.

blakeNaccarato commented 1 year ago

Also this...

https://github.com/git-for-windows/build-extra/blob/5ffa2186171595299a63bdc12a4ae79cca40507c/installer/install.iss#L103-L115

blakeNaccarato commented 1 year ago

Python default install is also not appropriate. It's added to PATH which is risky.

blakeNaccarato commented 1 year ago

Here's a wiki page https://github.com/git-for-windows/git/wiki/Silent-or-Unattended-Installation

blakeNaccarato commented 1 year ago

Also need to override PowerShell install to add context menu entries.

blakeNaccarato commented 1 year ago

The proper command to install PowerShell with all the options enabled is below. ~The /quiet install option had to be omitted due to Installer failed with exit code: 1603, which suggests that the app is already installed, even though it isn't.~ Omitting /quiet ticks all the appropriate boxes, and the user can be instructed to just click "Next" through the process.

Actually, /quiet is fine as long as the prompt used to install this is elevated. Be sure to indicate a "Run as administrator" prompt to bootstrap all this software with winget!

winget install --id Microsoft.PowerShell -s winget --override @'
/quiet
ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1
ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1
ADD_PATH=1
ENABLE_MU=1
ENABLE_PSREMOTING=1
REGISTER_MANIFEST=1
USE_MU=1
'@
blakeNaccarato commented 1 year ago

Need to see when winget upgrade is run whether override is necessary on upgrading, if context menu options will disappear, etc.

blakeNaccarato commented 1 year ago

Here's the proper command to install Terminal.

winget install --id Microsoft.WindowsTerminal -s winget
blakeNaccarato commented 1 year ago

This text file was created by Git<...>.exe /SAVEINF and can be loaded from a file with /LOADINF. Should add /VERYSILENT to the args, then try it from invoking the EXE directly. Then, see if it can be done with a here-string. Then, try that with a winget override. I don't think this needs to update gracefully with overrides, since we have elected for it to try updating it self daily.

This accomplishes a silent install with the Git installer progress bar showing, /VERYSILENT suppresses even that.

@'
[Setup]
Lang=default
Dir=C:\Program Files\Git
Group=Git
NoIcons=0
SetupType=default
Components=ext,ext\shellhere,ext\guihere,gitlfs,assoc,assoc_sh,autoupdate,windowsterminal,scalar
Tasks=
EditorOption=VisualStudioCode
CustomEditorPath=
DefaultBranchOption=main
PathOption=Cmd
SSHOption=OpenSSH
TortoiseOption=false
CURLOption=OpenSSL
CRLFOption=CRLFAlways
BashTerminalOption=MinTTY
GitPullBehaviorOption=Merge
UseCredentialManager=Enabled
PerformanceTweaksFSCache=Enabled
EnableSymlinks=Disabled
EnablePseudoConsoleSupport=Disabled
EnableFSMonitor=Enabled
'@ > ($inf = New-TemporaryFile)
winget install --id Git.Git -s winget --override "/SILENT /LOADINF=$inf"
blakeNaccarato commented 1 year ago

Need to document installing winget first-of-all, by trying to install from Microsoft Store first and, failing that, installing from the GitHub Releases. For instance, the installer for the latest winget at time of writing is available at this URL.

https://github.com/microsoft/winget-cli/releases/download/v1.4.10173/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle

Depending on the user's computer policy, App Installer may not be installable or runnable. So even though it is the recommended method for installing winget, it seems flaky.

blakeNaccarato commented 1 year ago

Need to work on installing C++ build tools while we're at it. Maybe not for default install, but an extended option?

winget search --id Microsoft.VisualStudio.2022.BuildTools -s winget
blakeNaccarato commented 1 year ago

Will leave a stub for equivalent Linux and Mac setup, and link to an issue to develop it later, or request help.

blakeNaccarato commented 1 year ago

Python install (e.g. Python 3.11) looks like this.

winget install -e --id Python.Python.3.11 --override "/quiet PrependPath=0"
blakeNaccarato commented 1 year ago

Bypass remote script signing requirement by having the user copy/paste the setup script into a file they've created themselves. Also discuss Developer setup.

blakeNaccarato commented 5 months ago

Alright, this is done now that the contributing guide details ground-up machine setup. Some more detail for non-Windows setups may be useful to add in the future, but this part is done.