My topgrade setup to keep a Linux machine up to date and clean with one command.
topgrade detects what is installed and updates it: distro packages, snap,
flatpak, firmware, rustup and cargo binaries, VS Code extensions, git repos in
~/git/PUBLIC, docker images and more. topgrade.toml adds
the rest as custom commands: Go toolchain, snap revisions, pip cache, journal
logs, old trash and thumbnails, a reboot check and manual backup reminders.
-
Rust toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Build dependencies (
cargo installcompiles from source: it needs a C linker, and cargo-update links against OpenSSL):sudo apt install build-essential pkg-config libssl-dev # Debian/Ubuntu sudo dnf install gcc pkgconf openssl-devel # Fedora sudo pacman -S --needed base-devel openssl # Arch/Manjaro/CachyOS
-
topgrade, plus cargo-update so topgrade's
cargostep keeps topgrade itself (and every other cargo binary) up to date:cargo install topgrade cargo-update
Optional helpers that extend built-in steps:
cargo install cargo-cache # lets `cleanup` trim cargo's download cache go install github.com/nao1215/gup@latest # lets the `go` step update `go install` binaries
-
This repo:
git clone https://github.com/gelanchez/topgrade-config.git ~/git/PROJECTS/topgrade-configThe custom commands in
topgrade.tomlreferencescripts/by this path; if you clone elsewhere, update the paths there. -
Point topgrade at the config, pick one:
-
Symlink (recommended): plain
topgradeuses this config, and the file stays tracked in the repo.ln -s ~/git/PROJECTS/topgrade-config/topgrade.toml ~/.config/topgrade.toml
-
Alias: keeps
~/.configuntouched; add to~/.bashrc.alias upkeep='topgrade --config ~/git/PROJECTS/topgrade-config/topgrade.toml'
-
With the symlink (use upkeep instead of topgrade with the alias):
topgrade # full run; asks for the sudo password once
topgrade --dry-run # show what would run
topgrade --only system # run only the OS package manager step
topgrade --disable containers git_repos # run all steps except container images and git pullsSee topgrade --help for all options.
Built-in steps run only when their tool is installed, so a newly installed
tool is usually picked up without changes. topgrade --dry-run --show-skipped
lists every step and why it is skipped. For anything topgrade does not
support, add a line under [commands] in topgrade.toml, guarded with
command -v <tool> >/dev/null || exit 0; so it is skipped where the tool is
missing.