Skip to content

Instantly share code, notes, and snippets.

@kjelly
Created October 11, 2017 03:15
Show Gist options
  • Save kjelly/6d7c9847dc462d83e4c2eb9120d59cd5 to your computer and use it in GitHub Desktop.
Save kjelly/6d7c9847dc462d83e4c2eb9120d59cd5 to your computer and use it in GitHub Desktop.
#!/bin/sh
REPODIR="$HOME/osprepo"
REPOFILE="$HOME/osp.repo"
rm $REPOFILE 2> /dev/null
rm -rf /etc/yum.repos.d/*
touch $REPOFILE
for DIR in `find $REPODIR -maxdepth 1 -mindepth 1 -type d`; do
echo -e "[`basename $DIR`]" >> $REPOFILE
echo -e "name=`basename $DIR`" >> $REPOFILE
echo -e "baseurl=file://$REPODIR/`basename $DIR`/" >> $REPOFILE
echo -e "enabled=1" >> $REPOFILE
echo -e "gpgcheck=0" >> $REPOFILE
echo -e "gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release" >> $REPOFILE
echo -e "\n" >> $REPOFILE
done;
cp $REPOFILE /etc/yum.repos.d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment