#!/bin/sh
#

baseUrl='https://mirrors.aliyun.com/epel/7/x86_64/Packages'

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


for i in 0 2 3 4 9 {a..z};do
  echo "i is $i"
  w3m -dump  ${baseUrl}/${i}/   | grep ".rpm\ " | awk '{print $1}' | while read line ;do
     wget ${baseUrl}/${i}/${line} > /dev/null 2>&1  && echo $line download OK || echo $line download Failed
  done
done
