2015-10-21 19:48:14 +05:00
|
|
|
#!/usr/bin/env bash
|
2016-07-03 02:30:03 +05:00
|
|
|
root=$(readlink -e "$(dirname "$0")")
|
2016-05-03 21:16:36 +05:00
|
|
|
set -e
|
2016-10-08 17:29:46 +05:00
|
|
|
if [ "" == "$root" ] ; then
|
2016-05-03 21:16:36 +05:00
|
|
|
root=$PWD/${0##*}
|
|
|
|
fi
|
2016-07-03 02:30:03 +05:00
|
|
|
cd "$root"
|
2016-03-09 18:36:44 +05:00
|
|
|
|
2016-10-15 18:05:38 +05:00
|
|
|
tags="-tags disable_redis"
|
2016-03-09 18:36:44 +05:00
|
|
|
|
2016-10-15 18:05:38 +05:00
|
|
|
help_text="usage: $0 [--disable-neochan]"
|
2016-03-09 18:36:44 +05:00
|
|
|
|
|
|
|
# check for help flags first
|
2016-07-03 02:30:03 +05:00
|
|
|
for arg in "$@" ; do
|
2016-03-09 18:36:44 +05:00
|
|
|
case $arg in
|
|
|
|
-h|--help)
|
2016-07-03 02:30:03 +05:00
|
|
|
echo "$help_text"
|
2016-03-09 18:36:44 +05:00
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2016-05-15 17:19:03 +05:00
|
|
|
rev="QmPAqM7anxdr1ngPmJz9J9AAxDLinDz2Eh9aAzLF9T7LNa"
|
2016-05-13 17:49:43 +05:00
|
|
|
ipfs="no"
|
2016-05-18 22:22:56 +05:00
|
|
|
rebuildjs="yes"
|
2016-04-18 17:40:01 +05:00
|
|
|
_next=""
|
2016-07-30 17:02:05 +05:00
|
|
|
unstable="no"
|
2016-10-15 18:05:38 +05:00
|
|
|
neochan="yes"
|
2016-03-09 18:36:44 +05:00
|
|
|
# check for build flags
|
2016-07-03 02:30:03 +05:00
|
|
|
for arg in "$@" ; do
|
2016-03-09 18:36:44 +05:00
|
|
|
case $arg in
|
2016-10-15 18:05:38 +05:00
|
|
|
"--disable-neochan")
|
|
|
|
neochan="no"
|
|
|
|
;;
|
2016-07-30 17:02:05 +05:00
|
|
|
"--unstable")
|
|
|
|
unstable="yes"
|
|
|
|
;;
|
2016-05-18 22:22:56 +05:00
|
|
|
"--no-js")
|
|
|
|
rebuildjs="no"
|
|
|
|
;;
|
2016-05-13 17:49:43 +05:00
|
|
|
"--ipfs")
|
|
|
|
ipfs="yes"
|
|
|
|
;;
|
2016-04-18 17:40:01 +05:00
|
|
|
"--revision")
|
|
|
|
_next="rev"
|
|
|
|
;;
|
|
|
|
"--revision=*")
|
2016-07-03 02:30:03 +05:00
|
|
|
rev=$(echo "$arg" | cut -d'=' -f2)
|
2016-04-18 17:40:01 +05:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ "x$_next" == "xrev" ] ; then
|
|
|
|
rev="$arg"
|
|
|
|
fi
|
2016-03-09 18:36:44 +05:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2016-10-08 17:29:46 +05:00
|
|
|
if [ "$rev" == "" ] ; then
|
2016-04-18 17:40:01 +05:00
|
|
|
echo "revision not specified"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-07-03 02:30:03 +05:00
|
|
|
cd "$root"
|
2016-10-08 17:29:46 +05:00
|
|
|
if [ "$rebuildjs" == "yes" ] ; then
|
2016-05-18 22:22:56 +05:00
|
|
|
echo "rebuilding generated js..."
|
2016-10-15 18:05:38 +05:00
|
|
|
if [ "$neochan" == "no" ] ; then
|
|
|
|
./build-js.sh --disable-neochan
|
|
|
|
else
|
|
|
|
./build-js.sh
|
|
|
|
fi
|
2016-05-18 22:22:56 +05:00
|
|
|
fi
|
2016-10-15 18:05:38 +05:00
|
|
|
|
2016-07-03 02:30:03 +05:00
|
|
|
unset GOPATH
|
2016-04-19 04:42:24 +05:00
|
|
|
export GOPATH=$PWD/go
|
2016-07-03 02:30:03 +05:00
|
|
|
mkdir -p "$GOPATH"
|
2016-05-13 17:49:43 +05:00
|
|
|
|
2016-10-08 17:29:46 +05:00
|
|
|
if [ "$ipfs" == "yes" ] ; then
|
2016-07-03 02:30:03 +05:00
|
|
|
if [ ! -e "$GOPATH/bin/gx" ] ; then
|
2016-05-13 18:52:35 +05:00
|
|
|
echo "obtaining gx"
|
2016-05-13 18:56:51 +05:00
|
|
|
go get -u -v github.com/whyrusleeping/gx
|
|
|
|
fi
|
2016-07-03 02:30:03 +05:00
|
|
|
if [ ! -e "$GOPATH/bin/gx-go" ] ; then
|
2016-05-13 18:56:51 +05:00
|
|
|
echo "obtaining gx-go"
|
2016-05-13 18:52:35 +05:00
|
|
|
go get -u -v github.com/whyrusleeping/gx-go
|
|
|
|
fi
|
2016-05-13 19:29:46 +05:00
|
|
|
echo "building stable revision, this will take a bit. to speed this part up install and run ipfs locally"
|
2016-07-03 02:30:03 +05:00
|
|
|
mkdir -p "$GOPATH/src/gx/ipfs"
|
|
|
|
cd "$GOPATH/src/gx/ipfs"
|
|
|
|
"$GOPATH/bin/gx" get "$rev"
|
|
|
|
cd "$root"
|
|
|
|
go get -d -v
|
2016-05-13 19:11:28 +05:00
|
|
|
go build -v .
|
2016-05-13 19:47:56 +05:00
|
|
|
mv nntpchan srndv2
|
2016-07-30 17:02:05 +05:00
|
|
|
echo -e "Built\n"
|
|
|
|
echo "Now configure NNTPChan with ./srndv2 setup"
|
2016-05-13 17:49:43 +05:00
|
|
|
else
|
2016-10-08 17:29:46 +05:00
|
|
|
if [ "$unstable" == "yes" ] ; then
|
2016-07-30 17:02:05 +05:00
|
|
|
go get -u -v github.com/majestrate/srndv2/cmd/nntpchan
|
2016-10-08 17:29:46 +05:00
|
|
|
cp "$GOPATH/bin/nntpchan" "$root"
|
2016-07-30 17:02:05 +05:00
|
|
|
echo "built unstable, if you don't know what to do, run without --unstable"
|
|
|
|
else
|
2016-10-08 17:29:46 +05:00
|
|
|
go get -u -v github.com/majestrate/srndv2
|
|
|
|
cp "$GOPATH/bin/srndv2" "$root"
|
2016-07-30 17:02:05 +05:00
|
|
|
echo -e "Built\n"
|
|
|
|
echo "Now configure NNTPChan with ./srndv2 setup"
|
|
|
|
fi
|
2016-05-13 17:49:43 +05:00
|
|
|
fi
|