Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add my script. #1

wants to merge 3 commits into from

Conversation

hathlife
Copy link

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.

@hathlife hathlife requested a review from fatedier February 4, 2020 17:18
@hathlife
Copy link
Author

hathlife commented Feb 4, 2020

Plan to add exception handling in next morning.

@fatedier
Copy link
Member

fatedier commented Feb 5, 2020

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.
@hathlife
Copy link
Author

hathlife commented Feb 6, 2020

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 )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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
Copy link
Member

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
Copy link
Member

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?

Copy link
Member

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.

Copy link
Author

@hathlife hathlife May 23, 2020

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.

Copy link
Author

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.

Copy link
Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The process should be:

  1. Detect system arch and os.
  2. Download corresponding scripts(systemd configs) or others.
  3. Download binary files.
  4. Move files to correct locations.
  5. 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
Copy link
Member

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space

Copy link

@blizard863 blizard863 May 25, 2020

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space

@blizard863
Copy link

blizard863 commented May 25, 2020

image

I think you should fix it ?

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).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看了一下下面说的,如果认为有些发行版不会使用 systemd 的话,或许可以试试用 capsh 来为 frp 进程加特权而不是为执行文件后的所有进程加特权

@PeterlitsZo
Copy link

Looks great script! Could we merge it now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants