From 26d955f34442d17cd727265a4bcfe0bccaad5a80 Mon Sep 17 00:00:00 2001
From: Ian Wienand <iwienand@redhat.com>
Date: Fri, 29 Oct 2021 10:46:59 +1100
Subject: [PATCH] reprepro: add note on removing components

Change-Id: Ia50861042bb159a9e351321b2503f193eca4e576
---
 doc/source/reprepro.rst | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/doc/source/reprepro.rst b/doc/source/reprepro.rst
index 28bc34c81c..2b8d43c8d2 100644
--- a/doc/source/reprepro.rst
+++ b/doc/source/reprepro.rst
@@ -90,6 +90,36 @@ Repository syncs are driven from ``cron`` on the
 ``/usr/local/bin/reprepro-mirror-update`` script.  Repositories will
 update, remove old references and perform the ``vos release``.
 
+Removing components
+===================
+
+As we drop support for various releases we may wish to remove them
+from the mirror.  Firstly you should commit a change removing the
+distribution from the configuration files.  It is then a one-time
+manual process to remove the actual files on disk, which should be
+done with the update lock held.
+
+It is best to run this in a root screen session.  This will look
+like::
+
+  # find the appropriate lock; config and volume;
+  # easy way is to look at the cron job arguments
+  $ flock -n /var/run/reprepro/<distro>.lock bash
+  $ K5START="k5start -t -f /etc/reprepro.keytab service/reprepro -- "
+  $ REPREPRO="${K5START} reprepro --confdir /etc/reprepro/<distro>"
+  # Clean up package indexes.  This takes a few minutes
+  $ ${REPREPRO} --delete clearvanished
+  # We have keepunreferenced, because we take a two-step approach
+  # of dumping the unreferenced files in one run, then deleting them in
+  # the next, to ensure any tests in progress can access the old files.
+  # In this removal situation, we should clear out the files now
+  # This can take a while depending on the size of what is removed
+  $ ${REPREPRO} --nokeepunreferencedfiles deleteunreferenced
+  # The ssh wrapper is the easiest way to release the volume
+  $ source /usr/share/mirror-update/functions.sh
+  $ vos_release <mirror.volume>
+  $ exit
+
 Advanced Recovery Techniques
 ============================