#!/bin/sh

while read tok1 tok2 ; do
	if [ "$tok1" = script ] ; then
		script=$tok2
		echo "$script ------------------"
	fi

	if [ "$tok1" = "url" ] ; then
		wget -q -O scripts/$script.new "$tok2"
		if diff -up scripts/$script scripts/$script.new ; then
			echo "$script is up to date"
			rm scripts/$script.new
		else
			echo "$script needs updating"
		fi
	fi
done < INDEX
