Monty Taylor d00e7c0e5d Update paths for AFS mirror
In the current setup, the reprepro db and lists dirs are being written
into /root. Move them into AFS so that we store all the data in the same
place.

Also, update the script to point to the confdir for reprepro commands.

Note: This will require a manual move of the current db and lists dirs
from /root to /afs/.openstack.org/mirror/apt before this is run.

Change-Id: I2638621e6af98296704e680227fae174d8a0e541
2016-02-07 09:53:14 -06:00

41 lines
1.4 KiB
Bash

#!/bin/bash
# Copyright 2016 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
set -e
UNREF_FILE=/var/run/reprepro/unreferenced-files
REPREPRO='reprepro --confdir /etc/reprepro'
echo "Obtaining reprepro tokens and running reprepro update"
k5start -t -f /etc/reprepro.keytab service/reprepro -- timeout -k 2m 30m $REPREPRO update
if [ -f $UNREF_FILE ] ; then
echo "Cleaning up files made unreferenced on the last run"
k5start -t -f /etc/reprepro.keytab service/reprepro -- timeout -k 2m 30m $REPREPRO deleteifunreferenced < $UNREF_FILE
fi
echo "Saving list of newly unreferenced files for next time"
$REPREPRO dumpunreferenced > $UNREF_FILE
echo "Checking state of mirror"
$REPREPRO checkpool fast
$REPREPRO check
echo "reprepro completed successfully, running reprepro export."
k5start -t -f /etc/afsadmin.keytab service/afsadmin -- vos release -v mirror.apt
echo "Done."