Commit | Line | Data |
---|---|---|
da501b1f FB |
1 | #!/usr/bin/env bash |
2 | ||
3 | spoolroot="$(readlink -f $(dirname $0)/..)" | |
4 | dbversionfile="$spoolroot/spool/tmp/db_version" | |
5 | ||
6 | currentversion="$(grep 'VERSION' $spoolroot/ChangeLog | cut -d ' ' -f 2 | head -n 1)" | |
7 | previousversion="$(cat $dbversionfile 2> /dev/null)" | |
8 | ||
9 | function die() { | |
10 | echo "$1" 1>&2 | |
11 | exit 1 | |
12 | } | |
13 | ||
14 | if [ "$currentversion" != "$previousversion" ]; then | |
15 | cd $spoolroot/upgrade/$currentversion/ | |
16 | ./update.sh "$@" || die "Upgrade to $currentversion failed" | |
17 | echo "$currentversion" > $dbversionfile | |
18 | else | |
19 | echo "Already at version $currentversion" | |
20 | fi |