| Crates.io | uni-updater |
| lib.rs | uni-updater |
| version | 0.2.4 |
| created_at | 2025-04-12 15:11:49.346672+00 |
| updated_at | 2025-04-23 02:38:12.302382+00 |
| description | Helper program that updates everything on your system. |
| homepage | https://codeberg.org/TTsdzb/uni-updater |
| repository | https://codeberg.org/TTsdzb/uni-updater |
| max_upload_size | |
| id | 1631021 |
| size | 75,906 |
Helper program that updates everything on your system.
The program reads $XDG_CONFIG_HOME/uni-updater.yml or $HOME/.config/uni-updater.yml by default on Linux. You can also specify a config path with --config flags.
cargo install --git https://codeberg.org/TTsdzb/uni-updater.git --locked
Go to the Releases and download the binary file, then put it in your $PATH.
The default path of the config file is shown in the following table. You can also explicitly specify the path with --config flag.
| Platform | Path | Example |
|---|---|---|
| Linux | $XDG_CONFIG_HOME/uni-updater.yml or $HOME/.config/uni-updater.yml |
/home/alice/.config/uni-updater.yml |
| macOS | $HOME/Library/Application Support/uni-updater.yml |
/Users/Alice/Library/Application Support/uni-updater.yml |
| Windows | %APPDATA%\uni-updater.yml |
C:\Users\Alice\AppData\Roaming\uni-updater.yml |
The config file mainly contains two parts. templates defines how a thing should be updated, and sequences are implements of the template. They can be compared to classes and objects in object-oriented languages. There is also a global_envs field for convenience.
global_envsGlobally set environment variables during execution. These variables are applied to every command of every sequence, and could be overwritten by sequence level environment variables.
global_envs:
all_proxy: http://127.0.0.1:7890/"
http_proxy: http://127.0.0.1:7890/"
https_proxy: http://127.0.0.1:7890/"
ftp_proxy: http://127.0.0.1:7890/"
templatesTemplates defines the sequence of command when you update something. Just like its name, it supports interpolation for reuse.
Templates are indexed by name. A template must contains a command attribute, which is an array that defines the order of commands. The commands are executed sequencially when updating. Each element of command has a prog indicating the executable name, and an optional args indicating the arguments in array. Take these examples:
templates:
yay: # Template name
commands:
- prog: "yay"
rustup:
commands:
- prog: "rustup"
args: ["update"]
tlmgr:
commands:
- prog: "tlmgr"
args: ["update", "all"]
zim:
commands:
- prog: "zsh"
args: ["-i", "-c", "zimfw upgrade"]
- prog: "zsh"
args: ["-i", "-c", "zimfw update"]
A template may have an optional wd attribute to set the working directory when executing commands. If this attribute is not present, commands will inherit the updater's working directory.
templates:
neovim:
wd: "/home/ttsdzb/.config/nvim"
commands:
- prog: "git"
args: ["pull"]
Templates can also have an optional envs arrtibute for environment variables during its execution. If a variable got the same name with a global one, it will replace the global one.
templates:
docker:
wd: "/home/ttsdzb/%{dir}"
envs:
all_proxy: "http://127.0.0.1:10808" # Use a different proxy here
commands:
- prog: "docker-compose"
args: ["pull"]
Every string in a template can have patterns for replacement. The pattern starts with a % followed by the value name in braces. The pattern will be replaced to corresponding values in sequences.
templates:
remote:
commands:
- prog: "ssh"
args: ["-t", "%{hostname}", "~/.local/bin/uni-updater -c %{color}"]
sequencesSequences are actually executed by the updater. A sequence contains a name to be displayed in the logs, a template to use, and (optional) values to replace. The values could be emitted if there's no pattern to replace in the corresponding template.
sequences:
- name: "System Update"
template: yay
- name: "Dell Wyse Remote Update"
template: remote
values:
hostname: "wyse"
color: "12"
- name: "Frp Server Remote Update"
template: remote
values:
hostname: "frp"
color: "13"
- name: "bwg-la Remote Update"
template: remote
values:
hostname: "bwg-la"
color: "14"
Note: The updater will not prevent execution if a pattern is left without a value! In this case, the pattern will be left untouched, causing unexpected behaviors.
This also indicates that you don't have to escape your characters when writing templates.
global_envs:
all_proxy: http://127.0.0.1:7890/"
http_proxy: http://127.0.0.1:7890/"
https_proxy: http://127.0.0.1:7890/"
ftp_proxy: http://127.0.0.1:7890/"
templates:
yay:
commands:
- prog: "yay"
rustup:
commands:
- prog: "rustup"
args: ["update"]
tlmgr:
commands:
- prog: "tlmgr"
args: ["update", "all"]
zim:
commands:
- prog: "zsh"
args: ["-i", "-c", "zimfw upgrade"]
- prog: "zsh"
args: ["-i", "-c", "zimfw update"]
neovim:
wd: "/home/ttsdzb/.config/nvim"
commands:
- prog: "git"
args: ["pull"]
remote:
commands:
- prog: "ssh"
args: ["-t", "%{hostname}", "~/.local/bin/uni-updater -c %{color}"]
sequences:
- name: "System Update"
template: yay
- name: "Rust Toolchain Update"
template: rustup
- name: "TeX Live Update"
template: tlmgr
- name: "Zim Update"
template: zim
- name: "Neovim Config Update"
template: neovim
- name: "Dell Wyse Remote Update"
template: remote
values:
hostname: "wyse"
color: "12"
- name: "Frp Server Remote Update"
template: remote
values:
hostname: "frp"
color: "12"
- name: "Web Server Remote Update"
template: remote
values:
hostname: "web"
color: "12"
Mainly from topgrade's source code, but also from @hour-keeper's experience.
A simple way to update system
yay:
commands:
- prog: "yay"
paru:
commands:
- prog: "paru"
apt:
commands:
- prog: "sudo"
args: ["apt", "update"]
- prog: "sudo"
args: ["apt", "upgrade"]
paru:
commands:
- prog: "sudo"
args: ["pacman", "-Syu"]
A .pacnew file processing tool(also support Gentoo, but Gentoo Wiki not recommand it.)
etc-update:
commands:
- prog: "sudo"
args: ["etc-update"]
Everyday-use client-side map-aware mirror ranking tool (Arch Linux; Manjaro; custom ones)
For example, in Arch:
rate-mirrors:
commands:
- prog: "sudo"
args:
[
"rate-mirrors",
"--save",
"/etc/pacman.d/%{save}",
"--allow-root",
"%{repo}",
]
- name: "Rate Mirrors Arch"
template: rate-mirrors
values:
save: "mirrorlist"
repo: "arch"
- name: "Rate Mirrors Archlinuxcn"
template: rate-mirrors
values:
save: "archlinuxcn-mirrorlist"
repo: "archlinuxcn"
- name: "Rate Mirrors Chaotic-AUR"
template: rate-mirrors
values:
save: "chaotic-mirrorlist"
repo: "chaotic-aur"
Rust toolchain manager.
rustup:
commands:
- prog: "rustup"
args: ["update"]
Rust package manager. Cargo is not really a software manager as it seems, but here are two tools cargo-update cargo-cache provides this functionality.
cargo:
commands:
- prog: "cargo"
args: ["install-update", "-a"]
- prog: "cargo"
args: ["cache", "--autoclean"]
linux firmware update tool.
fwupd:
commands:
- prog: "sudo"
args: ["fwupdmgr", "refresh"]
- prog: "sudo"
args: ["fwupdmgr", "update"]
Collaborative cheatsheets for console commands.
The official tldr-pages client written in Rust.
tldr:
commands:
- prog: "tldr"
args: ["--update"]
Recommended way to install single pip package as a utility.
pipx:
commands:
- prog: "pipx"
args: ["upgrade-all"]
A dotfiles management tool
chezmoi:
commands:
- prog: "chezmoi"
args: ["update"]
One of the best node.js packages managers.
pnpm:
commands:
- prog: "pnpm"
args: ["update", "-g"]
gitup:
commands:
- prog: "gitup"
args: ["~/src", "~/.emacs.d", "~/.zsh"]
Updating a remote server.
remote:
commands:
- prog: "ssh"
args: ["-t", "%{hostname}", "/usr/local/bin/uni-updater -c %{color}"]
needrestart checks which daemons need to be restarted after library upgrades.
It is known that the software has been added to the debian package with a hook to automatically execute after apt upgrade, but the Arch package only provides a pacman hook to show changes, which requires a separate execution of needrestart in order to restart the service and so on.
restart:
commands:
- prog: "sudo"
args: ["needrestart", "-r", "a"]
An easy-to-use environment for building, installing and running native Windows software.
msys2:
commands:
- prog: "C:\\msys64\\usr\\bin\\bash"
args: ["-lc", "pacman -Syu"]
- prog: "C:\\msys64\\usr\\bin\\bash"
args: ["-lc", "etc-update"]
Because serde_yml's YAML Anchors and Aliases support is temporarily unreleased, Some YAML Anchors and Aliases syntax like &p <<: *p are not available in the current version of the software.