aboutsummarylogtreecommitdiffstats
path: root/upload
blob: dc84dee95c88a8fbec83d0da93bccff7190445f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

PRG="$0"

while [ -h "$PRG" ]; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`/"$link"
    fi
done
SCRIPT_HOME=`dirname "$PRG"`

$SCRIPT_HOME/update
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
  echo "Package is already up to date"
  exit 0
elif [ $EXIT_CODE -eq 1 ]; then
  set -e
  echo "Updating Git"
  cd $SCRIPT_HOME
  ver="$(grep pkgver= PKGBUILD | sed 's/.*=//g')"
  git commit -a -m "Update to $ver"
  git push
elif [ $EXIT_CODE -eq 2 ]; then
  echo "update script failed with exit code 2"
  exit 2
fi