#!/bin/bash # get new vesions of scripts and any new scripts DEST='/root/bin' URI='http://repo.hpc.lsu.edu/files/dirvish' scriptFile='scripts.txt' scriptList="${URI}/${scriptFile}" if [[ ! -d ${DEST} ]] then mkdir -p ${DEST} fi cd ${DEST} rm -f ${scriptFile} if [[ ! -f dirvish-sync.bash ]] then ln -s dirvish-sync1.bash dirvish-sync.bash fi 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} fi fi if [[ -f ${file} ]] then echo "=File is current: ${file}" else echo "+Downloading current copy of: ${file}" wget "${URI}/${file}" >/dev/null 2>/dev/null chmod a+x ${file} fi done