Skip to content

Instantly share code, notes, and snippets.

@jixunmoe
Created December 27, 2020 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jixunmoe/0abdd05edaee1b65953ccce1ccdcbdb8 to your computer and use it in GitHub Desktop.
Save jixunmoe/0abdd05edaee1b65953ccce1ccdcbdb8 to your computer and use it in GitHub Desktop.
Scripts
#!/bin/sh
OS_ARCH="$(uname -m)"
FRP_VER=0.34.3
case "$OS_ARCH" in
x86_64) OS_ARCH=amd64 ;;
i[36]86) OS_ARCH=386 ;;
aarch64) OS_ARCH=arm64 ;;
arm*) OS_ARCH=arm ;;
*)
echo "Unsupported arch: $OS_ARCH"
exit 1
;;
esac
DIR_NAME="frp_${FRP_VER}_linux_${OS_ARCH}"
URL="https://github.com/fatedier/frp/releases/download/v${FRP_VER}/frp_${FRP_VER}_linux_${OS_ARCH}.tar.gz"
cd /tmp
wget -q -O- "$URL" | tar zxf -
cd "$DIR_NAME"
# systemd 服务文件
sed -i 's#/usr/bin/frp#/opt/frp/frp#' systemd/*
cp systemd/* /etc/systemd/system
# 复制默认配置文件
mkdir -p /etc/frp
cp -n *.ini /etc/frp
find /etc/frp -type d -exec chmod 755 {} \;
find /etc/frp -type f -exec chmod 644 {} \;
chown -R 0:0 /etc/frp
# 二进制文件
mkdir -p /opt/frp
chmod 755 frps frpc
cp frps frpc /opt/frp
chown -R 0:0 /opt/frp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment