#!/bin/bash NAME=$1 shift for PAR in $*; do eval "$PAR=1" &>/dev/null; done if [ "$NAME" == "" ]; then echo "Usage: $0 [info] [confirm]" echo " Checks if the package is still up to date with upstream versions. Uses the .check file to do this" echo " Add 'info' for more info." echo " Add 'confirm' to confirm changes." exit 1 fi CHECK=`./findbuild $NAME`.check || exit 1 OK="$CHECK.ok" CURRENT=/tmp/$$.check.current if ! [ -e "$CHECK" ]; then echo "(not checking version of $0, no .check file found)" exit 0 fi trap "rm $CURRENT" 0 echo -n "Running $CHECK..." chmod +X $CHECK || exit 1 if ! $CHECK > $CURRENT; then echo "ERROR: Check script returned error code, please verify the script and urls!" exit 1 fi if [ "$info" ]; then echo "Output:" cat "$CURRENT" if [ -e "$OK" ]; then echo "Difference with previous check:" diff "$OK" "$CURRENT" else echo "(No previous check data is avaiable yet)" fi fi if ! cmp "$OK" "$CURRENT" &>/dev/null; then if [ "$confirm" ]; then echo -n "confirming changes..." cp $CURRENT $OK || exit 1 echo "OK" else echo -e "\e[1;31m*** Warning, upstream version changed! Run '$0 $NAME info' for more info.\e[0m" exit 1 fi else echo "OK" fi