#!/bin/sh
#
#!/bin/sh
#

baseDir="/data/www/devops/yum-repo"
dirName="ceph"
baseUrl='https://mirrors.aliyun.com/ceph/rpm-mimic/el7/x86_64'

cd $baseDir
[ ! -d ./$dirName ] && mkdir ./$dirName
cd $dirName


if [ ! -f /usr/bin/w3m ];then
  yum install w3m -y >/dev/null 2>&1 || echo "Install w3m Failed!"
fi

if [ ! -f /usr/bin/w3m ];then
  echo "Please install w3m, Exit!"
fi


  w3m -dump  ${baseUrl}/   | grep ".rpm\ " | grep -v ceph-debuginfo| awk '{print $1}' | while read line ;do
     wget ${baseUrl}/${line} > /dev/null 2>&1  && echo $line download OK || echo $line download Failed
  done

