2014-10-15 18:48:58 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
2014-12-10 10:09:17 -08:00
|
|
|
exec 2> /dev/null
|
|
|
|
|
2014-12-07 02:02:51 -08:00
|
|
|
if test x"$1" = x'btcdir'; then
|
|
|
|
if test -n "$BITCOIN_DIR"; then
|
|
|
|
echo "$BITCOIND_DIR"
|
|
|
|
elif test -d "$(pwd)/libbitcoind"; then
|
|
|
|
echo "$(pwd)/libbitcoind"
|
|
|
|
elif test -d "${HOME}/bitcoin"; then
|
|
|
|
echo "${HOME}/bitcoin"
|
|
|
|
fi
|
2014-10-15 18:48:58 -07:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
os=
|
|
|
|
|
2014-12-10 10:09:17 -08:00
|
|
|
if test -f /etc/centos-release \
|
|
|
|
|| grep -q 'CentOS' /etc/redhat-release \
|
|
|
|
|| rpm -q --queryformat '%{VERSION}' centos-release > /dev/null; then
|
2014-12-01 23:58:44 -08:00
|
|
|
os=centos
|
2014-12-10 10:09:17 -08:00
|
|
|
elif grep -q 'Fedora' /etc/system-release; then
|
2014-12-01 23:58:44 -08:00
|
|
|
os=fedora
|
2014-12-10 10:09:17 -08:00
|
|
|
elif uname -a | grep -q '^Darwin'; then
|
2014-10-15 18:48:58 -07:00
|
|
|
os=osx
|
2014-12-10 10:09:17 -08:00
|
|
|
elif test -f /etc/redhat_release \
|
|
|
|
|| test -f /etc/redhat-release; then
|
2014-12-01 23:58:44 -08:00
|
|
|
os=rhel
|
2014-12-10 10:09:17 -08:00
|
|
|
elif test -f /etc/SuSE-release; then
|
2014-12-01 23:58:44 -08:00
|
|
|
os=suse
|
2014-12-10 10:09:17 -08:00
|
|
|
elif test -f /etc/mandrake-release \
|
|
|
|
|| test -f /etc/mandriva-release; then
|
|
|
|
os=mandriva
|
|
|
|
elif grep -q 'Ubuntu' /etc/issue \
|
|
|
|
|| grep -q 'Ubuntu' /etc/lsb-release \
|
|
|
|
|| uname -v | grep -q 'Ubuntu'; then
|
2014-12-01 23:58:44 -08:00
|
|
|
os=ubuntu
|
2014-12-10 10:09:17 -08:00
|
|
|
elif grep -q 'Linux Mint' /etc/issue; then
|
|
|
|
os=mint
|
|
|
|
elif test -f /etc/debian_version \
|
|
|
|
|| test -f /etc/debian-version; then
|
|
|
|
os=debian
|
|
|
|
elif grep -q 'Arch Linux' /etc/issue \
|
|
|
|
|| test -d /lib/systemd -a "$(readlink /usr/bin/vi)" = 'ex'; then
|
2014-10-15 18:48:58 -07:00
|
|
|
os=arch
|
2014-12-10 10:09:17 -08:00
|
|
|
elif test "$(uname -s)" = 'SunOS'; then
|
|
|
|
os=solaris
|
|
|
|
elif test "$(uname -s)" = 'AIX'; then
|
|
|
|
os=aix
|
|
|
|
elif test -d /system && test -d /data/data; then
|
|
|
|
os=android
|
2014-10-15 18:48:58 -07:00
|
|
|
fi
|
|
|
|
|
2014-12-10 10:09:17 -08:00
|
|
|
if test -z "$os" -o "$os" = 'android'; then
|
|
|
|
# Maybe someday...
|
|
|
|
if test "$os" = 'android' -o "$os" = 'aix'; then
|
|
|
|
echo 'Android or AIX detected!' >& 2
|
2014-12-01 23:58:44 -08:00
|
|
|
fi
|
2014-12-10 10:09:17 -08:00
|
|
|
echo 'OS not supported.' >& 2
|
|
|
|
exit 1
|
2014-10-15 18:48:58 -07:00
|
|
|
fi
|
|
|
|
|
2014-12-07 02:02:51 -08:00
|
|
|
if test x"$1" = x'osdir'; then
|
|
|
|
echo -n "$(pwd)/platform/${os}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$1" -o x"$1" = x'lib'; then
|
|
|
|
if test -n "$BITCOIN_DIR" -a -e "${BITCOIN_DIR}/src/libbitcoind.so"; then
|
|
|
|
echo -n "${BITCOIN_DIR}/src/libbitcoind.so"
|
|
|
|
else
|
|
|
|
echo -n "$(pwd)/platform/${os}/libbitcoind.so"
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
fi
|