Skip to content
/ pipac Public

pipac - Prune and Install PACkages

License

Notifications You must be signed in to change notification settings

j4kub5/pipac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pipac - Prune and Install PACkages

About

pipac (Prune and Install PACkages) is a Python tool that helps maintain a clean system (Arch Linux or similar) by ensuring that explicitly installed packages match user-provided package lists (declarative package management).

Features

  • maintains system packages based on package lists
  • supports multiple package managers (yay, paru, pacman)
  • handles optional dependencies

Installation

Manual

git clone https://github.com/j4kub5/pipac
cd pipac
sudo install -Dm755 pipac.py /usr/bin/pipac

AUR

yay -S pipac

Usage

pipac [COMMAND]... [PACKAGE_LIST]...

Commands

-h, --help
display help message
-i, --install
install packages from lists that are not currently installed
-p, --prune
prune packages not in lists (mark as dependencies)
-n, --new
print installed explicit packages missing from the lists

Package Lists

Package lists are text files; packages are line or space separated. Optional dependencies should be prefixed with &. Everything in a line after # is a comment (ignored by the program).

Example package list:

package1
package2 # comment
&optional_dependency_for_package2

# comment
package3 package4
package5 &optional_dependency_for_package5

Create a package list

pacman -Qeq > packages.txt

Default package lists

If no package lists are specified as arguments pipac will use default package lists:

  • ~/.config/pipac/packages.txt
  • ~/.config/pipac/$HOSTNAME.txt

Replace $HOSTNAME with the actual name:

cat /proc/sys/kernel/hostname

Examples

After you manually edit the package list(s) you may:

# Install missing packages in default lists
pipac -i

# Prune packages not in default lists
pipac -p
yay -Yc # or paru -c or sudo pacman -Rns $(pacman -Qtdq)

# Install missing packages in lists
pipac -i packages.txt $HOSTNAME.txt

# Prune packages not in lists
pipac -p packages.txt $HOSTNAME.txt
yay -Yc # or paru -c or sudo pacman -Rns $(pacman -Qtdq)

# Combine prune and install
pipac -ip packages.txt $HOSTNAME.txt

# Add packages you installed manually to a list
pipac -n >> ~/.config/pipac/packages.txt

Example upgrade script

pipac -p packages.txt $HOSTNAME.txt
yay -Yc # or paru -c or sudo pacman -Rns $(pacman -Qtdq)
pipac -i packages.txt $HOSTNAME.txt

TO-DOs

  • [ ] feature: flatpaks
  • [ ] documentation: document alternative software
  • [ ] documentation: explain ¿why?
  • [ ] feature: genrerate packages.txt in config directory
  • [ ] feature: diff or dry run
  • [X] feature: print out a list of newly installed packages (not yes added to lists)
  • [X] add license
  • [X] make $HOSTNAME.txt in config directory optional
  • [X] more examples (use with scripts)
  • [X] create an AUR package
  • [X] feature: update system while installing
  • [X] feature: read default package lists
  • [X] feature: default behavior when no arguments are passed

About

pipac - Prune and Install PACkages

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages