source: npl/versioncheck @ 42fa616

Last change on this file since 42fa616 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 1.3 KB
Line 
1#!/bin/bash
2
3NAME=$1
4shift
5for PAR in $*; do eval "$PAR=1" &>/dev/null; done
6
7if [ "$NAME" == "" ]; then
8    echo "Usage: $0 <packagename> [info] [confirm]"
9    echo " Checks if the package is still up to date with upstream versions. Uses the .check file to do this"
10    echo " Add 'info' for more info."
11    echo " Add 'confirm' to confirm changes."
12    exit 1
13fi
14
15CHECK=`./findbuild $NAME`.check || exit 1
16OK="$CHECK.ok"
17CURRENT=/tmp/$$.check.current
18
19if ! [ -e "$CHECK" ]; then
20    echo "(not checking version of $0, no .check file found)"
21    exit 0
22fi
23
24trap "rm $CURRENT" 0
25
26echo -n "Running $CHECK..."
27chmod +X $CHECK || exit 1
28if ! $CHECK > $CURRENT; then
29    echo "ERROR: Check script returned error code, please verify the script and urls!"
30    exit 1
31fi
32
33
34if [ "$info" ]; then
35    echo "Output:"
36    cat "$CURRENT"
37    if [ -e "$OK" ]; then
38        echo "Difference with previous check:"
39        diff "$OK" "$CURRENT"
40    else
41        echo "(No previous check data is avaiable yet)"
42    fi
43fi
44
45if ! cmp  "$OK" "$CURRENT" &>/dev/null; then
46    if [ "$confirm" ]; then
47        echo -n "confirming changes..."
48        cp $CURRENT $OK || exit 1
49        echo "OK"
50    else
51        echo -e "\e[1;31m*** Warning, upstream version changed! Run '$0 $NAME info' for more info.\e[0m"
52        exit 1
53    fi
54else
55    echo "OK"
56fi
57
Note: See TracBrowser for help on using the repository browser.