Skip to content

Run your update commands in parallel via a config file

License

Notifications You must be signed in to change notification settings

Douile/parallel-updater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parallel updater (WIP)

This program allows you to define commands to run an update (e.g. pacman -Syu) and then run them in parallel. The added benefit of this program over a shell script is that it has knowledge of the requirements of each update:

  • Whether input is needed (e.g. to confirm updates or enter sudo password)
  • Whether root is needed (through sudo or other means)
  • Dependencies and conflicts
    • Which updates need another update to run first
    • Which cannot run at the same time as others (e.g. AUR update/repo update)

Using this knowledge it greedily chooses which to run next aiming for maximum parallelism (things that need input cannot run at same time, but when an update is done needing input another update that needs input can start).

Features

  • Parallel CLI updates
  • Greedy update selection based on STDIN usage
  • Config file parsing
  • Input needed detection (Based on stdout)
  • Use the update's ID for nicer logging
  • STDIN read detection (buffer empty / unbuffered pipe)
  • Sudo keep-alive (see paru)
  • Call programs via dynamic libraries rather than CLI (e.g. libparu)
  • Save update logs to files
  • Notify user when input is needed
  • Notify user when updates are done / run a specific command when updates are done
  • Priority configuration (which to run first)
  • Better live status of what is currently being updated (when stdin not in use)
    • When stdin not in use allow cancelling of updates via user input
  • CLI update filtering
    • Group configuration (allow running updates in specific groups)
    • Ignore specific updates

Configuring

When you run the program it looks for a file called updates.toml in the current directory, or in ~/.config/parallel-update-cli/updates.toml (This can be overriden with the --config-file [file] option).

The config file format is yet to be finalized but currently it is:

Program configuration

[updater]
# ...

Fields§

§output_duration: bool

Output how long each update took

§output_success_logs: bool

Output stdout/stderr for successful updates

§output_failure_logs: bool

Output stdout/stderr for failed updates

§output_states: bool

Output update states

§threads: usize

Number of updates to run at once

§debug_config: bool

Debug config

Invividual update configuration

[update.id]
# ...

Fields§

§kind: UpdateKind

The kind of the update

§input: bool

Whether the update requires exclusive input

§root: bool

Whether the update uses a program that gives root (e.g. sudo)

§conflicts: Vec<String>

Updates that cannot run at the same time (order doesn’t matter)

§depends: Vec<String>

Updates that must run before

§exe: String

Path to executable of program

§argv: Option<Vec<String>>

Optional arguments for the program

§environ: Option<Vec<(String, String)>>

Optional extra environment variables for the program

§working_directory: Option<String>

The directory the program should be executed in

§passthrough_environ: bool

Whether to past through the host programs environment.

UpdateKind§

pub enum UpdateKind {
    Default,
    Paru,
    Input,
}

Contributing

All contributions are welcome:

License

All code is made available under the MIT License, contributions should be made available under a compatible license.

About

Run your update commands in parallel via a config file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages