-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add my script. #1
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# deploy | ||
Deploy scripts for frp. | ||
Deploy scripts for frp. | ||
Usage: | ||
> bash <( curl -s -L https://github.com/gofrp/deploy/raw/master/frp_deploy.sh ) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/bash | ||
|
||
#Check if git is installed. | ||
type git | ||
if [ $? != 0 ]; then | ||
echo "git is required for installation, exit." | ||
exit 1 | ||
fi | ||
#Set flags for hot update. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space |
||
|
||
frps_FLAG=`ps -ef |grep -w frps|grep -v grep|wc -l` | ||
frpc_FLAG=`ps -ef |grep -w frpc|grep -v grep|wc -l` | ||
|
||
#Force stop services before upgrade. | ||
|
||
systemctl stop frps | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
systemctl stop frpc | ||
|
||
#Detect the arch. | ||
|
||
case $(uname -m) in | ||
"x86_64") | ||
ARCH="amd64" | ||
;; | ||
"i*86") | ||
ARCH="386" | ||
;; | ||
"arm64") | ||
ARCH="arm64" | ||
;; | ||
"armhf") | ||
ARCH="arm" | ||
;; | ||
"mips64") | ||
ARCH="mips64" | ||
;; | ||
"mips64le") | ||
ARCH="mips64le" | ||
;; | ||
"mips") | ||
ARCH="mips" | ||
;; | ||
*) | ||
echo "Unsupport architecture." && exit 0 | ||
esac | ||
echo "Detected ${ARCH} architecture." | ||
#Get latest release tag | ||
RELEASETAG=$(git ls-remote --tags https://github.com/fatedier/frp | sort -t '/' -k 2 -V | sed -e '/\^/d') | ||
export FRP_VERSION=${RELEASETAG:0-6} | ||
echo "The latest frp release is ${FRP_VERSION}" | ||
mkdir -p /etc/frp | ||
|
||
rm -rf /tmp/frp_${FRP_VERSION}_linux_${ARCH}* | ||
cd /tmp | ||
echo "Downloading tar package from Github......" | ||
wget -q "https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_${ARCH}.tar.gz" | ||
echo "Download complete." | ||
echo "Unpacking......" | ||
tar xzf frp_${FRP_VERSION}_linux_${ARCH}.tar.gz | ||
echo "Installing binary files......" | ||
cp ./frp_${FRP_VERSION}_linux_${ARCH}/frps /usr/local/bin && chmod +x /usr/local/bin/frps | ||
cp ./frp_${FRP_VERSION}_linux_${ARCH}/frpc /usr/local/bin && chmod +x /usr/local/bin/frpc | ||
setcap cap_net_bind_service=ep /usr/local/bin/frps #Give frps binary access to well-known ports(smbd,NetBIOS,etc). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 看了一下下面说的,如果认为有些发行版不会使用 systemd 的话,或许可以试试用 |
||
echo "Installing configuration files......" | ||
test -e /etc/frp/frpc.ini && echo "Configuration files exist. Do not copy templetes." || (echo "Configuration files do not exist. Copy templetes." && cp ./frp_${FRP_VERSION}_linux_${ARCH}/frp*.ini /etc/frp) | ||
echo "Configuration file is installed to /etc/frp ." | ||
|
||
#Fix systemctl warning. | ||
cp ./frp_${FRP_VERSION}_linux_${ARCH}/systemd/* /lib/systemd/system | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not all linux os support systemd? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And we can copy systemd configurefiles to this repo, it will not managed in frp repo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Gentoo / Slackware are affected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Not necessarily,Keeping systemd unit files with binaries can make install script simpler, or we need to download them from this repo separately. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Upload the init.d script to frp repo? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The process should be:
We can only support specified os you tested and comment it. |
||
systemctl daemon-reload | ||
|
||
echo "Install complete." | ||
echo "See https://github.com/fatedier/frp/blob/master/README.md for configuration." | ||
echo "Use \"systemctl start frps\" or \"systemctl start frpc\" to start frpc\frps service." | ||
|
||
#Auto restart services. | ||
|
||
if [ $frps_FLAG ] | ||
then | ||
systemctl start frps | ||
elif [ $frpc_FLAG ] | ||
then | ||
systemctl start frpc | ||
fi | ||
|
||
#systemctl enable frps | ||
#systemctl enable frpc | ||
|
||
rm -rf /tmp/frp_${FRP_VERSION}_linux_${ARCH}* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://linuxize.com/post/bash-comments/
https://www.cyberciti.biz/faq/bash-comment-out-multiple-line-code/