Alexander Afanasyev | a9369b4 | 2017-01-11 11:58:00 -0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | set -e |
| 3 | |
| 4 | JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
| 5 | source "$JDIR"/util.sh |
| 6 | |
| 7 | set -x |
| 8 | |
| 9 | pushd "${CACHE_DIR:-/tmp}" >/dev/null |
| 10 | |
| 11 | INSTALLED_VERSION=$((cd NFD && git rev-parse HEAD) 2>/dev/null || echo NONE) |
| 12 | |
| 13 | sudo rm -Rf NFD-latest |
| 14 | |
| 15 | git clone git://github.com/named-data/NFD NFD-latest |
| 16 | |
| 17 | LATEST_VERSION=$((cd NFD-latest && git rev-parse HEAD) 2>/dev/null || echo UNKNOWN) |
| 18 | |
| 19 | if [[ $INSTALLED_VERSION != $LATEST_VERSION ]]; then |
| 20 | sudo rm -Rf NFD |
| 21 | mv NFD-latest NFD |
| 22 | else |
| 23 | sudo rm -Rf NFD-latest |
| 24 | fi |
| 25 | |
| 26 | sudo killall nfd || true |
| 27 | |
| 28 | sudo rm -f /usr/local/bin/nfd |
| 29 | sudo rm -f /usr/local/etc/ndn/nfd.conf |
| 30 | |
| 31 | pushd NFD >/dev/null |
| 32 | |
| 33 | git submodule init |
| 34 | git submodule sync |
| 35 | git submodule update |
| 36 | |
| 37 | ## Cleanup |
| 38 | sudo ./waf -j1 --color=yes distclean |
| 39 | |
| 40 | ./waf -j1 --color=yes configure |
| 41 | ./waf -j1 --color=yes build |
| 42 | sudo ./waf -j1 --color=yes install |
| 43 | sudo cp /usr/local/etc/ndn/nfd.conf.sample /usr/local/etc/ndn/nfd.conf |
| 44 | |
| 45 | popd >/dev/null |
| 46 | popd >/dev/null |