topgrade-rs / topgrade

Upgrade all the things
GNU General Public License v3.0
2.05k stars 139 forks source link

Move steps requiring root password at the beginning #376

Open Crocmagnon opened 1 year ago

Crocmagnon commented 1 year ago

I want to suggest some general feature

Topgrade should run the steps requiring passwords at the beginning, so that users can leave an upgrade mostly unattended after it has started.

For example on macOS : tlmgr requires the root password and in my system it is typically run in the middle of the process:

── 08:47:15 - Summary ──────────────────────────────────────────────────────────
Brew (ARM): OK
Brew Cask (ARM): OK
fisher: OK
TLDR: OK
rustup: OK
cargo: OK
pipx: OK
tlmgr: OK
chezmoi: OK
npm: OK
Containers: OK
krew: OK
GitHub CLI Extensions: OK
System upgrade: OK

More information

Test process:

Same goes for all steps requiring a password.

ealap commented 1 year ago

Or if it becomes hard to keep track of which commands might need password/user prompts, let the users define the priority commands

priority = ["system", "commands", "tlmgr", "cargo", "tldr"]
Crocmagnon commented 1 year ago

Yes, I guess that would also solve the issue in a nice and easier way 👍🏻

SteveLauC commented 1 year ago

Hi @ConfusedSky, have you tried the pre_sudo option? This seems to be able to resolve this issue:

[misc]
pre_sudo = true

Once enabled, topgrade will execute sudo -v before updating other tools to cache the sudo credential.

$ topgrade

── 17:33:54 - Sudo ─────────────────────────────────────────────────────────────

# So that you don't need to input password for tools that require `sudo`