Skip to content

Instantly share code, notes, and snippets.

@frayos
Created May 18, 2018 19:40
Show Gist options
  • Save frayos/a0c39c8e3829e87797a6e59521086380 to your computer and use it in GitHub Desktop.
Save frayos/a0c39c8e3829e87797a6e59521086380 to your computer and use it in GitHub Desktop.
Official Yumrepocreation.sh
#!/bin/bash
# from https://go.documentation.sas.com/?docsetId=dplyml0phy0lax&docsetTarget=n1r12yogvmv19fn13dp89ulf1jlx.htm&docsetVersion=3.3&locale=en
sudo yum install yum-utils createrepo httpd
REPOLOC=/var/www/html/pulp/repos
ORDERABLE=$(grep METAREPO_SOE_ORDERABLE soe_defaults.yml | awk -F"'" '{ print $2 }')
# Make the directory that will house the yum repository
if [ ! -d ${REPOLOC} ]; then
mkdir -p ${REPOLOC}
fi
echo ""
echo "Unpack the files from repomirror.tar.gz"
tar xf repomirror.tar.gz -C ${REPOLOC}
echo ""
echo "Create the repository"
for repo in ${ORDERABLE}; do
NAME=$(sed -e 's/^"//' -e 's/"$//' <<<"$repo")
createrepo -v --update ${REPOLOC}/${NAME} -g ${REPOLOC}/${NAME}/comps.xml
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment