Skip to content

Instantly share code, notes, and snippets.

@cgwalters
Created February 17, 2015 15:59
Show Gist options
  • Save cgwalters/4188ad4aaa1d971d2eff to your computer and use it in GitHub Desktop.
Save cgwalters/4188ad4aaa1d971d2eff to your computer and use it in GitHub Desktop.
yum repomirror
$ cat reposync.sh
#!/bin/sh
# Mirror a subset of packages from yum repositories, creating local
# repos for them.
set -e
run() {
echo "$@"
$@
}
base=$(pwd)
for d in *; do
if test -f $d/packages.txt; then
pkgs=$(cat $d/packages.txt)
(cd $d;
run yumdownloader --installroot=${base}/$d --setopt=cachedir=./cache --setopt=reposdir=${base}/repos --archlist=$(uname -m) --disablerepo=* --enablerepo=$d --resolve $pkgs
repomanage -o . | xargs rm -f
run createrepo .
)
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment