1
0
mirror of https://github.com/QSCTech/zjunet.git synced 2026-01-22 03:34:48 +08:00

Update README and update build system

This commit is contained in:
Wu Yufei 2019-06-04 15:44:12 +08:00
parent 781f6d53bd
commit f10b11227e
No known key found for this signature in database
GPG Key ID: 226E1C0EDF292D66
8 changed files with 223 additions and 77 deletions

4
.gitignore vendored
View File

@ -7,3 +7,7 @@
# Rubbish
*.swp
build/debian/debian
build/rpm/zjunet-*
build/rpm/zjunet.spec
build/openwrt/debian

145
README.md
View File

@ -1,20 +1,22 @@
# zjunet
[查看中文README](README.zh.md)
Command Line Scripts for ZJU (VPN / WLAN / DNS)
## Features
- ZJU VPN (l2tp)
- ZJU WLAN
- ZJUWLAN
- 路由器支持written in Bourne Shell
- Router support
- 多拨支持(多账户负载均衡)
- Overlap network dialing (with load balance)
- ZJUWLAN 与 ZJUVPN 带宽叠加1 WLAN + N VPN在 ZJUWLAN 下)
- Overlap bandwidth of ZJUWLAN and ZJU VPN (1 WLAN + N VPN, Using ZJUWLAN)
- DNS 自动测试设置(适用于 DNS 坏掉的情况)
- Automatic DNS setting (in case DNS do not work)
## Requirements
@ -22,97 +24,116 @@ Command Line Scripts for ZJU (VPN / WLAN / DNS)
- curl
- `dig` (Different package on different platform)
## Install
### Debian / Ubuntu (deb)
Use only one of the methods below:
#### SUGGESTED: From QSC website's linux repository
#### 1. From QSC website's linux repository
wget -qO - https://dl.zjuqsc.com/linux/qsc.public.key | sudo apt-key add -
sudo wget https://dl.zjuqsc.com/linux/debian/qsc.list -O /etc/apt/sources.list.d/qsc.list
sudo apt-get update
sudo apt-get install zjunet
#### 2. Download deb
https://github.com/QSCTech/zjunet/releases
下载 deb双击安装就是。
### Fedora / CentOS (rpm)
在 Releases 中下载安装方法如上。注意 CentOS 7 中需要 epel 源提供 xl2tpd
#### Install from QSC website's linux repository
sudo wget https://dl.zjuqsc.com/linux/qsc.public.key -O /etc/pki/rpm-gpg/RPM-GPG-KEY-QSC-COMP66
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-QSC-COMP66
sudo wget https://dl.zjuqsc.com/linux/yum/qsc.repo -O /etc/yum.repos.d/qsc.repo
sudo yum install zjunet
### Openwrt
https://github.com/QSCTech/zjunet/releases
下载 opk然后 `opkg install` 就是。
### From source
master分支是开发分支请直接从 release 那里获取源码。
```bash
cd zjunet
sudo ./install.sh
``` bash
curl https://dl.zjuqsc.com/linux/qsc.public.key | sudo apt-key add -
curl https://dl.zjuqsc.com/linux/debian/qsc.list | sudo tee /etc/apt/sources.list.d/qsc.list
sudo apt-get update
sudo apt-get install zjunet
```
## Known Issues
#### Alternative: Install .deb package directly
### 丢包
Download .deb package from [Release Page](https://github.com/QSCTech/zjunet/releases),
Click or run `sudo apt-get install ./zjunet_<version>_all.deb` to install.
在有的机子上会丢包(因为用的是 nexthop )。
等有空了也许会换成 iptables 来解决这个问题。
### Fedora / CentOS (rpm)
### ppp0 may disappear on openwrt
#### SUGGESTED: From QSC website's linux repository
make /etc/ppp/options's lcp-echo-failure larger.
```bash
curl https://dl.zjuqsc.com/linux/qsc.public.key | sudo tee /etc/pki/rpm-gpg/RPM-GPG-KEY-QSC-COMP66
curl https://dl.zjuqsc.com/linux/yum/qsc.repo | sudo tee /etc/yum.repos.d/qsc.repo
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-QSC-COMP66
sudo yum install zjunet
```
see also https://github.com/QSCTech/zjunet/issues/39
#### Alternative: Install .rpm package directly
## Openwrt
Download .rpm package from [Release Page](https://github.com/QSCTech/zjunet/releases),
Click or run `sudo yum localinstall zjunet-<version>.noarch.rpm` to install.
Install xl2tpd:
**ATTENTION** In CentOS 7, *xl2tpd* requires epel.
https://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/packages/
### OpenWrt (opk)
## Dev
Download .opk package from [Release Page](https://github.com/QSCTech/zjunet/releases) (onto your router),
Run `opkg install ./zjunet_<version>_all.opk`.
QSCer 可以直接向这个 repo push 而不用发 pull request。
有什么疑虑可以提 issue 问一下,
或者直接来办公室找我(zenozeng)。
### Other linux (Source Code)
master分支就是开发分支。
但是请保证bump version的时候要稳定。
```bash
# Under proper directory
git clone https://github.com/QSCTech/zjunet.git
cd zjunet
sudo ./install.sh
# If update is necessary, run `git pull` and `sudo ./install.sh`
```
### Build
**ATTENTION** Requirement check will **NOT** be done running `./install.sh`.
Please run `xl2tpd -v`, `curl -V` and `dig -v` to verify the installation.
## Troubleshooting
### Packet lose
This is a known issue.
When overlapping VPN and ZJUWLAN, network packet may be lost.
(because of nexthop in routing table).
Contributions to this issue are welcomed. (Maybe using `iptables`)
### ppp0 may disappears on OpenWrt
Set lcp-echo-failure larger in /etc/ppp/options.
See also #39
### Other problems?
Please send mail to tech@zjuqsc.com if you have any other problem.
## Contribute to this project
QSCers may Push directly without sending Pull Requests。
Please write an Issue if you have worries. Contact maintainer directly if necessary.
**PRs from non-QSCers are also welcomed.**
### Packaging Instruction
*(Not finished yet)*
#### Debian
```bash
sudo apt-get install build-essential autoconf automake autotools-dev dh-make debhelper devscripts fakeroot xutils lintian pbuilder
sudo apt-get install build-essential autoconf automake autotools-dev dh-make \
debhelper devscripts fakeroot xutils lintian pbuilder rpm
cd build
./build.sh
```
##### see also
##### See Also
- http://www.webupd8.org/2010/01/how-to-create-deb-package-ubuntu-debian.html
- http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/
#### Openwrt
#### OpenWrt
##### see also
##### See Also
- http://lists.openmoko.org/pipermail/devel/2008-July/000496.html
## Links
### Links
- [Array in unix Bourne Shell](http://unix.stackexchange.com/questions/137566/array-in-unix-bourne-shell)

112
README.zh.md Normal file
View File

@ -0,0 +1,112 @@
# zjunet
适用于 ZJU 的 VPN, WLAN 和 DNS 命令行工具。
## 功能
- 支持 ZJU VPN 连接。
- 支持 ZJUWLAN 连接。
- 路由器支持。
- 多拨支持(多账户负载均衡)。
- ZJUWLAN 与 ZJUVPN 带宽叠加1 WLAN + N VPN在 ZJUWLAN 下)
- DNS 自动测试设置(适用于 DNS 坏掉的情况)
## 依赖
- xl2tpd
- curl
- `dig` (在不同平台的包不同)
## 安装
### Debian / Ubuntu (deb)
#### 推荐:从求是潮网站的仓库下载
``` bash
curl https://dl.zjuqsc.com/linux/qsc.public.key | sudo apt-key add -
curl https://dl.zjuqsc.com/linux/debian/qsc.list | sudo tee /etc/apt/sources.list.d/qsc.list
sudo apt-get update
sudo apt-get install zjunet
```
#### 替代方案:直接安装 deb 包
从 [Releases 页](https://github.com/QSCTech/zjunet/releases) 下载 deb 包,
双击安装或运行 `sudo apt-get install ./zjunet_版本_all.deb`
### Fedora / CentOS (rpm)
#### 推荐:从求是潮网站的仓库下载
```bash
curl https://dl.zjuqsc.com/linux/qsc.public.key | sudo tee /etc/pki/rpm-gpg/RPM-GPG-KEY-QSC-COMP66
curl https://dl.zjuqsc.com/linux/yum/qsc.repo | sudo tee /etc/yum.repos.d/qsc.repo
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-QSC-COMP66
sudo yum install zjunet
```
#### 替代方案:直接安装 rpm 包
从 [Releases 页](https://github.com/QSCTech/zjunet/releases) 下载 rpm 包,
双击安装或运行 `sudo yum localinstall zjunet-(版本).noarch.rpm`
**注意** CentOS 7 中需要 epel 源提供 xl2tpd 。
### OpenWrt (opk)
从 [Releases 页](https://github.com/QSCTech/zjunet/releases) 下载 opk 包到路由器上,
运行 `opkg install ./zjunet_版本_all.opk`
### Other linux (源代码安装)
```bash
# 在合适的目录下
git clone https://github.com/QSCTech/zjunet.git
cd zjunet
sudo ./install.sh
# 如果想要更新请在 zjunet 目录下运行 git pull 并再次 sudo ./install.sh
```
**注意** 运行 `./install.sh`**不会** 确认必要依赖是否已经安装。
您应当运行 `xl2tpd -v``curl -V``dig -v` 确认安装。
## 疑难解答
### 丢包
这是一个已知问题。在同时连接 VPN 和 ZJUWLAN 时,
在有的机子上会丢包(因为设定的路由使用了 nexthop )。
暂时没有人来解决这个问题,欢迎有志者贡献(可以考虑用 `iptables`
### OpenWrt 上的 ppp0 消失了
将 /etc/ppp/options 中的 lcp-echo-failure 调大。
可见于 #39
### 我还有其它问题
如果你还有其它问题,请与我们联系。
您可以发送邮件至 tech@zjuqsc.com 。
## 如何贡献
求是潮成员可以直接向这个仓库 Push 而不用发起 Pull requests。
有任何疑虑都可以提 Issue ,也可以与现任 Maintainer 联系。
**本项目也接受非求是潮成员发起的 PR 。**
### 开发指南
开发信息请查看 [英文 README](README.md#packaging-instruction) 。

View File

@ -2,16 +2,22 @@
VERSION=$(cat ../VERSION)
cd rpm
./build.sh $VERSION
cd ..
fail() {
echo -e "\033[31mERROR: Failed to build $1\033[0m" 1>&2
}
cd debian
./build.sh $VERSION
cd ..
pushd rpm > /dev/null
./build.sh $VERSION || fail 'RPM package'
popd > /dev/null
cd openwrt
./build.sh $VERSION
pushd debian > /dev/null
./build.sh $VERSION || fail 'Debian package'
popd > /dev/null
cd ..
pushd openwrt > /dev/null
./build.sh $VERSION || fail 'OpenWrt package'
popd > /dev/null
echo -ne "\033[0;32m"
find . -regextype posix-egrep -regex ".*\.(opk|deb|rpm)$"
echo -ne "\033[0m"

View File

@ -1,4 +1,5 @@
#!/bin/sh
set -e
rm -rf *.deb
@ -35,7 +36,7 @@ Version: $VERSION
Section: net
Priority: optional
Architecture: all
Depends: xl2tpd (>= 1.3.1), curl
Depends: xl2tpd (>= 1.3.1), curl, dnsutils
Maintainer: Zeno Zeng <zenoofzeng@gmail.com>
Description: Command Line Scripts for ZJU
This script provides a VPN / WLAN / NEXTHOP for ZJUer.

View File

@ -1,4 +1,5 @@
#!/bin/sh
set -e
rm -rf *.opk
@ -25,7 +26,7 @@ Version: $VERSION
Section: net
Priority: optional
Architecture: all
Depends: xl2tpd (>= 1.3.1), curl
Depends: xl2tpd (>= 1.3.1), curl, bind-dig
Maintainer: Zeno Zeng <zenoofzeng@gmail.com>
Description: Command Line Scripts for ZJU
This script provides a VPN / WLAN / NEXTHOP for ZJUer.

View File

@ -1,4 +1,5 @@
#!/bin/sh
set -e
rm -rf *.rpm
@ -28,7 +29,7 @@ rm -rf ${SEMINAME}.tar.gz
find rpm -type d | xargs chmod 755
rm -rf $SEMINAME
mv rpm $SEMINAME
tar zcvf ${SEMINAME}.tar.gz $SEMINAME
tar zcf ${SEMINAME}.tar.gz $SEMINAME
mkdir -p $HOME/rpmbuild/SOURCES
cp ${SEMINAME}.tar.gz $HOME/rpmbuild/SOURCES
cp build_spec.sh $SEMINAME/

View File

@ -13,7 +13,7 @@ echo "Group: Applications/Internet" >> zjunet.spec
echo "URL: https://github.com/QSCTech/zjunet/" >> zjunet.spec
echo "Vendor: Qiu Shi Chao Website of Zhejiang University" >> zjunet.spec
echo "Packager: Senorsen <sen@senorsen.com>" >> zjunet.spec
echo "Requires: xl2tpd >= 1.3.1, curl" >> zjunet.spec
echo "Requires: xl2tpd >= 1.3.1, curl, dnsutils" >> zjunet.spec
echo "BuildRoot: %{_builddir}/%{name}-root" >> zjunet.spec
echo "Source: %{name}-%{version}.tar.gz" >> zjunet.spec
echo "BuildArch: noarch" >> zjunet.spec
@ -37,7 +37,7 @@ echo 'install -m 755 zjunet $RPM_BUILD_ROOT/usr/bin/zjunet' >> zjunet.spec
echo 'install -m 755 zjunet-postinst $RPM_BUILD_ROOT/usr/share/zjunet/zjunet-postinst' >> zjunet.spec
cd lib
for f in *.sh; do
echo "install -m 755 lib/$f \$RPM_BUILD_ROOT/usr/lib/zjunet/$f" >> ../zjunet.spec
echo "install -m 755 lib/$f \$RPM_BUILD_ROOT/usr/lib/zjunet/$f" >> ../zjunet.spec
done
cd ..
echo 'install -m 644 VERSION $RPM_BUILD_ROOT/usr/share/zjunet/VERSION' >> zjunet.spec
@ -53,7 +53,7 @@ echo "/usr/share/zjunet/zjunet-postinst" >> zjunet.spec
echo "/usr/share/zjunet/VERSION" >> zjunet.spec
cd lib
for f in *.sh; do
echo "/usr/lib/zjunet/$f" >> ../zjunet.spec
echo "/usr/lib/zjunet/$f" >> ../zjunet.spec
done
cd ..
echo "" >> zjunet.spec