I'm working on a Chromebook. Since Chrome OS is based on Gentoo, the package management system that is available in developer mode is Portage.
emerge is the command to use to install packages, but it is a very complex and hard to understand command and I've no clear instructions on how to do what I want to do.
There two things that I want to be able to do:
- List the names of installed packages.
- List the names of packages that can be installed.
In both case, the "name" of a package is the exact string that replaces
NAME in the command
emerge NAME in order to install said package.
I have wrote what I think is a solution to the first one and what wasn't really a satisfactory solution for the second one.
This is my script for listing installed packages (
#!/bin/bash cat /usr/local/var/lib/portage/world | sed "s/^.*\\///" | sort
This is my script for listing available packages (
#!/bin/bash cat /usr/local/portage/packages/Packages | grep "^CPV: " | sed "s/^CPV: .*\\///g" | sort
When I first wrote
lapkgs, I had thought that
/usr/local/portage/packages/Packages was a sort of cached file that contains all packages available from whatever repositories are setup to be connected to with Portage. My first problem with it is that the output contains names like
xxd-1.10-r3, which is NOT the name that I type to install
xxd, but rather the current package revision name or something; this name is going to var from package to package, so there isn't any general-purpose procedure I can write to clean them up. My second problem, which I realized much later, is that the names in
/usr/local/portage/packages/Packages may not be a list of available packages, but rather some kind of list of installed packages as well virtual packages.
How do I do what I want to achieve for certain?