Skip to content

Add my script.#1

Open
hathlife wants to merge 3 commits into
gofrp:masterfrom
hathlife:master
Open

Add my script.#1
hathlife wants to merge 3 commits into
gofrp:masterfrom
hathlife:master

Conversation

@hathlife

Copy link
Copy Markdown

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

hathlife commented Feb 4, 2020

Copy link
Copy Markdown
Author

Plan to add exception handling in next morning.

@fatedier

fatedier commented Feb 5, 2020

Copy link
Copy Markdown
Member

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

hathlife commented Feb 6, 2020

Copy link
Copy Markdown
Author

Rebased.

Comment thread 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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

List supported os ?

Comment thread frp_deploy.sh

#Force stop services before upgrade.

systemctl stop frps

Copy link
Copy Markdown
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.

Comment thread frp_deploy.sh
echo "Configuration file is installed to /etc/frp ."

#Fix systemctl warning.
cp ./frp_${FRP_VERSION}_linux_${ARCH}/systemd/* /lib/systemd/system

Copy link
Copy Markdown
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
Copy Markdown
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.

@hathlife hathlife May 23, 2020

Copy link
Copy Markdown
Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread 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
Copy Markdown
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.
Comment thread frp_deploy.sh
@@ -0,0 +1,90 @@
#!/bin/bash

#Check if git is installed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

space

@blizard863 blizard863 May 25, 2020

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread frp_deploy.sh
echo "git is required for installation, exit."
exit 1
fi
#Set flags for hot update.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

space

@blizard863

blizard863 commented May 25, 2020

Copy link
Copy Markdown

image

I think you should fix it ?

Comment thread frp_deploy.sh
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).

Copy link
Copy Markdown

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
Copy Markdown

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