mirror of
https://github.com/rclone/rclone.git
synced 2025-06-19 19:28:00 +02:00
error codes documented and bugs fixed
This commit is contained in:
parent
ab03f6e475
commit
f424019380
@ -1,4 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# error codes
|
||||||
|
# 0 - exited without problems
|
||||||
|
# 1 - parameters not supported were used or some unexpected error occured
|
||||||
|
# 2 - OS not supported by this script
|
||||||
|
# 3 - installed version of rclone is up to date
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
usage() { echo "Usage: curl https://rclone.org/install.sh | sudo bash [-s beta]" 1>&2; exit 1; }
|
usage() { echo "Usage: curl https://rclone.org/install.sh | sudo bash [-s beta]" 1>&2; exit 1; }
|
||||||
@ -12,8 +19,13 @@ if [ -n "$1" ]; then
|
|||||||
install_beta="beta "
|
install_beta="beta "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#create tmp directory and move to it
|
||||||
|
tmp_dir=`mktemp -d`; cd $tmp_dir
|
||||||
|
|
||||||
|
|
||||||
#check installed version of rclone to determine if update is necessary
|
#check installed version of rclone to determine if update is necessary
|
||||||
version=`rclone --version | head -n 1`
|
version=`rclone --version 2>errors | head -n 1`
|
||||||
if [ -z "${install_beta}" ]; then
|
if [ -z "${install_beta}" ]; then
|
||||||
current_version=`curl https://downloads.rclone.org/version.txt`
|
current_version=`curl https://downloads.rclone.org/version.txt`
|
||||||
else
|
else
|
||||||
@ -21,8 +33,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$version" = "$current_version" ]; then
|
if [ "$version" = "$current_version" ]; then
|
||||||
echo && echo "The latest ${install_beta}version of rclone is already installed" && echo
|
echo && echo "The latest ${install_beta}version of rclone ${version} is already installed" && echo
|
||||||
exit 1
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -47,11 +59,11 @@ case $OS in
|
|||||||
SunOS)
|
SunOS)
|
||||||
OS='solaris'
|
OS='solaris'
|
||||||
echo 'OS not supported'
|
echo 'OS not supported'
|
||||||
exit 1
|
exit 2
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo 'OS not supported'
|
echo 'OS not supported'
|
||||||
exit 1
|
exit 2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -68,12 +80,10 @@ case $OS_type in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo 'OS type not supported'
|
echo 'OS type not supported'
|
||||||
exit 1
|
exit 2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#create tmp directory and move to it
|
|
||||||
tmp_dir=`mktemp -d`; cd $tmp_dir
|
|
||||||
|
|
||||||
#download and unzip
|
#download and unzip
|
||||||
if [ -z "${install_beta}" ]; then
|
if [ -z "${install_beta}" ]; then
|
||||||
@ -122,7 +132,7 @@ case $OS in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo 'OS not supported'
|
echo 'OS not supported'
|
||||||
exit 1
|
exit 2
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user