-
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?
Conversation
Plan to add exception handling in next morning. |
Can you rebase all commits into one? |
Show detected architecture. Fix systemctl warning. Fix systemctl warning again. Force stop service before upgrade. Support hot update. Add shebang. Fix arch strings. Fix bug when determining whether to copy configuration file templetes. Add quick deploy command. Change URL in usage to main repository.
Rebased. |
README.md
Outdated
Deploy scripts for frp. | ||
Deploy scripts for frp. | ||
Usage: | ||
> bash < ( curl -s -L https://github.com/gofrp/deploy/raw/master/frp_deploy.sh ) |
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.
bash < <(curl -s -L https://github.com/gofrp/deploy/raw/master/frp_deploy.sh)
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.
List supported os ?
|
||
#Force stop services before upgrade. | ||
|
||
systemctl stop frps |
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.
deploy.sh
may not need to start or stop service now. We can just display start and stop command after successful installed.
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 comment
The 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Not all linux os support systemd?
Gentoo / Slackware are affected. For gentoo, we can use systemd over the openRC. For slackware, I don't have such environment / knowledge to test.
It make take me some time to figure out traditional init.d method.
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.
And we can copy systemd configurefiles to this repo, it will not managed in frp repo.
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 comment
The 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.
Not necessarily,Keeping systemd unit files with binaries can make install script simpler, or we need to download them from this repo separately.
Upload the init.d script to frp repo?
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.
The process should be:
- Detect system arch and os.
- Download corresponding scripts(systemd configs) or others.
- Download binary files.
- Move files to correct locations.
- Display usage message.
We can only support specified os you tested and comment it.
frp_deploy.sh
Outdated
echo "Unpacking......" | ||
tar xzf frp_${FRP_VERSION}_linux_${ARCH}.tar.gz | ||
echo "Installing binary files......" | ||
cp ./frp_${FRP_VERSION}_linux_${ARCH}/frps /usr/bin && chmod +x /usr/bin/frps |
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.
/usr/local/bin
is better?
fix typo in usage. check if git is installed before start.
@@ -0,0 +1,90 @@ | |||
#!/bin/bash | |||
|
|||
#Check if git is installed. |
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
space
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 comment
The reason will be displayed to describe this comment to others. Learn more.
看了一下下面说的,如果认为有些发行版不会使用 systemd 的话,或许可以试试用 capsh
来为 frp 进程加特权而不是为执行文件后的所有进程加特权
Looks great script! Could we merge it now? |
Feature:
Auto detect & download latest release;
Auto detect CPU architecture.
Auto reload.
TODO:
Add interactive options to determine whether to run frps/frpc services on startup.