#!/bin/sh # File: coprmirror.sh # Location: https://gitlab.com/bgstack15/coprmirror # Author: bgstack15 # SPDX-License-Identifier: GPL-3.0 # Startdate: 2021-08-16 14:34 # Title: COPR Mirror Script # Project: coprmirror # Purpose: Mirror all available architectures of a COPR to local disk # History: # 2022-02-14 fix wget of pubkey to --output-document # Usage: # In a cronjob: # COPRMIRROR_CONF=coprmirror.conf ./coprmirror.sh 1>/dev/null 2>&1 # Reference: # yummirror.sh # Improve: # Dependencies: # yummirror.sh from this project # Flow: given a copr name, find all release-releasever-basearch entries, and pass each one to coprmirror-single.sh test -n "${COPRMIRROR_CONF}" && . "${COPRMIRROR_CONF}" copr_url="${copr_url%%/}" copr="${copr%%/}" test -z "${logfile}" && logfile=./coprmirror.all.$( date "+%FT%H%M%S" ).log export DEBUG DRYRUN VERBOSE # fetch listing from site raw_listing="$( curl -s -L "${copr_url}/${copr}/" )" # split html, list only the directory entries, show the href, split to just text that is displayed which is same as path for copr, and then exclude any the admin requests, then sort listing="$( echo "${raw_listing}" | sed -n -r -e '/