clearer error for unavailable version

This commit is contained in:
AJ ONeal 2019-08-10 13:30:19 -06:00
parent 11b5474d1e
commit d381c28a0c
1 changed files with 10 additions and 2 deletions

View File

@ -145,16 +145,19 @@ detect_unarchiver()
{ {
set +e set +e
if type -p "$my_unarchiver" >/dev/null 2>&1; then if type -p "$my_unarchiver" >/dev/null 2>&1; then
if type -p tar >/dev/null 2>&1; then if [ "tar" == "$my_unarchiver" ]; then
_my_unarchiver="tar" _my_unarchiver="tar"
_my_unarchive_opts="-xf" _my_unarchive_opts="-xf"
_my_unarchive_out="-C" _my_unarchive_out="-C"
archive_ext="tar.gz" archive_ext="tar.gz"
elif type -p unzip >/dev/null 2>&1; then elif [ "unzip" == "$my_unarchiver" ]; then
_my_unarchiver="unzip" _my_unarchiver="unzip"
_my_unarchive_opts="-qq" _my_unarchive_opts="-qq"
_my_unarchive_out="-d" _my_unarchive_out="-d"
archive_ext="zip" archive_ext="zip"
else
echo "Developer error: '$my_unarchiver' isn't a supported. The developer made a typo."
return 20
fi fi
else else
echo "Failed to find '$my_unarchiver' which is needed to unpack downloaded files." echo "Failed to find '$my_unarchiver' which is needed to unpack downloaded files."
@ -237,6 +240,11 @@ t_os=$(grep $TELEBIT_RELEASE $my_tmp/index.tab | grep $TELEBIT_OS | grep $TELEBI
t_arch=$(grep $TELEBIT_RELEASE $my_tmp/index.tab | grep $TELEBIT_OS | grep $TELEBIT_ARCH | head -n 1 | cut -f 7) t_arch=$(grep $TELEBIT_RELEASE $my_tmp/index.tab | grep $TELEBIT_OS | grep $TELEBIT_ARCH | head -n 1 | cut -f 7)
t_url=$(grep $TELEBIT_RELEASE $my_tmp/index.tab | grep $TELEBIT_OS | grep $TELEBIT_ARCH | head -n 1 | cut -f 8) t_url=$(grep $TELEBIT_RELEASE $my_tmp/index.tab | grep $TELEBIT_OS | grep $TELEBIT_ARCH | head -n 1 | cut -f 8)
if [ -z "$t_url" ]; then
echo "No matching version for '$TELEBIT_RELEASE' for '$TELEBIT_OS' on '$TELEBIT_ARCH'"
exit 2
fi
my_dir="telebit-$latest-$TELEBIT_OS-$TELEBIT_ARCH" my_dir="telebit-$latest-$TELEBIT_OS-$TELEBIT_ARCH"
my_file="$my_dir.$archive_ext" my_file="$my_dir.$archive_ext"
if [ -f "$HOME/Downloads/$my_file" ]; then if [ -f "$HOME/Downloads/$my_file" ]; then