title:Code Recovery by Using a Mirror
license:General Public License, V2
copyright:
  1. 2004, 2005 Canonical Ltd.

System Message: WARNING/2 (RecoveryUsingAMirror.rst, line 3)

Cannot extract compound bibliographic field "copyright".
Author: James Blackwell <jblack@gnuarch.org>
original-location:
 jblack@gnuarch.org--2004/bazaar-docs--initial--1.1

Welcome to the next installment of the arch mini-howtos. In this mini-howto, we'll cover how to recover from a lost archive by recovering from a mirror. There could be a variety of reasons that you need to perform this recovery; your old hard drive could have died, you could be installing arch on a new machine. Who knows; perhaps your cat tapdanced on your laptop's keyboard while you slept, removing your home directory. In this tutorial, I'll assume that you are moderately familiar with arch and are comfortable using tools like scp.

Before you get started, there are three pieces of information that you'll need to know:

  1. What the name of the archive is (for example, I'll use jdoe@isp.com--2004)
  2. Where the archive is located (I'll use sftp://jdoe@isp.com/home/jdoe/archives/jdoe@isp.com)
  3. Whether or not your archive was signed. You would know if your archive was signed, because gnupg would have prompted you each time you committed

The first thing you need to do is to copy down the archive. You can perform that thusly:

For everyone :

$ baz my-id "John Doe <jdoe@isp.com>"
(unnecessary if my-id is already set)

$ mkdir ~/archives
$ sftp -r jdoe@isp.com/home/jdoe/archives/jdoe@isp.com--2004 ~/archives
(or, if you prefer, scp, ftp, etc)

$ rm ~/archives/jdoe@isp.com/=meta-info/mirror
$ baz register-archive /home/jdoe/archives/jdoe@isp.com--2004

$ baz register-archive jdoe\@isp.com--2004-MIRROR  \
     sftp://jdoe@isp.com/home/jdoe/archives/jdoe@isp.com--2004

$ baz my-default-archive jdoe@isp.com--2004
(this step is optional)

If your archive is signed, then you'll need to perform the following steps:

First, go into the signing dir, creating it first if necessary:

$ mkdir ~/.arch-params/signing && cd ~/.arch-params/signing

# Now, we setup our default signing rule:
$ echo "gpg --clearsign" > =default

# Now, set up our default check script:
$ cat << EOF > =default.check
> #!/bin/sh
> tmp=$(mktemp /tmp/baz-gpgoutputXXXXXX)
> if ! gpg --batch --verify 1>"$tmp" 2>&1; then
>  cat "$tmp"
>  exit 1
> fi
> rm -f "$tmp"
> EOF

# Finally, instruct baz to propgate signatures to the mirror:
echo "jdoe@isp.com--2004" > jdoe@isp.com--2004-MIRROR

That's all there is to it. You should be able to commit from this point forward, as if this archive had always been there.