Skip to content

Instantly share code, notes, and snippets.

@nemke82
Created December 30, 2017 17:25
Show Gist options
  • Save nemke82/e7e0be9559d61f0f82cd91183517479d to your computer and use it in GitHub Desktop.
Save nemke82/e7e0be9559d61f0f82cd91183517479d to your computer and use it in GitHub Desktop.
autumn8 repo git copy
#!/bin/bash
#Author: Nemanja Djuric
#Script to replicate automn8 repository to repo1.nemanja.io
echo "Determing OS version"
osversion=$(cat /etc/redhat-release | grep -oE '[0-9]+\.[0-9]+'|cut -d"." -f1)
echo ${osversion}
if [ ${osversion} -eq 6 ];then
echo "Removing temp file."
rm -f temp.txt &&
echo "Retrieving package list from ndeploy and saving."
repoquery -qa --repoid=ndeploy | sed 's/0://g' > temp.txt
echo "Changing to repo directory."
cd /home/repo1nemanja/public_html/repos/autom8n/CentOS/ &&
echo "Changing to repo directory and DOWNLOADING FILES."
repoquery -qa --repoid=ndeploy | sed 's/0://g' > temp.txt && for i in $(cat temp.txt); do wget -r -nH -nc --cut-dirs 1 -l 100 https://autom8n.com/CentOS/6/x86_64/$i.rpm ; done
fi
if [ ${osversion} -eq 7 ];then
echo "Removing temp file."
rm -f temp.txt &&
echo "Retrieving package list from ndeploy and saving."
repoquery -qa --repoid=ndeploy | sed 's/0://g' > temp.txt
echo "Changing to repo directory."
cd /home/repo1nemanja/public_html/repos/autom8n/CentOS/ &&
echo "Changing to repo directory and DOWNLOADING FILES."
repoquery -qa --repoid=ndeploy | sed 's/0://g' > temp.txt && for i in $(cat temp.txt); do wget -r -nH -nc --cut-dirs 1 -l 100 https://autom8n.com/CentOS/7/x86_64/$i.rpm ; done
else
echo "Job done, but we need CentOS 7 packets anyway..."
repoquery -qa --repoid=ndeploy | sed 's/0://g' | sed 's/el6/el7/g' > temp.txt && for i in $(cat temp.txt); do wget -r -nH -nc --cut-dirs 1 -l 100 https://autom8n.com/CentOS/7/x86_64/$i.rpm ; done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment