2017-02-22 20:43:49 +01:00
|
|
|
#!/bin/bash -xe
|
|
|
|
# Copyright 2017 SUSE Linux GmbH
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2019-11-26 07:22:46 +11:00
|
|
|
source /usr/share/mirror-update/functions.sh
|
|
|
|
|
2017-02-22 20:43:49 +01:00
|
|
|
MIRROR_VOLUME=$1
|
|
|
|
|
2022-09-14 08:22:14 +10:00
|
|
|
# Runs with timeout under cron
|
|
|
|
if [[ ${UNDER_CRON:-0} -eq 0 ]]; then
|
|
|
|
echo_ts "Running interactively"
|
2019-05-03 12:18:24 +10:00
|
|
|
TIMEOUT=""
|
2022-09-14 08:22:14 +10:00
|
|
|
set -x
|
2019-05-03 12:18:24 +10:00
|
|
|
else
|
2022-09-14 08:22:14 +10:00
|
|
|
TIMEOUT="timeout -k 2m 90m"
|
2019-05-03 12:18:24 +10:00
|
|
|
fi
|
|
|
|
|
2017-02-22 20:43:49 +01:00
|
|
|
BASE="/afs/.openstack.org/mirror/opensuse"
|
2022-05-10 14:00:53 -07:00
|
|
|
MIRROR="rsync://mirror.clarkson.edu/opensuse/opensuse"
|
2018-09-19 10:04:08 +01:00
|
|
|
OBS_MIRROR="rsync://provo-mirror.opensuse.org/opensuse/repositories"
|
2019-09-17 10:23:48 +02:00
|
|
|
OBS_REPOS=(
|
2020-08-06 17:08:21 -07:00
|
|
|
'Cloud:/OpenStack:/Ussuri/openSUSE_Leap_15.2'
|
|
|
|
'Cloud:/OpenStack:/Master/openSUSE_Leap_15.2'
|
2019-09-17 10:23:48 +02:00
|
|
|
|
|
|
|
# NOTE(yoctozepto): kolla uses the following for hacluster
|
|
|
|
'network:/ha-clustering:/Stable/CentOS_CentOS-7'
|
|
|
|
)
|
2019-05-03 12:18:24 +10:00
|
|
|
K5START="k5start -t -f /etc/opensuse.keytab service/opensuse-mirror -- $TIMEOUT"
|
2017-02-22 20:43:49 +01:00
|
|
|
|
2018-09-07 11:24:07 +01:00
|
|
|
# NOTE(hwoarang): Ensure old distros are not mirrored aymore
|
2020-09-26 15:22:54 -07:00
|
|
|
for REPO in distribution/leap/15.1 update/leap/15.1 \
|
|
|
|
repositories/Cloud:/OpenStack:/Stein/openSUSE_Leap_15.1 \
|
2022-01-10 14:06:46 -08:00
|
|
|
repositories/Cloud:/OpenStack:/Master/openSUSE_Leap_15.1 \
|
|
|
|
update/tumbleweed tumbleweed ; do
|
2019-03-27 12:41:57 +01:00
|
|
|
if [ -d $BASE/$REPO ]; then
|
|
|
|
$K5START rm -rf $BASE/$REPO
|
|
|
|
fi
|
2018-09-07 11:24:07 +01:00
|
|
|
done
|
|
|
|
|
2020-09-26 15:22:54 -07:00
|
|
|
for DISTVER in 15.2 ; do
|
2019-03-29 08:38:35 +01:00
|
|
|
REPO=distribution/leap/$DISTVER/repo
|
2017-05-25 20:46:42 +02:00
|
|
|
if ! [ -f $BASE/$REPO ]; then
|
|
|
|
$K5START mkdir -p $BASE/$REPO
|
|
|
|
fi
|
|
|
|
|
|
|
|
date --iso-8601=ns
|
|
|
|
echo "Running rsync distribution $DISTVER ..."
|
2020-06-19 12:27:46 +10:00
|
|
|
$K5START rsync -rltvz \
|
2018-03-19 17:19:41 +01:00
|
|
|
--delete --stats \
|
2017-05-25 20:46:42 +02:00
|
|
|
--delete-excluded \
|
|
|
|
--exclude="iso" \
|
2022-04-20 09:53:02 -07:00
|
|
|
--exclude="non-oss/" \
|
2019-05-28 15:14:59 +02:00
|
|
|
--exclude=".~tmp~" \
|
2018-03-19 17:19:41 +01:00
|
|
|
$MIRROR/$REPO/ $BASE/$REPO/
|
2017-05-25 20:46:42 +02:00
|
|
|
|
|
|
|
REPO=update/leap/$DISTVER
|
|
|
|
if ! [ -f $BASE/$REPO ]; then
|
|
|
|
$K5START mkdir -p $BASE/$REPO
|
|
|
|
fi
|
|
|
|
|
|
|
|
date --iso-8601=ns
|
|
|
|
echo "Running rsync updates $DISTVER ..."
|
2020-06-19 12:27:46 +10:00
|
|
|
$K5START rsync -rltvz \
|
2018-03-19 17:19:41 +01:00
|
|
|
--delete --stats \
|
2017-05-25 20:46:42 +02:00
|
|
|
--delete-excluded \
|
|
|
|
--exclude="src/" \
|
|
|
|
--exclude="nosrc/" \
|
2022-04-20 09:53:02 -07:00
|
|
|
--exclude="non-oss/" \
|
|
|
|
--exclude="non-oss_debug/" \
|
|
|
|
--exclude="oss_debug/" \
|
2022-04-20 10:18:13 -07:00
|
|
|
--exclude="aarch64/" \
|
|
|
|
--exclude="i586/" \
|
|
|
|
--exclude="i686/" \
|
|
|
|
--exclude="ppc64le/" \
|
|
|
|
--exclude="s390x/" \
|
2019-05-28 15:14:59 +02:00
|
|
|
--exclude=".~tmp~" \
|
2018-03-19 17:19:41 +01:00
|
|
|
$MIRROR/$REPO/ $BASE/$REPO/
|
2017-05-25 20:46:42 +02:00
|
|
|
done
|
2017-02-22 20:43:49 +01:00
|
|
|
|
2019-03-27 12:41:57 +01:00
|
|
|
date --iso-8601=ns
|
2019-04-26 13:17:09 +02:00
|
|
|
for obs_repo in ${OBS_REPOS[@]}; do
|
2019-03-27 12:41:57 +01:00
|
|
|
REPO=repositories/${obs_repo}/
|
|
|
|
if ! [ -f $BASE/$REPO ]; then
|
|
|
|
$K5START mkdir -p $BASE/$REPO
|
|
|
|
fi
|
|
|
|
echo "Running rsync ${obs_repo} ..."
|
2020-06-19 12:27:46 +10:00
|
|
|
$K5START rsync -rltvz \
|
2019-03-27 12:41:57 +01:00
|
|
|
--delete --stats \
|
|
|
|
--delete-excluded \
|
|
|
|
--exclude="src/" \
|
|
|
|
--exclude="nosrc/" \
|
2019-05-28 15:14:59 +02:00
|
|
|
--exclude=".~tmp~" \
|
2019-03-27 12:41:57 +01:00
|
|
|
$OBS_MIRROR/$obs_repo/ $BASE/$REPO
|
|
|
|
done
|
|
|
|
|
2017-02-22 20:43:49 +01:00
|
|
|
date --iso-8601=ns | $K5START tee $BASE/timestamp.txt
|
|
|
|
echo "rsync completed successfully, running vos release."
|
2020-04-09 14:34:35 +10:00
|
|
|
vos_release $MIRROR_VOLUME
|
2017-02-22 20:43:49 +01:00
|
|
|
|
|
|
|
date --iso-8601=ns
|
|
|
|
echo "Done."
|