mirror of
https://mirror.suhoan.cn/https://github.com/EasyTier/EasyTier.git
synced 2025-12-12 12:47:25 +08:00
feat(install): enhance installation script functionality (#770)
* feat(install): enhance installation script functionality - Add help information display feature - Support custom GitHub proxy URL - Add --no-gh-proxy option to disable GitHub proxy - Optimize error messages and command prompts - Fix typo (Commend -> Command) * docs: update installation script documentation --------- Co-authored-by: evanq <mail.qxw.im> Co-authored-by: Sijie.Sun <sunsijie@buaa.edu.cn>
This commit is contained in:
31
README.md
31
README.md
@@ -63,7 +63,36 @@ EasyTier is a simple, safe and decentralized VPN networking solution implemented
|
|||||||
wget -O /tmp/easytier.sh "https://raw.githubusercontent.com/EasyTier/EasyTier/main/script/install.sh" && bash /tmp/easytier.sh install
|
wget -O /tmp/easytier.sh "https://raw.githubusercontent.com/EasyTier/EasyTier/main/script/install.sh" && bash /tmp/easytier.sh install
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also uninstall/update Easytier by the command "uninstall" or "update" of this script
|
The script supports the following commands and options:
|
||||||
|
|
||||||
|
Commands:
|
||||||
|
- `install`: Install EasyTier
|
||||||
|
- `uninstall`: Uninstall EasyTier
|
||||||
|
- `update`: Update EasyTier to the latest version
|
||||||
|
- `help`: Show help message
|
||||||
|
|
||||||
|
Options:
|
||||||
|
- `--skip-folder-verify`: Skip folder verification during installation
|
||||||
|
- `--skip-folder-fix`: Skip automatic folder path fixing
|
||||||
|
- `--no-gh-proxy`: Disable GitHub proxy
|
||||||
|
- `--gh-proxy`: Set custom GitHub proxy URL (default: https://ghfast.top/)
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
```sh
|
||||||
|
# Show help
|
||||||
|
bash /tmp/easytier.sh help
|
||||||
|
|
||||||
|
# Install with options
|
||||||
|
bash /tmp/easytier.sh install --skip-folder-verify
|
||||||
|
bash /tmp/easytier.sh install --no-gh-proxy
|
||||||
|
bash /tmp/easytier.sh install --gh-proxy https://your-proxy.com/
|
||||||
|
|
||||||
|
# Update EasyTier
|
||||||
|
bash /tmp/easytier.sh update
|
||||||
|
|
||||||
|
# Uninstall EasyTier
|
||||||
|
bash /tmp/easytier.sh uninstall
|
||||||
|
```
|
||||||
|
|
||||||
6. **Install by Homebrew (For MacOS Only)**
|
6. **Install by Homebrew (For MacOS Only)**
|
||||||
|
|
||||||
|
|||||||
31
README_CN.md
31
README_CN.md
@@ -61,7 +61,36 @@
|
|||||||
wget -O /tmp/easytier.sh "https://raw.githubusercontent.com/EasyTier/EasyTier/main/script/install.sh" && bash /tmp/easytier.sh install
|
wget -O /tmp/easytier.sh "https://raw.githubusercontent.com/EasyTier/EasyTier/main/script/install.sh" && bash /tmp/easytier.sh install
|
||||||
```
|
```
|
||||||
|
|
||||||
使用本脚本安装的 Easytier 可以使用脚本的 uninstall/update 对其卸载/升级
|
脚本支持以下命令和选项:
|
||||||
|
|
||||||
|
命令:
|
||||||
|
- `install`: 安装 EasyTier
|
||||||
|
- `uninstall`: 卸载 EasyTier
|
||||||
|
- `update`: 更新 EasyTier 到最新版本
|
||||||
|
- `help`: 显示帮助信息
|
||||||
|
|
||||||
|
选项:
|
||||||
|
- `--skip-folder-verify`: 跳过安装过程中的文件夹验证
|
||||||
|
- `--skip-folder-fix`: 跳过自动修复文件夹路径
|
||||||
|
- `--no-gh-proxy`: 禁用 GitHub 代理
|
||||||
|
- `--gh-proxy`: 设置自定义 GitHub 代理 URL (默认值: https://ghfast.top/)
|
||||||
|
|
||||||
|
示例:
|
||||||
|
```sh
|
||||||
|
# 查看帮助
|
||||||
|
bash /tmp/easytier.sh help
|
||||||
|
|
||||||
|
# 安装(带选项)
|
||||||
|
bash /tmp/easytier.sh install --skip-folder-verify
|
||||||
|
bash /tmp/easytier.sh install --no-gh-proxy
|
||||||
|
bash /tmp/easytier.sh install --gh-proxy https://your-proxy.com/
|
||||||
|
|
||||||
|
# 更新 EasyTier
|
||||||
|
bash /tmp/easytier.sh update
|
||||||
|
|
||||||
|
# 卸载 EasyTier
|
||||||
|
bash /tmp/easytier.sh uninstall
|
||||||
|
```
|
||||||
|
|
||||||
6. **使用 Homebrew 安装 (仅适用于 MacOS)**
|
6. **使用 Homebrew 安装 (仅适用于 MacOS)**
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,50 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
RED_COLOR='\e[1;31m'
|
||||||
|
GREEN_COLOR='\e[1;32m'
|
||||||
|
YELLOW_COLOR='\e[1;33m'
|
||||||
|
BLUE_COLOR='\e[1;34m'
|
||||||
|
PINK_COLOR='\e[1;35m'
|
||||||
|
SHAN='\e[1;33;5m'
|
||||||
|
RES='\e[0m'
|
||||||
|
|
||||||
|
HELP() {
|
||||||
|
echo -e "\r\n${GREEN_COLOR}EasyTier Installation Script Help${RES}\r\n"
|
||||||
|
echo "Usage: ./install.sh [command] [options]"
|
||||||
|
echo
|
||||||
|
echo "Commands:"
|
||||||
|
echo " install Install EasyTier"
|
||||||
|
echo " uninstall Uninstall EasyTier"
|
||||||
|
echo " update Update EasyTier to the latest version"
|
||||||
|
echo " help Show this help message"
|
||||||
|
echo
|
||||||
|
echo "Options:"
|
||||||
|
echo " --skip-folder-verify Skip folder verification during installation"
|
||||||
|
echo " --skip-folder-fix Skip automatic folder path fixing"
|
||||||
|
echo " --no-gh-proxy Disable GitHub proxy"
|
||||||
|
echo " --gh-proxy URL Set custom GitHub proxy URL"
|
||||||
|
echo
|
||||||
|
echo "Examples:"
|
||||||
|
echo " ./install.sh install /opt/easytier"
|
||||||
|
echo " ./install.sh install --skip-folder-verify"
|
||||||
|
echo " ./install.sh install --no-gh-proxy"
|
||||||
|
echo " ./install.sh install --gh-proxy https://your-proxy.com/"
|
||||||
|
echo " ./install.sh update"
|
||||||
|
echo " ./install.sh uninstall"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Show help if no arguments or help command is used
|
||||||
|
if [ $# -eq 0 ] || [ "$1" = "help" ]; then
|
||||||
|
HELP
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# This script copy from alist , Thank for it!
|
# This script copy from alist , Thank for it!
|
||||||
|
|
||||||
SKIP_FOLDER_VERIFY=false
|
SKIP_FOLDER_VERIFY=false
|
||||||
SKIP_FOLDER_FIX=false
|
SKIP_FOLDER_FIX=false
|
||||||
|
NO_GH_PROXY=false
|
||||||
|
GH_PROXY='https://ghfast.top/'
|
||||||
|
|
||||||
COMMEND=$1
|
COMMEND=$1
|
||||||
shift
|
shift
|
||||||
@@ -19,6 +60,16 @@ while [[ "$#" -gt 0 ]]; do
|
|||||||
case $1 in
|
case $1 in
|
||||||
--skip-folder-verify) SKIP_FOLDER_VERIFY=true ;;
|
--skip-folder-verify) SKIP_FOLDER_VERIFY=true ;;
|
||||||
--skip-folder-fix) SKIP_FOLDER_FIX=true ;;
|
--skip-folder-fix) SKIP_FOLDER_FIX=true ;;
|
||||||
|
--no-gh-proxy) NO_GH_PROXY=true ;;
|
||||||
|
--gh-proxy)
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
GH_PROXY=$2
|
||||||
|
shift
|
||||||
|
else
|
||||||
|
echo "Error: --gh-proxy requires a URL"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*) echo "Unknown option: $1"; exit 1 ;;
|
*) echo "Unknown option: $1"; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
@@ -40,13 +91,6 @@ echo INSTALL PATH : $INSTALL_PATH
|
|||||||
echo SKIP FOLDER FIX : $SKIP_FOLDER_FIX
|
echo SKIP FOLDER FIX : $SKIP_FOLDER_FIX
|
||||||
echo SKIP FOLDER VERIFY : $SKIP_FOLDER_VERIFY
|
echo SKIP FOLDER VERIFY : $SKIP_FOLDER_VERIFY
|
||||||
|
|
||||||
RED_COLOR='\e[1;31m'
|
|
||||||
GREEN_COLOR='\e[1;32m'
|
|
||||||
YELLOW_COLOR='\e[1;33m'
|
|
||||||
BLUE_COLOR='\e[1;34m'
|
|
||||||
PINK_COLOR='\e[1;35m'
|
|
||||||
SHAN='\e[1;33;5m'
|
|
||||||
RES='\e[0m'
|
|
||||||
# clear
|
# clear
|
||||||
|
|
||||||
# check if unzip is installed
|
# check if unzip is installed
|
||||||
@@ -109,8 +153,6 @@ fi
|
|||||||
|
|
||||||
echo -e "\r\n${GREEN_COLOR}Your platform: ${ARCH} (${platform}) ${RES}\r\n" 1>&2
|
echo -e "\r\n${GREEN_COLOR}Your platform: ${ARCH} (${platform}) ${RES}\r\n" 1>&2
|
||||||
|
|
||||||
GH_PROXY='https://ghfast.top/'
|
|
||||||
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
echo -e "\r\n${RED_COLOR}This script requires run as Root !${RES}\r\n" 1>&2
|
echo -e "\r\n${RED_COLOR}This script requires run as Root !${RES}\r\n" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -159,7 +201,11 @@ INSTALL() {
|
|||||||
# Download
|
# Download
|
||||||
echo -e "\r\n${GREEN_COLOR}Downloading EasyTier $LATEST_VERSION ...${RES}"
|
echo -e "\r\n${GREEN_COLOR}Downloading EasyTier $LATEST_VERSION ...${RES}"
|
||||||
rm -rf /tmp/easytier_tmp_install.zip
|
rm -rf /tmp/easytier_tmp_install.zip
|
||||||
curl -L ${GH_PROXY}https://github.com/EasyTier/EasyTier/releases/latest/download/easytier-linux-${ARCH}-${LATEST_VERSION}.zip -o /tmp/easytier_tmp_install.zip $CURL_BAR
|
BASE_URL="https://github.com/EasyTier/EasyTier/releases/latest/download/easytier-linux-${ARCH}-${LATEST_VERSION}.zip"
|
||||||
|
DOWNLOAD_URL=$($NO_GH_PROXY && echo "$BASE_URL" || echo "${GH_PROXY}${BASE_URL}")
|
||||||
|
echo -e "Download URL: ${GREEN_COLOR}${DOWNLOAD_URL}${RES}"
|
||||||
|
curl -L ${DOWNLOAD_URL} -o /tmp/easytier_tmp_install.zip $CURL_BAR
|
||||||
|
|
||||||
# Unzip resource
|
# Unzip resource
|
||||||
echo -e "\r\n${GREEN_COLOR}Unzip resource ...${RES}"
|
echo -e "\r\n${GREEN_COLOR}Unzip resource ...${RES}"
|
||||||
unzip -o /tmp/easytier_tmp_install.zip -d $INSTALL_PATH/
|
unzip -o /tmp/easytier_tmp_install.zip -d $INSTALL_PATH/
|
||||||
@@ -341,9 +387,9 @@ elif [ "$COMMEND" = "install" ]; then
|
|||||||
echo -e "${RED_COLOR} Install fail, try install by hand${RES}"
|
echo -e "${RED_COLOR} Install fail, try install by hand${RES}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo -e "${RED_COLOR} Error Commend ${RES}\n\r"
|
echo -e "${RED_COLOR} Error Command ${RES}\n\r"
|
||||||
echo " ALLOW:"
|
echo " ALLOW:"
|
||||||
echo -e "\n\r${GREEN_COLOR} install, uninstall, update ${RES}"
|
echo -e "\n\r${GREEN_COLOR} install, uninstall, update, help ${RES}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf /tmp/easytier_tmp_*
|
rm -rf /tmp/easytier_tmp_*
|
||||||
|
|||||||
Reference in New Issue
Block a user