Penguin

apt-move - move cache of Debian packages into a mirror hierarchy.

SYNOPSIS

apt-move [__-c__ ''conffile''? [__-ft__? command

DESCRIPTION

The apt-move script is used to move a collection of Debian package files into a proper archive hierarchy of the form $LOCALDIR/dists/... where LOCALDIR is specified in the configuration file.

It is intended as a tool to help manage the apt-get(8) file cache, but could be configured to work with any collection of Debian packages.

Additionally, using the sync and mirror commands, you can build your own local mirror of portions of a selected binary and/or source distribution.

Running apt-move periodically will assist in managing the resulting partial mirror by (optionally) removing obsolete packages and creating valid local Packages.gz and Sources.gz files using dpkg-scanpackages(8) and dpkg-scansources(8).

Commands

The following commands are accepted by apt-move:

get
This generates the master files using Packages and Sources files from the apt(8) cache. The master files are used to keep track of what packages are available, and where packages should be installed.
getlocal
This is an alias of get. It may be removed in future releases.
move
Moves a collection of packages into the local mirror tree. Uses existing master files (see get) to repair any mangling done to the package names. Any packages that aren't listed in the master files will be left in the file cache directory.
delete
Delete obsolete package files. Configurable through the DELETE and MAXDELETE settings in the /etc/apt-move.conf file (see the CONFIGURATION section below).
packages
Builds new local versions of Packages.gz and Sources.gz files.
fsck
Rebuilds all index files used to make Packages and Sources files and create symbolic links for binary-all packages. Use this if you are upgrading from an old version (<< 4.0) of apt-move, if your index files are corrupted, or if you are adding a new architecture to your mirror. This will use your existing master files, or your local Packages and Sources files if they aren't available.
update
This is an alias, equivalent to get move delete packages. This is the preferred method for moving package files from your cache into a local mirror.
local
This is an alias, equivalent to move delete packages'.
localupdate
This is an alias for update. It may be removed in future releases.
mirror
This command automatically runs get, then uses /usr/lib/apt-move/fetch and apt-get(8) to download any packages missing from your mirror. The downloaded files will be installed into the repository using move. Finally, it runs packages and exits. See the DIST and PKGTYPE settings in /etc/apt-move.conf.
Before using this command, you need to set up a $LOCALDIR/.exclude file containing patterns to exclude unwanted files from your mirror. See the SAMPLE.exclude file for an example. See also the Exclude file section of NOTES below. Note that this command will only mirror packages for the architecture that you are running on. It will, however, mirror all source packages.
sync
Similar to the mirror function, but only gets the packages that are currently installed on your system. It uses dpkg(8) --get-selections to find out what files to download. It will skip any files that match one of the patterns in the $LOCALDIR/.exclude file (if it exists). sync will get the latest versions of the packages, regardless of the version currently installed on your system (think about it).
exclude
This command is used to test your $LOCALDIR/.exclude pattern file. It will go through the master lists and print any file that matches one of the patters in $LOCALDIR/.exclude.
This will show you exactly what files you have EXCLUDED from your mirror. The -t (test) flag has no affect on this command. This uses your existing master files, and does not require an internet connection.
movefile files...
This command is similar to move. Instead of moving files from FILECACHE, it will move the files specified on the command line.
listbin [ __mirror __?
This command prints a list of packages which may serve as the input to mirrorbin or mirrorsrc. If the argument is mirror or sync, it will produce the same lists that the mirror and sync commands use. If the argument is repo, the list produced will contain the packages that are currently in the apt-move repository.
mirrorbin
This command will fetch the list of packages specified on the standard input, and place them into he archive in the same way as mirror does.
mirrorsrc
This commands acts like mirrorbin, except that it fetches source packages instead of binary ones.

Options

The following options are available from the command line:

-c conffile
Use conffile as the configuration file instead of /etc/apt-move.conf.
-f
Forces deletion of files even when the percentage of files to delete exceeds the MAXDELETE setting. This is useful if apt-move aborts with an error saying that too many files would be deleted, and you want to delete the files anyway. (Use with caution.) If you get this error, using -ft will show you the complete list of files, so you can verify them before you use -f.
-t
Makes a 'test run' and reports what WOULD be done for option but does not modify any of the cache or mirror files.

CONFIGURATION

Before using apt-move, edit the /etc/apt-move.conf file to match your local setup. Always remember to use the test parameter after any change in your configuration to make sure it will work like you want it to. You may also want to set the DELETE option to no to turn off file deletes until everything else is working successfully.

The following settings are recognized by apt-move (shown here with their defaults):

APTSITES=debian.midco.net non-us.debian.org
Set this to the names of sites in your /etc/apt/sources.list that you wish to mirror.
ARCHS=alpha arm hurd-i386 i386 m68k powerpc sparc
This is a list of the architectures that you mirror. As of potato, set to only one of: alpha, arm, hurd-i386, i386, m68k, powerpc or sparc.
Determines the creation of links to binary-all packages, as well as Packages and Sources files.
LOCALDIR=/mirrors/debian
This is the full (absolute) path to your debian directory (the top of your local mirror).
DIST=potato
Set this to a distribution name (such as slink or potato) to follow a particular distribution throughout its life cycle, or to a distribution branch (such as stable or unstable) to always mirror that branch, regardless of its current name. Your local mirror will be constructed accordingly. It is generally safer to use the code name (e.g., potato), and then create symbolic links under LOCALDIR.
PKGTYPE=binary

Set this to your choice of: binary, source or both to tell the mirror, sync and movefile which type(s) of files to get.
FILECACHE=/var/cache/apt/archives
The directory where your local cache of packages are. The default will work for the apt-get(8) packages, unless you've changed the configuration in /etc/apt/apt.conf.
LISTSTATE=/var/state/apt/lists
The directory to your local cache of Packages files. The default will work for the apt-get(8) packages, unless you've changed the configuration in /etc/apt/apt.conf.
DELETE=no
Determines whether obsolete packages (packages not listed in the master file, or packages that have been superceded in the repository) are to be removed.
MAXDELETE=20
Maximum percentage of files apt-move is allowed to delete during a normal run. Anything exceeding this will produce an error and abort the script. I added this as a precaution so that you won't lose your entire mirror when a new distribution is released. You can override this (with caution) using the -f parameter with apt-move.
STRICTMOVE=no
If set to yes, files will only be allowed into the cache if their version without the epoch is equal to the version listed in the master file. If no version is recorded in the entry for this package in the master file, then it will still be allowed in.
For the sync and mirror commands to function correctly, you need to list your apt-move repository at the top of /etc/apt/sources.list as a file URI.

FILES

/usr/bin/apt-move
The script.
/etc/apt-move.conf
Configuration file for the script.
/usr/share/man/man8/apt-move.8.gz
The manpage.
/tmp/MOVE_*
The temporary files created at runtime.
/usr/lib/apt-move/fetch
Utility to fetch files just like apt-get install -d. Except that no dependency analysis is done.
.apt-move/*.{binary, source}.local
Put entries of local packages here. The fields are ``package priority section source for the binary file, and ``package priority section for the source file.

SEE ALSO

dpkg-scanpackages(8), dpkg-scansources(8), dpkg(8), apt-get(8)

NOTES

Exclude file

The mirror command uses a file in the $LOCALDIR/ directory called '.exclude' which contains exclude patterns that are applied against the files to be mirrored. These patterns were created with the following limitation: they must work the same with with grep(1), after any '*' characters are removed. Unless you're careful setting this up, you'll get unexpected results. Run 'apt-move -t mirror' first, to make sure you're getting the results you intended. Another way to verify your exclude file is the use the exclude command for apt-move to print a list of files your are excluding from your mirror. See the sample .exclude file (SAMPLE.exclude) for an example of an .exclude file.

WARNINGS

The apt-move mirror and sync commands do not test for available disk space. The current potato (main binary) distribution is over 1Gb in size. Add the sources to that and it can eat up the space on a partition really fast. I would advise you to put your mirror somewhere other than the root partition. Set up your exclude file and run apt-move -t mirror and examine the result.

DIAGNOSTICS

apt-move may exit with one of the following error messages:

Could not find configuration.
apt-move could not find the /etc/apt-move.conf file. Run the install script.
You must specify at least one APTSITES in...
You did not specify anything in APTSITES. Which implies that there is nothing to mirror.
Could not create directory.
For some reason, a necessary directory could not be created.
You failed to select a distribution.
You did not configure a DIST setting in /etc/apt-move.conf.
You specified an invalid pacakge type.
You can only use binary, source or both for the PKGTYPE setting.
No master files exist!
You need to run apt-move with the get command at least once in order to create the master files which determine where packages are to be installed.
bc calculation returned invalid result
apt-move uses the bc(1) program to determine when the number of files to delete will exceed the MAXDELETE setting in apt-move.conf. If you get this error, make sure that MAXDELETE is set to a number in the range of 1 to 100, without the % sign. Otherwise you need to report this as a bug.
Too many files to delete!
apt-move will report this error if the number of files to be deleted exceeds the MAXDELETE setting in apt-move.conf. You need to study the output to determine if this is normal (in which case you can override this using the force parameter), or if its due to some drastic change on the mirror site (like a new release) or possibly due to a partial download of the master Packages.gz or Sources.gz file.
Your current mirror directory is incompatible...
You have just upgraded from an old version of apt-move. Update your configuration, then run apt-move fsck and finally remove .apt-move/ancient.

AUTHOR

Michael Merten <mikemerten@yahoo.com>
Herbert Xu <herbert@debian.org>


User Submitted Annotations:

If it doesn't move your package, that means it's not listed in the Release file somewhere along the line. That's why you often get Ign: on Release files from 'local' repositories.

So the question dying to be asked here is -- how do you stick it into a Release file? -- PerryLorier

Wouldn't you love to know! Unfortunately, I have so far turned up a blank...

http://lists.debian.org/debian-devel/2003/debian-devel-200309/msg01538.html has a script to create the Relese files. http://lists.debian.org/debian-user/2002/debian-user-200203/msg04954.html has a simpler description

This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.