summaryrefslogtreecommitdiff
path: root/public/pacman-overview.md
blob: 4dc26964d76c4c2f78551017b4bc3a9efdfdb4c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
A quick overview of usage of the Pacman package manager
=======================================================
---
date: "2013-01-23"
---

This was originally published on [Hacker News][1] on 2013-01-23.

[1]: https://news.ycombinator.com/item?id=5101416

Note: I've over-done quotation marks to make it clear when precise
wording matters.

`pacman` is a little awkward, but I prefer it to apt/dpkg, which have
sub-commands, each with their own flags, some of which are
undocumented. pacman, on the other hand, has ALL options documented in
one fairly short man page.

The trick to understanding pacman is to understand how it maintains
databases of packages, and what it means to "sync".

There are several "databases" that pacman deals with:

 * "the database", (`/var/lib/pacman/local/`)<br>
   The database of currently installed packages
 * "package databases", (`/var/lib/pacman/sync/${repo}.db`)<br>
   There is one of these for each repository.  It is a file
   that is fetched over plain http(s) from the server; it
   is not modified locally, only updated.

The "operation" of pacman is set with a capital flag, one of "DQRSTU"
(plus `-V` and `-h` for version and help). Of these, "DTU" are "low-level"
(analogous to dpkg) and "QRS" are "high-level" (analogous to apt).

To give a brief explanation of cover the "high-level" operations, and
which databases they deal with:

 * "Q" Queries "the database" of locally installed packages.
 * "S" deals with "package databases", and Syncing "the database" with
   them; meaning it installs/updates packages that are in package
   databases, but not installed on the local system.
 * "R" Removes packages "the database"; removing them from the local
   system.

The biggest "gotcha" is that "S" deals with all operations with
"package databases", not just syncing "the database" with them.