Skip to content

Commit

Permalink
update shell
Browse files Browse the repository at this point in the history
  • Loading branch information
stilleshan committed Dec 17, 2024
1 parent 0938ed7 commit 23f84ea
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions frps_linux_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ REPO=stilleshan/frps
WORK_PATH=$(dirname $(readlink -f $0))
FRP_NAME=frps
FRP_PATH=/usr/local/frp
PROXY_URL="https://mirror.ghproxy.com/"
PROXY_URL="https://ghp.ci/"

# check frps
if [ -f "/usr/local/frp/${FRP_NAME}" ] || [ -f "/usr/local/frp/${FRP_NAME}.toml" ] || [ -f "/lib/systemd/system/${FRP_NAME}.service" ];then
Expand Down Expand Up @@ -72,20 +72,26 @@ fi

FILE_NAME=frp_${FRP_VERSION}_linux_${PLATFORM}

# download
if [ $GOOGLE_HTTP_CODE == "200" ]; then
wget -P ${WORK_PATH} https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz
wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml
else
if [ $PROXY_HTTP_CODE == "200" ]; then
wget -P ${WORK_PATH} ${PROXY_URL}https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz
wget -P ${WORK_PATH} ${PROXY_URL}https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml
else
echo -e "${Red}检测 GitHub Proxy 代理失效 开始使用官方地址下载${Font}"
# check if tar.gz file already exists
if [ ! -f "${WORK_PATH}/${FILE_NAME}.tar.gz" ]; then
# download if file doesn't exist
if [ $GOOGLE_HTTP_CODE == "200" ]; then
wget -P ${WORK_PATH} https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz
wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml
else
if [ $PROXY_HTTP_CODE == "200" ]; then
wget -P ${WORK_PATH} ${PROXY_URL}https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz
wget -P ${WORK_PATH} ${PROXY_URL}https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml
else
echo -e "${Red}检测 GitHub Proxy 代理失效 开始使用官方地址下载${Font}"
wget -P ${WORK_PATH} https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/${FILE_NAME}.tar.gz -O ${FILE_NAME}.tar.gz
wget -P ${WORK_PATH} https://raw.githubusercontent.com/${REPO}/master/${FRP_NAME}.toml -O ${FRP_NAME}.toml
fi
fi
else
echo -e "${Green}文件 ${FILE_NAME}.tar.gz 已存在, 跳过下载.${Font}"
fi

tar -zxvf ${FILE_NAME}.tar.gz
mkdir -p ${FRP_PATH}
mv ${FILE_NAME}/${FRP_NAME} ${FRP_PATH}
Expand Down

0 comments on commit 23f84ea

Please sign in to comment.