bn_inst=$(mktemp);
which curl;
if [ "$?" = "0" ]; then
	curl https://get.bitninja.io/real_install.sh > $bn_inst;
	if [ "$?" != "0" ]; then
		echo "Error while downloading install script via https.";
		echo "Trying to download via http...";
		curl -L http://get.bitninja.io/real_install.sh > $bn_inst;
		if [ "$?" != "0" ]; then
			echo "Error while downloading install script via http.";
			exit 1;
		fi
	fi
else
	which wget;
	if [ "$?" = "0" ]; then
	  wget -qO $bn_inst https://get.bitninja.io/real_install.sh;
	  if [ "$?" != "0" ]; then
		  echo "Error while downloading install script.";
		  exit 1;
	  fi
	else
		echo "Could not find suitable program to download the installation script. Please install either wget or curl.";
	fi
fi
chmod u+x $bn_inst;
exec bash $bn_inst "$@" <&1;
