Created
February 17, 2015 15:59
-
-
Save cgwalters/4188ad4aaa1d971d2eff to your computer and use it in GitHub Desktop.
yum repomirror
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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