fix(script): grammar

This commit is contained in:
Toby 2023-09-05 21:29:36 -07:00
parent 764bb081af
commit a2347ad75f

View file

@ -178,7 +178,7 @@ show_argument_error_and_exit() {
local _error_msg="$1"
error "$_error_msg"
echo "Try \"$0 --help\" for the usage." >&2
echo "Try \"$0 --help\" for usage." >&2
exit 22
}
@ -311,7 +311,7 @@ rerun_with_sudo() {
_target_script="$0"
fi
note "Re-running this script with sudo, you can also specify FORCE_NO_ROOT=1 to force this script running with current user."
note "Re-running this script with sudo. You can also specify FORCE_NO_ROOT=1 to force this script to run as the current user."
exec_sudo "$_target_script" "${SCRIPT_ARGS[@]}"
}
@ -320,15 +320,15 @@ check_permission() {
return
fi
note "The user currently executing this script is not root."
note "The user running this script is not root."
case "$FORCE_NO_ROOT" in
'1')
warning "FORCE_NO_ROOT=1 is specified, we will process without root and you may encounter the insufficient privilege error."
warning "FORCE_NO_ROOT=1 detected, we will proceed without root, but you may get insufficient privileges errors."
;;
*)
if ! rerun_with_sudo; then
error "Please run this script with root or specify FORCE_NO_ROOT=1 to force this script running with current user."
error "Please run this script with root or specify FORCE_NO_ROOT=1 to force this script to run as the current user."
exit 13
fi
;;
@ -337,7 +337,7 @@ check_permission() {
check_environment_operating_system() {
if [[ -n "$OPERATING_SYSTEM" ]]; then
warning "OPERATING_SYSTEM=$OPERATING_SYSTEM is specified, opreating system detection will not be perform."
warning "OPERATING_SYSTEM=$OPERATING_SYSTEM detected, operating system detection will not be performed."
return
fi
@ -347,13 +347,13 @@ check_environment_operating_system() {
fi
error "This script only supports Linux."
note "Specify OPERATING_SYSTEM=[linux|darwin|freebsd|windows] to bypass this check and force this script running on this $(uname)."
note "Specify OPERATING_SYSTEM=[linux|darwin|freebsd|windows] to bypass this check and force this script to run on this $(uname)."
exit 95
}
check_environment_architecture() {
if [[ -n "$ARCHITECTURE" ]]; then
warning "ARCHITECTURE=$ARCHITECTURE is specified, architecture detection will not be performed."
warning "ARCHITECTURE=$ARCHITECTURE detected, architecture detection will not be performed."
return
fi
@ -378,7 +378,7 @@ check_environment_architecture() {
;;
*)
error "The architecture '$(uname -a)' is not supported."
note "Specify ARCHITECTURE=<architecture> to bypass this check and force this script running on this $(uname -m)."
note "Specify ARCHITECTURE=<architecture> to bypass this check and force this script to run on this $(uname -m)."
exit 8
;;
esac
@ -391,15 +391,15 @@ check_environment_systemd() {
case "$FORCE_NO_SYSTEMD" in
'1')
warning "FORCE_NO_SYSTEMD=1 is specified, we will process as normal even if systemd is not detected by us."
warning "FORCE_NO_SYSTEMD=1, we will proceed as normal even if systemd is not detected."
;;
'2')
warning "FORCE_NO_SYSTEMD=2 is specified, we will process but all systemd related command will not be executed."
warning "FORCE_NO_SYSTEMD=2, we will proceed but skip all systemd related commands."
;;
*)
error "This script only supports Linux distributions with systemd."
note "Specify FORCE_NO_SYSTEMD=1 to disable this check and force this script running as systemd is detected."
note "Specify FORCE_NO_SYSTEMD=2 to disable this check along with all systemd related commands."
note "Specify FORCE_NO_SYSTEMD=1 to disable this check and force this script to run as if systemd exists."
note "Specify FORCE_NO_SYSTEMD=2 to disable this check and skip all systemd related commands."
;;
esac
}
@ -596,7 +596,7 @@ parse_arguments() {
case "$1" in
'--remove')
if [[ -n "$OPERATION" && "$OPERATION" != 'remove' ]]; then
show_argument_error_and_exit "Option '--remove' is conflicted with other options."
show_argument_error_and_exit "Option '--remove' is in conflict with other options."
fi
OPERATION='remove'
;;
@ -607,12 +607,12 @@ parse_arguments() {
fi
shift
if ! has_prefix "$VERSION" 'v'; then
show_argument_error_and_exit "Version numbers should begin with 'v' (such like 'v2.0.0'), got '$VERSION'"
show_argument_error_and_exit "Version numbers should begin with 'v' (such as 'v2.0.0'), got '$VERSION'"
fi
;;
'-c' | '--check')
if [[ -n "$OPERATION" && "$OPERATION" != 'check' ]]; then
show_argument_error_and_exit "Option '-c' or '--check' is conflicted with other option."
show_argument_error_and_exit "Option '-c' or '--check' is in conflict with other options."
fi
OPERATION='check_update'
;;
@ -644,15 +644,15 @@ parse_arguments() {
case "$OPERATION" in
'install')
if [[ -n "$VERSION" && -n "$LOCAL_FILE" ]]; then
show_argument_error_and_exit '--version and --local cannot be specified together.'
show_argument_error_and_exit '--version and --local cannot be used together.'
fi
;;
*)
if [[ -n "$VERSION" ]]; then
show_argument_error_and_exit "--version is only avaiable when install."
show_argument_error_and_exit "--version is only valid for install operation."
fi
if [[ -n "$LOCAL_FILE" ]]; then
show_argument_error_and_exit "--local is only avaiable when install."
show_argument_error_and_exit "--local is only valid for install operation."
fi
;;
esac
@ -803,7 +803,7 @@ get_latest_version() {
local _tmpfile=$(mktemp)
if ! curl -sS -H 'Accept: application/vnd.github.v3+json' "$API_BASE_URL/releases/latest" -o "$_tmpfile"; then
error "Failed to get latest release, please check your network."
error "Failed to get the latest version from GitHub API, please check your network and try again."
exit 11
fi
@ -825,7 +825,7 @@ download_hysteria() {
local _download_url="$REPO_URL/releases/download/app/$_version/hysteria-$OPERATING_SYSTEM-$ARCHITECTURE"
echo "Downloading hysteria binary: $_download_url ..."
if ! curl -R -H 'Cache-Control: no-cache' "$_download_url" -o "$_destination"; then
error "Download failed! Please check your network and try again."
error "Download failed, please check your network and try again."
return 11
fi
return 0
@ -951,18 +951,18 @@ perform_install() {
if [[ "x$FORCE" == "x1" ]]; then
if [[ -z "$_is_update_required" ]]; then
note "Option '--force' is specified, re-install even if installed version is the latest."
note "Option '--force' detected, re-install even if installed version is the latest."
fi
_is_update_required=1
fi
if [[ -z "$_is_update_required" ]]; then
echo "$(tgreen)Installed version is up-to-dated, there is nothing to do.$(treset)"
echo "$(tgreen)Installed version is up-to-date, there is nothing to do.$(treset)"
return
fi
if is_hysteria1_version "$VERSION"; then
error "This script can be only used to install the Hysteria 2"
error "This script can only install Hysteria 2."
exit 95
fi
@ -1040,7 +1040,7 @@ perform_check_update() {
echo
else
echo
echo "$(tgreen)Installed version is up-to-dated.$(treset)"
echo "$(tgreen)Installed version is up-to-date.$(treset)"
echo
fi
}