rpmrepo sync bash script

From Putrid Leopard, 6 Years ago, written in Plain Text, viewed 223 times.
URL https://paste.steamr.com/view/fa99eb3e Embed
Download Paste or View Raw
  1. #!/bin/bash
  2.  
  3. function PrimaryXml {
  4.         wget -q -O - $1/repodata/repomd.xml \
  5.                 | grep primary.xml \
  6.                 | sed -n -e 's/.*"\(.*\)".*/\1/p'
  7. }
  8.  
  9. function GetPackages {
  10.         wget -q -O - $1`PrimaryXml $1` \
  11.                 | zcat \
  12.                 | grep rpm \
  13.                 | grep location \
  14.                 | sed -n -e 's/.*<location href=\"\(.*\)\".*/\1/p' \
  15.                 | grep -v src.rpm
  16. }
  17.  
  18. function DownloadPackages {
  19.         GetPackages $1 | while read i ; do
  20.                 if [ ! -f $i ] ; then
  21.                         test -d `dirname $i` || mkdir -p `dirname $i`
  22.  
  23.                         echo "Downloading $1$i..."
  24.                         wget -q -O $i $1$i
  25.                 fi
  26.         done
  27.  
  28.         echo "Download complete."
  29. }
  30.  
  31.  
  32. Url="https://repo.saltstack.com/yum/redhat/7/x86_64/2016.11/"
  33. Url="https://repo.saltstack.com/yum/redhat/7/x86_64/2017.7/"
  34.  
  35. DownloadPackages $Url
  36.  
  37.  

Replies to rpmrepo sync bash script rss

Title Name Language When
Re: rpmrepo sync bash script Ample Cheetah bash 6 Years ago.

Reply to "rpmrepo sync bash script"

Here you can reply to the paste above