New features in Pacman 3 gives you options for backing up cahces, redistributing caches and controlling how and when updates appear at remote sites. This tutorial gets you started with a few simple examples.
For the purpose of this tutorial, let's pretend that you are part of a project that is interested in using software from the Demo cache. The simplest possibility is to just use the Demo cache directly as in the examples in the users guide. However, suppose that
To start, make two working directories work and cache working directory and make a file called cache/myDemo.caches containing
# # - Sample cache showing how to re-distribute Demo # DemoBy making a file called myDemo.Caches, you have created a cache which is at least accessible via your local file system. To see this, cd into work and do
% pacman -lc ../cache/myDemo.cachesand you'll see the contents of the cache displayed. For the purposes of this example, that's enough, but in a real situation you would probably want to put this file in a web visible directory and access it by something like % pacman -lc http://yourmachine/~yourname/work/myDemo.caches. Depending on the situation, you might alternatively want to address the cache via gsiftp://... or via SSH in the standard file location syntax.
So far, you haven't done much. If your users install something through myDemo.caches by doing, for example,
% pacman -get ../cache/myDemo.caches:Choice % pacman -d up -l [*] Choice, update from [../cache/myDemo.caches]they will get the same content as in the Demo cache at Boston University. An update will appear at their installations whenever Choice.pacman in the Demo cache changes. Now, however, do
% pacman -snap Demo % mv *.snap ../cache/Demo1.snap % pacman -lc ../cache/Demo1.snapand add a line to myDemo.caches so it contains
# # - Sample cache showing how to re-distribute Demo # ../cache/Demo1.snap DemoNow open another shell where you pretend to be a user of your cache. In a new working directory work2, browse your cache and install the Choice package like so
% pacman -lc ../cache/myDemo.caches % pacman -remove % pacman -get ../cache/myDemo.caches:Choice % pacman -d in up -lThe -d in up displays the update cache as well as the cache that the package is in (your installation, in this case). You should see that Choice is updated from myDemo.caches rather than directly from Demo. You have already achieved two of the goals of the tutorial:
This technique works recursively, so that other cache lists can point to myDemo.caches, etc. Your users can always browse the entire contents of your cache. If they desire, they can also install from a specific snapshot or from Demo. They can do this either directly or via
% pacman -remove % pacman -get ../cache/myDemo.caches:Demo1.snap:Choice % pacman -remove % pacman -fetch ../work/myDemo.caches:Demo:Choice % pacman -remove % pacman -fetch Demo:Choiceand so on.
You can also hide this entire apparatus inside a single package. To illustrate this, make a directory ../cache and put a file in it myChoice.pacman containing
# # -- A Pacman package hiding the whole updating and re-distribution mechanism of this tutorial # package('../cache/myDemo.caches:Choice') message('Installed!')Now, anyone who has read access can do
% pacman -remove % pacman -get ../cache:myChoiceas usual. Although the details are hidden, you are providing software from Demo in standard Pacman fashion while still controlling if and when updates appear for your users.
Let's now suppose that you have many users who have installed Choice via your cache. You suddenly have a need to change this package, but you want to do this in a way that doesn't disrupt the remote installations and doesn't interfere with the owners of Demo. Do to this, make an ../emergency area, cd to it and do
% pacman -extract-sources Demo % pacman -remove-allto extract the Pacman source code from Demo (and remove the installation debris). You can now edit, say Choice.pacman, and add to myDemo.caches
# # - Sample cache showing how to re-distribute Demo # ../emergency/ ../cache/Demo4.snap ../cache/Demo3.snap ../cache/Demo2.snap DemoOnce you edit this file, your users with remote installations will see an update for Choice.pacman appear when they do
% pacman -update-checkas usual. You can update this way and go back to re-use the contents of Demo once they have fixed the problem as usual by making a snapshot and changing myDemo.cache to
# # - Sample cache showing how to re-distribute Demo # ../cache/Demo5.snap ../emergency/ ../cache/Demo4.snap ../cache/Demo3.snap ../cache/Demo2.snap DemoFrom the point of view of your users, nothing has happened other than a sequence identical update operations.
Pacman 2 provided a mechanism for delegating installation and configuration to trusted experts who control Pacman caches.