friendlier logging
This commit is contained in:
parent
0ffa20d8e9
commit
308b69da57
|
@ -45,7 +45,7 @@ detect_http_get()
|
||||||
_my_http_opts="--quiet"
|
_my_http_opts="--quiet"
|
||||||
_my_http_out="-O"
|
_my_http_out="-O"
|
||||||
else
|
else
|
||||||
echo "Aborted, could not find curl or wget"
|
echo "Failed to find 'curl' or 'wget' to download setup files."
|
||||||
return 7
|
return 7
|
||||||
fi
|
fi
|
||||||
set -e
|
set -e
|
||||||
|
@ -106,20 +106,29 @@ echo ""
|
||||||
# OSTYPE https://stackoverflow.com/a/8597411/151312
|
# OSTYPE https://stackoverflow.com/a/8597411/151312
|
||||||
|
|
||||||
my_os=''
|
my_os=''
|
||||||
|
my_os_friendly=''
|
||||||
my_arch=''
|
my_arch=''
|
||||||
|
my_arch_friendly=''
|
||||||
if [ "$(uname | grep -i 'Darwin')" ]; then
|
if [ "$(uname | grep -i 'Darwin')" ]; then
|
||||||
#OSX_VER="$(sw_vers | grep ProductVersion | cut -d':' -f2 | cut -f2)"
|
#OSX_VER="$(sw_vers | grep ProductVersion | cut -d':' -f2 | cut -f2)"
|
||||||
#OSX_MAJOR="$(echo ${OSX_VER} | cut -d'.' -f1)"
|
#OSX_MAJOR="$(echo ${OSX_VER} | cut -d'.' -f1)"
|
||||||
my_os='darwin'
|
my_os='darwin'
|
||||||
|
my_os_friendly='MacOS'
|
||||||
#if [ -n "$(sysctl hw | grep 64bit | grep ': 1')" ]; then
|
#if [ -n "$(sysctl hw | grep 64bit | grep ': 1')" ]; then
|
||||||
# my_arch="amd64"
|
# my_arch="amd64"
|
||||||
#fi
|
#fi
|
||||||
|
my_unarchiver="tar"
|
||||||
elif [ "$(uname | grep -i 'MING')" ] || [[ "$OSTYPE" == "msys" ]]; then
|
elif [ "$(uname | grep -i 'MING')" ] || [[ "$OSTYPE" == "msys" ]]; then
|
||||||
my_os='windows'
|
my_os='windows'
|
||||||
|
# although it's not quite our market, many people don't know if they have "microsoft" OR "windows"
|
||||||
|
my_os_friendly='Microsoft Windows'
|
||||||
|
my_unarchiver="unzip"
|
||||||
elif [ "$(uname | grep -i 'Linux')" ] || [[ "$OSTYPE" == "linux-gnu" ]]; then
|
elif [ "$(uname | grep -i 'Linux')" ] || [[ "$OSTYPE" == "linux-gnu" ]]; then
|
||||||
my_os='linux'
|
my_os='linux'
|
||||||
|
my_os_friendly='Linux'
|
||||||
# Find out which linux... but there are too many
|
# Find out which linux... but there are too many
|
||||||
#cat /etc/issue
|
#cat /etc/issue
|
||||||
|
my_unarchiver="tar"
|
||||||
else
|
else
|
||||||
>&2 echo "You don't appear to be on Mac (darwin), Linux, or Windows (mingw32)."
|
>&2 echo "You don't appear to be on Mac (darwin), Linux, or Windows (mingw32)."
|
||||||
>&2 echo "Help us support your platform by filing an issue:"
|
>&2 echo "Help us support your platform by filing an issue:"
|
||||||
|
@ -127,6 +136,42 @@ else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export _my_unarchiver=""
|
||||||
|
export _my_unarchive_opts=""
|
||||||
|
export _my_unarchive_out=""
|
||||||
|
export archive_ext=""
|
||||||
|
|
||||||
|
detect_unarchiver()
|
||||||
|
{
|
||||||
|
set +e
|
||||||
|
if type -p "$my_unarchiver" >/dev/null 2>&1; then
|
||||||
|
if type -p tar >/dev/null 2>&1; then
|
||||||
|
_my_unarchiver="tar"
|
||||||
|
_my_unarchive_opts="-xf"
|
||||||
|
_my_unarchive_out="-C"
|
||||||
|
archive_ext="tar.gz"
|
||||||
|
elif type -p unzip >/dev/null 2>&1; then
|
||||||
|
_my_unarchiver="unzip"
|
||||||
|
_my_unarchive_opts="-qq"
|
||||||
|
_my_unarchive_out="-d"
|
||||||
|
archive_ext="zip"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Failed to find '$my_unarchiver' which is needed to unpack downloaded files."
|
||||||
|
return 21
|
||||||
|
fi
|
||||||
|
set -e
|
||||||
|
}
|
||||||
|
|
||||||
|
unarchiver()
|
||||||
|
{
|
||||||
|
$_my_unarchiver $_my_unarchive_opts "$1" $_my_unarchive_out "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
detect_unarchiver
|
||||||
|
export -f unarchiver
|
||||||
|
|
||||||
|
|
||||||
if [ "$(uname -m | grep -i 'ARM')" ]; then
|
if [ "$(uname -m | grep -i 'ARM')" ]; then
|
||||||
if [ "$(uname -m | grep -i 'v5')" ]; then
|
if [ "$(uname -m | grep -i 'v5')" ]; then
|
||||||
my_arch="armv5"
|
my_arch="armv5"
|
||||||
|
@ -142,11 +187,14 @@ if [ "$(uname -m | grep -i 'ARM')" ]; then
|
||||||
elif [ "$(uname -m | grep -i '86')" ]; then
|
elif [ "$(uname -m | grep -i '86')" ]; then
|
||||||
if [ "$(uname -m | grep -i '64')" ]; then
|
if [ "$(uname -m | grep -i '64')" ]; then
|
||||||
my_arch="amd64"
|
my_arch="amd64"
|
||||||
|
my_arch_friendly="64-bit"
|
||||||
else
|
else
|
||||||
my_arch="386"
|
my_arch="386"
|
||||||
|
my_arch_friendly="32-bit"
|
||||||
fi
|
fi
|
||||||
elif [ "$(uname -m | grep -i '64')" ]; then
|
elif [ "$(uname -m | grep -i '64')" ]; then
|
||||||
my_arch="amd64"
|
my_arch="amd64"
|
||||||
|
my_arch_friendly="64-bit"
|
||||||
else
|
else
|
||||||
>&2 echo "Your CPU doesn't appear to be 386, amd64 (x64), armv6, armv7, or armv8 (arm64)."
|
>&2 echo "Your CPU doesn't appear to be 386, amd64 (x64), armv6, armv7, or armv8 (arm64)."
|
||||||
>&2 echo "Help us support your platform by filing an issue:"
|
>&2 echo "Help us support your platform by filing an issue:"
|
||||||
|
@ -157,9 +205,11 @@ export TELEBIT_ARCH="$my_arch"
|
||||||
export TELEBIT_OS="$my_os"
|
export TELEBIT_OS="$my_os"
|
||||||
TELEBIT_VERSION=${TELEBIT_VERSION:-stable}
|
TELEBIT_VERSION=${TELEBIT_VERSION:-stable}
|
||||||
export TELEBIT_RELEASE=${TELEBIT_RELEASE:-$TELEBIT_VERSION}
|
export TELEBIT_RELEASE=${TELEBIT_RELEASE:-$TELEBIT_VERSION}
|
||||||
|
export TELEBIT_ARCHIVER="$my_unarchiver"
|
||||||
|
|
||||||
echo " Operating System: $TELEBIT_OS"
|
echo " Operating System: $my_os_friendly"
|
||||||
echo " Processor Family: $TELEBIT_ARCH"
|
echo " Processor Family: ${my_arch_friendly:-$my_arch}"
|
||||||
|
echo " Download Type: $archive_ext"
|
||||||
echo " Release Channel: $TELEBIT_VERSION"
|
echo " Release Channel: $TELEBIT_VERSION"
|
||||||
echo ""
|
echo ""
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
|
|
Loading…
Reference in New Issue