Skip to content
forked from rami3l/pacaptr

Pacman syntax wrapper for homebrew, chocolatey, apt/dpkg, and more

License

Notifications You must be signed in to change notification settings

lynzrand/pacaptr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pacaptr

Rust Badge Arch Linux Badge

pacaptr is a Rust port of icy/pacapt, a wrapper for many package managers with pacman-style command syntax.

Run pacaptr -Syu on the distro of your choice!

Interface Concept

- It's nice, but wait, why reinstall?
- To be more like pacman! Use -S --needed to install.

Contents

Supported Package Managers

  • Windows/chocolatey
  • macOS/homebrew (with auto cask invocation)
  • macOS/macports
  • Debian/apt
  • Alpine/apk
  • RedHat/dnf
  • SUSE/zypper
  • External/conda¹
  • External/linuxbrew¹
  • External/pip¹
  • External/tlmgr¹

¹: Require pacaptr --using <name> to invocate (see general tips).

Notes:

Motivation & Current Status

Coming from Arch Linux to macOS, I really like the idea of having an automated version of Pacman Rosetta for making common package managing tasks less of a travail thanks to the concise pacman syntax.

Initially, I found icy/pacapt which does just that, and I made this project to improve pacapt's homebrew (especially cask) support. (See pacapt/#117.)

After some discussions in pacapt/#126, I decided to rewrite the project in Rust to improve readability, testing, etc.

Building & Installation

PPAs might be added when appropriate.

  • macOS/homebrew & External/linuxbrew install:

    # Short version:
    brew install rami3l/tap/pacaptr
    
    # Which is equivalent to this:
    brew tap rami3l/tap
    brew install pacaptr
  • Windows/chocolatey install:

    # Yes, now we are still in the prerelease stage...
    choco install pacaptr --pre
  • Build from source:

    # First you'll need to download the source:
    git clone https://github.com/rami3l/pacaptr.git
    cd pacaptr
    
    # To run:
    cargo run -- -S curl
    
    # To install:
    cargo install --path .
    
    # To uninstall:
    cargo uninstall pacaptr
  • Packaging for Debian:

    cargo install cargo-deb
    cargo deb

Notes:

  • For Alpine/apk users: cargo build won't just work, please try this instead:

    RUSTFLAGS="-C target-feature=-crt-static" cargo build

Configuration

The configuration file is $HOME/.config/pacaptr/pacaptr.toml.

An example:

# This enforces the use of `install` instead of
# `reinstall` in `pacaptr -S`
needed = true

# Explicitly set the default package manager
default_pm = "choco"

# dry_run = false
# no_confirm = false
# force_cask = false
# no_cache = false

General Tips

  • --using, --pm: Use this flag to explicitly specify the underlying package manager to be invoked.

    # Here we force the use of `choco`,
    # so the following output is platform-independent:
    pacaptr --using choco -Su --dryrun
    # Pending: choco upgrade all

    This can be useful when you are running Linux and you want to use linuxbrew, for example. In that case, you can --using brew.

  • Extra flags support:

    • The flags after a -- will be passed directly to the underlying package manager:

      pacaptr -h
      # USAGE:
      #     pacaptr [FLAGS] [KEYWORDS]... [-- <EXTRA_FLAGS>...]
      
      pacaptr -S curl docker --dryrun -- --proxy=localhost:1234
      # Pending: foo install curl --proxy=localhost:1234
      # Pending: foo install docker --proxy=localhost:1234

      Here foo is the name of your package manager. (The actual output is platform-specific, which largely depends on if foo can actually read the flags given.)

  • --dryrun, --dry-run: Use this flag to just print out the command to be executed (sometimes with a --dry-run flag to activate the package manager's dryrun option).

    • Pending means that the command execution is blocked (a dry run or prompted to continue), while Running means that it is running.

    • Some query commands might still be run, but anything "big" should have been stopped from running, eg. installation. For instance:

      # Nothing will be installed,
      # as `brew install curl` won't run:
      pacaptr -S curl --dryrun
      # Pending: brew install curl
      
      # Nothing will be deleted here,
      # but `brew cleanup --dry-run` is actually running:
      pacaptr -Sc --dryrun
      # Running: brew cleanup --dry-run
      # .. (showing the files to be removed)
      
      # To remove the forementioned files,
      # run the command above again without `--dryrun`:
      pacaptr -Sc
      # Running: brew cleanup
      # .. (cleaning up)
  • --yes, --noconfirm, --no-confirm: Use this flag to trigger the corresponding flag of your package manager (if possible) in order to answer "yes" to every incoming question.

    • This option is useful when you don't want to be asked during installation, for example.
    • ... But it can be potentially dangerous if you don't know what you're doing!
  • --nocache, --no-cache: Use this flag to remove cache after package installation.

    • This option is useful when you want to reduce Docker image size, for example.

Platform-Specific Tips

  • macOS/homebrew & External/linuxbrew support: Please note that cask is for macOS only.

    • Automatic brew cask invocation: implemented for -S, -R, -Su, and more.

      pacaptr -S curl --dryrun
      # Pending: brew install curl
      
      pacaptr -S gimp --dryrun
      # Pending: brew cask install gimp
    • The use of brew cask commands can also be enforced by adding a --cask flag. Useful when a bottle and a cask share the same name, eg. docker.

    • To use -Rss, you need to install rmtree first:

      brew tap beeftornado/rmtree
  • Windows/chocolatey support: Don't forget to run in an elevated shell! You can do this easily with tools like gsudo.

  • External/pip support: Use pacaptr --using pip3 if you want to run the pip3 command.

About

Pacman syntax wrapper for homebrew, chocolatey, apt/dpkg, and more

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%