-
Notifications
You must be signed in to change notification settings - Fork 0
Usage Examples
pkgwrap is designed to be completely invisible once you build the muscle memory for it. Below are some real-world scenarios showing how to leverage pkgwrap and its alias pkw in your daily workflow.
When you spin up a brand new Debian, Ubuntu, or Fedora server, you usually need to update the system and grab some essential utilities. pkgwrap automatically detects the right backend (like apt or dnf) and handles the privilege escalation for you.
# Automatically runs `apt update` && `apt upgrade -y` (or dnf equivalents)
pkw update
# Install essential server tools in one go
pkw install curl git htop vim tmux ufwIf you code on the go using an Android device, Termux is fantastic. However, Termux uses pkg and doesn't use sudo. pkgwrap knows this and seamlessly drops the sudo requirements.
# Ensure repository index is fresh
pkw update
# Grab a mobile dev stack
pkw install nodejs python neovim opensshIf you are writing a setup script (dotfiles, CI/CD pipelines, or bootstrapping), you don't want interactive prompts stalling your execution. Use the -y or --yes flag to automatically agree to sudo escalations and package manager prompts.
#!/bin/bash
echo "Bootstrapping developer environment..."
# The -y flag ensures 'apt install -y docker.io' is run silently without prompting
pkw install docker.io -y
pkw install docker-compose -y
echo "Done!"If you're debugging or writing a complex wrapper script and need to know exactly which package manager pkgwrap thinks is in control of your system, use the --backend flag. It will print the identifier and exit.
# On an Arch Linux machine:
$ pkgwrap --backend
ℹ Active backend detected: pacman
# On macOS:
$ pkgwrap --backend
ℹ Active backend detected: brew