#!/bin/bash # get new vesions of repos DEST='/etc/yum.repos.d' URI='http://repo.hpc.lsu.edu/files/yum/centos' scriptFile='scripts.txt' scriptList="${URI}/${scriptFile}" if [[ ! -d ${DEST} ]] then mkdir -p ${DEST} fi cd ${DEST} rm -f ${scriptFile} echo 'Downloading script list' wget "${scriptList}" >/dev/null 2>/dev/null cat ${scriptFile} | while read line do set ${line} sum="$1" file="$2" if [[ -f ${file} ]] then local=$(sha1sum ${file} | awk '{print $1}') if [[ "${local}" != "${sum}" ]] then echo "-Removing: ${file} -- it has been updated" rm -f ${file} echo "+Downloading current copy of: ${file}" wget "${URI}/${file}" >/dev/null 2>/dev/null fi fi done