Change to function

pull/1/head
Dct Mei 2020-04-17 00:09:54 +08:00
parent 45f823dd06
commit 65fc443163
No known key found for this signature in database
GPG Key ID: 50BF8B712DCAD7EA
1 changed files with 166 additions and 161 deletions

View File

@ -12,7 +12,7 @@
# If the script executes incorrectly, go to: # If the script executes incorrectly, go to:
# https://github.com/v2fly/fhs-install-v2ray/issues # https://github.com/v2fly/fhs-install-v2ray/issues
# Identify the operating system and architecture identify_the_operating_system_and_architecture() {
if [[ "$(uname)" == 'Linux' ]]; then if [[ "$(uname)" == 'Linux' ]]; then
case "$(uname -m)" in case "$(uname -m)" in
'i386' | 'i686') 'i386' | 'i686')
@ -82,8 +82,9 @@ else
echo "error: This operating system is not supported." echo "error: This operating system is not supported."
exit 1 exit 1
fi fi
}
# Judgment parameters judgment_parameters() {
if [[ "$#" -gt '0' ]]; then if [[ "$#" -gt '0' ]]; then
case "$1" in case "$1" in
'--remove') '--remove')
@ -186,6 +187,7 @@ if [[ "$#" -gt '0' ]]; then
;; ;;
esac esac
fi fi
}
install_software() { install_software() {
COMPONENT="$1" COMPONENT="$1"
@ -457,6 +459,9 @@ show_help() {
} }
main() { main() {
identify_the_operating_system_and_architecture
judgment_parameters "$@"
# Parameter information # Parameter information
[[ "$HELP" -eq '1' ]] && show_help [[ "$HELP" -eq '1' ]] && show_help
[[ "$CHECK" -eq '1' ]] && check_update [[ "$CHECK" -eq '1' ]] && check_update
@ -538,4 +543,4 @@ main() {
fi fi
} }
main main "$@"