Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows installer script should be transactional #991

Open
andreasabel opened this issue Jan 28, 2024 · 1 comment
Open

Windows installer script should be transactional #991

andreasabel opened this issue Jan 28, 2024 · 1 comment

Comments

@andreasabel
Copy link
Member

I tried the Windows Setup script at https://haskell.org/ghcup .

Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; try { Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $true } catch { Write-Error $_ }

It asked me questions with the option to "Abort". I chose Abort after I already had answered "Reinstall" to GHCup. As a consequence, the original installation had been backed up from C:\ghcup to a temporary directory and there was a new C:\ghcup which was empty except for a bin subfolder.

So, you cannot really "Abort" in the middle. It is more like Hotel California:

You can check out at any time, but you can never leave.

I think such an installer should not interleave gathering information from the user and acting upon it.
Instead, it should prepare a transaction and then commit it. So, first gather the necessary information, then make a plan, and then execute the plan once it is clear that one can go through with it.
As it stands, a user having second thoughts and wanting to abort may end up in a broken state. Moreover, as it installs itself to global locations like C:\ghcup, it will be broken for all users on that machine.

@hasufell
Copy link
Member

The linux bootstrap script essentially works like that. PRs welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants