diff --git a/platform/mandriva/.gitignore b/platform/mandriva/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/platform/os.sh b/platform/os.sh index 4804e4bb..b58645af 100755 --- a/platform/os.sh +++ b/platform/os.sh @@ -1,5 +1,7 @@ #!/bin/bash +exec 2> /dev/null + if test x"$1" = x'btcdir'; then if test -n "$BITCOIN_DIR"; then echo "$BITCOIND_DIR" @@ -11,42 +13,51 @@ if test x"$1" = x'btcdir'; then exit 0 fi -name=$(uname -a) os= -if echo "$name" | grep -q -i 'cent'; then +if test -f /etc/centos-release \ + || grep -q 'CentOS' /etc/redhat-release \ + || rpm -q --queryformat '%{VERSION}' centos-release > /dev/null; then os=centos -elif echo "$name" | grep -q -i 'debian'; then - os=debian -elif echo "$name" | grep -q -i 'fedora'; then +elif grep -q 'Fedora' /etc/system-release; then os=fedora -elif echo "$name" | grep -q -i 'mint'; then - os=mint -elif echo "$name" | grep -q '^Darwin'; then +elif uname -a | grep -q '^Darwin'; then os=osx -elif echo "$name" | grep -q -i 'redhat'; then +elif test -f /etc/redhat_release \ + || test -f /etc/redhat-release; then os=rhel -elif echo "$name" | grep -q -i 'suse'; then +elif test -f /etc/SuSE-release; then os=suse -elif echo "$name" | grep -q 'Ubuntu'; then +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 os=ubuntu -elif test "$(uname -o 2> /dev/null)" = 'GNU/Linux'; then +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 os=arch +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 fi -# Maybe someday... -# if test -d /system && test -d /data/data; then -# os=android -# fi - -if test -z "$os"; then - # Arch is hard to detect. Check some unique properties of Arch: - if test -d /lib/systemd && test "$(readlink /usr/bin/vi)" = 'ex'; then - os=arch - else - echo 'OS not supported.' >& 2 - exit 1 +if test -z "$os" -o "$os" = 'android'; then + # Maybe someday... + if test "$os" = 'android' -o "$os" = 'aix'; then + echo 'Android or AIX detected!' >& 2 fi + echo 'OS not supported.' >& 2 + exit 1 fi if test x"$1" = x'osdir'; then diff --git a/platform/solaris/.gitignore b/platform/solaris/.gitignore new file mode 100644 index 00000000..e69de29b