1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

升级测试

This commit is contained in:
suyuan 2020-09-20 22:45:21 +08:00
parent b166c00049
commit f43983c391
19 changed files with 2770 additions and 761 deletions

View file

@ -1,751 +0,0 @@
version: 2
jobs:
prepare:
machine:
image: ubuntu-1604:201903-01
working_directory: ~/
steps:
- run:
name: Prepare
command: |
sudo rm -rf /var/lib/apt/lists/lock
sudo apt-get update
sudo rm -rf /var/lib/apt/lists/lock
sudo apt-get install -yq build-essential git unzip ncurses-dev libz-dev libssl-dev python subversion gettext gawk wget curl rsync perl libelf-dev python3.5 libpython3.5-stdlib liblzma-dev
pyenv global 3.5.2
build_x86_64:
machine:
image: ubuntu-1604:201903-01
environment:
- OMR_VERSION: $CIRCLE_TAG
- OMR_TARGET: x86_64
- OMR_KERNEL: 5.4
working_directory: ~/
steps:
- run:
name: cache
command: |
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
- restore_cache:
keys:
- cache-{{ checksum "/tmp/cache-version" }}
- cache-{{ checksum "/tmp/cache-target" }}
- run:
name: Build toolchain
no_output_timeout: 50m
command: |
git clone https://github.com/ysurac/openmptcprouter || true
cd openmptcprouter
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
git pull || true
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
sudo apt-get update
sudo apt-get install -yq libelf-dev
pyenv global 3.5.2
sh build.sh prepare {tools,toolchain}/install -j2
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
- save_cache:
key: cache-{{ checksum "/tmp/cache-target" }}
paths:
- openmptcprouter
- run:
name: Build
no_output_timeout: 50m
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/install -j2
- run:
name: Deploy
command: |
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
- save_cache:
key: cache-{{ checksum "/tmp/cache-version" }}
paths:
- openmptcprouter
build_x86:
machine:
image: ubuntu-1604:201903-01
environment:
- OMR_VERSION: $CIRCLE_TAG
- OMR_TARGET: x86
- OMR_KERNEL: 5.4
working_directory: ~/
steps:
- run:
name: cache
command: |
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
- restore_cache:
keys:
- cache-{{ checksum "/tmp/cache-version" }}
- cache-{{ checksum "/tmp/cache-target" }}
- run:
name: Build toolchain
no_output_timeout: 40m
command: |
git clone https://github.com/ysurac/openmptcprouter || true
cd openmptcprouter
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
git pull || true
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
pyenv global 3.5.2
sh build.sh prepare {tools,toolchain}/install -j2
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
- save_cache:
key: cache-{{ checksum "/tmp/cache-target" }}
paths:
- openmptcprouter
- run:
name: Build
no_output_timeout: 40m
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/install -j2
- run:
name: Deploy
command: |
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
- save_cache:
key: cache-{{ checksum "/tmp/cache-version" }}
paths:
- openmptcprouter
build_rpi3:
machine:
image: ubuntu-1604:201903-01
environment:
- OMR_VERSION: $CIRCLE_TAG
- OMR_TARGET: rpi3
- OMR_KERNEL: 5.4
working_directory: ~/
steps:
- run:
name: cache
command: |
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
- restore_cache:
keys:
- cache-{{ checksum "/tmp/cache-version" }}
- cache-{{ checksum "/tmp/cache-target" }}
- run:
name: Build toolchain
no_output_timeout: 40m
command: |
git clone https://github.com/ysurac/openmptcprouter || true
cd openmptcprouter
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
git pull || true
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
pyenv global 3.5.2
sh build.sh prepare {tools,toolchain}/install -j2
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
- save_cache:
key: cache-{{ checksum "/tmp/cache-target" }}
paths:
- openmptcprouter
- run:
name: Build
no_output_timeout: 40m
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
- run:
name: Deploy
command: |
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
- save_cache:
key: cache-{{ checksum "/tmp/cache-version" }}
paths:
- openmptcprouter
build_espressobin:
machine:
image: ubuntu-1604:201903-01
environment:
- OMR_VERSION: $CIRCLE_TAG
- OMR_TARGET: espressobin
- OMR_KERNEL: 5.4
working_directory: ~/
steps:
- run:
name: cache
command: |
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
- restore_cache:
keys:
- cache-{{ checksum "/tmp/cache-version" }}
- cache-{{ checksum "/tmp/cache-target" }}
- run:
name: Build toolchain
no_output_timeout: 40m
command: |
git clone https://github.com/ysurac/openmptcprouter || true
cd openmptcprouter
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
git pull || true
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
pyenv global 3.5.2
sh build.sh prepare {tools,toolchain}/install -j2
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
- save_cache:
key: cache-{{ checksum "/tmp/cache-target" }}
paths:
- openmptcprouter
- run:
name: Build
no_output_timeout: 40m
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
- run:
name: Deploy
command: |
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
- save_cache:
key: cache-{{ checksum "/tmp/cache-version" }}
paths:
- openmptcprouter
build_r2s:
machine:
image: ubuntu-1604:201903-01
environment:
- OMR_VERSION: $CIRCLE_TAG
- OMR_TARGET: r2s
- OMR_KERNEL: 5.4
working_directory: ~/
steps:
- run:
name: cache
command: |
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
- restore_cache:
keys:
- cache-{{ checksum "/tmp/cache-version" }}
- cache-{{ checksum "/tmp/cache-target" }}
- run:
name: Build toolchain
no_output_timeout: 40m
command: |
git clone https://github.com/ysurac/openmptcprouter || true
cd openmptcprouter
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
git pull || true
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
pyenv global 3.5.2
sh build.sh prepare {tools,toolchain}/install -j2
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
- save_cache:
key: cache-{{ checksum "/tmp/cache-target" }}
paths:
- openmptcprouter
- run:
name: Build
no_output_timeout: 40m
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
- run:
name: Deploy
command: |
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
- save_cache:
key: cache-{{ checksum "/tmp/cache-version" }}
paths:
- openmptcprouter
build_rpi4:
machine:
image: ubuntu-1604:201903-01
environment:
- OMR_VERSION: $CIRCLE_TAG
- OMR_TARGET: rpi4
- OMR_KERNEL: 5.4
working_directory: ~/
steps:
- run:
name: cache
command: |
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
- restore_cache:
keys:
- cache-{{ checksum "/tmp/cache-version" }}
- cache-{{ checksum "/tmp/cache-target" }}
- run:
name: Build toolchain
no_output_timeout: 40m
command: |
git clone https://github.com/ysurac/openmptcprouter || true
cd openmptcprouter
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
git pull || true
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
pyenv global 3.5.2
sh build.sh prepare {tools,toolchain}/install -j2
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
- save_cache:
key: cache-{{ checksum "/tmp/cache-target" }}
paths:
- openmptcprouter
- run:
name: Build
no_output_timeout: 40m
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
- run:
name: Deploy
command: |
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
- save_cache:
key: cache-{{ checksum "/tmp/cache-version" }}
paths:
- openmptcprouter
build_rpi2:
machine:
image: ubuntu-1604:201903-01
environment:
- OMR_VERSION: $CIRCLE_TAG
- OMR_TARGET: rpi2
- OMR_KERNEL: 5.4
working_directory: ~/
steps:
- run:
name: cache
command: |
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
- restore_cache:
keys:
- cache-{{ checksum "/tmp/cache-version" }}
- cache-{{ checksum "/tmp/cache-target" }}
- run:
name: Build toolchain
no_output_timeout: 40m
command: |
git clone https://github.com/ysurac/openmptcprouter || true
cd openmptcprouter
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
git pull || true
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
pyenv global 3.5.2
sh build.sh prepare {tools,toolchain}/install -j2
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
- save_cache:
key: cache-{{ checksum "/tmp/cache-target" }}
paths:
- openmptcprouter
- run:
name: Build
no_output_timeout: 40m
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile package/compile target/install -j2
- run:
name: Deploy
command: |
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
- save_cache:
key: cache-{{ checksum "/tmp/cache-version" }}
paths:
- openmptcprouter
build_bpi-r2:
machine:
image: ubuntu-1604:201903-01
environment:
- OMR_VERSION: $CIRCLE_TAG
- OMR_TARGET: bpi-r2
- OMR_KERNEL: 5.4
working_directory: ~/
steps:
- run:
name: cache
command: |
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
- restore_cache:
keys:
- cache-{{ checksum "/tmp/cache-version" }}
- cache-{{ checksum "/tmp/cache-target" }}
- run:
name: Build toolchain
no_output_timeout: 40m
command: |
git clone https://github.com/ysurac/openmptcprouter || true
cd openmptcprouter
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
git pull || true
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
pyenv global 3.5.2
sh build.sh prepare {tools,toolchain}/install -j2
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
- save_cache:
key: cache-{{ checksum "/tmp/cache-target" }}
paths:
- openmptcprouter
- run:
name: Build
no_output_timeout: 40m
command: |
sudo apt-get update
sudo apt-get -yq install swig2.0
make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
- run:
name: Deploy
command: |
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
- save_cache:
key: cache-{{ checksum "/tmp/cache-version" }}
paths:
- openmptcprouter
build_wrt3200acm:
machine:
image: ubuntu-1604:201903-01
environment:
- OMR_VERSION: $CIRCLE_TAG
- OMR_TARGET: wrt3200acm
- OMR_KERNEL: 5.4
working_directory: ~/
steps:
- run:
name: cache
command: |
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
- restore_cache:
keys:
- cache-{{ checksum "/tmp/cache-version" }}
- cache-{{ checksum "/tmp/cache-target" }}
- run:
name: Build toolchain
no_output_timeout: 40m
command: |
git clone https://github.com/ysurac/openmptcprouter || true
cd openmptcprouter
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
git pull || true
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
pyenv global 3.5.2
sh build.sh prepare {tools,toolchain}/install -j2
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/$OMR_TARGET/source/key-build.pub
- save_cache:
key: cache-{{ checksum "/tmp/cache-target" }}
paths:
- openmptcprouter
- run:
name: Build
no_output_timeout: 40m
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/$OMR_TARGET/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
- run:
name: Deploy
command: |
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rsync -av --delete-after ~/openmptcprouter/$OMR_TARGET/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rm -rf ~/openmptcprouter/$OMR_TARGET/source/bin
- save_cache:
key: cache-{{ checksum "/tmp/cache-version" }}
paths:
- openmptcprouter
build_wrt32:
machine:
image: ubuntu-1604:201903-01
environment:
- OMR_VERSION: $CIRCLE_TAG
- OMR_KERNEL: 5.4
working_directory: ~/
steps:
- run:
name: cache
command: |
echo "cache 107 $OMR_KERNEL $OMR_TARGET" > /tmp/cache-target
echo "cache 108 $OMR_KERNEL $OMR_TARGET $OMR_VERSION" > /tmp/cache-version
- restore_cache:
keys:
- cache-{{ checksum "/tmp/cache-version" }}
- cache-{{ checksum "/tmp/cache-target" }}
- run:
name: Build toolchain wrt3200acm
no_output_timeout: 40m
command: |
git clone https://github.com/ysurac/openmptcprouter || true
cd openmptcprouter
git checkout ${CIRCLE_BRANCH:-$CIRCLE_TAG} || true
git pull || true
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_TARGET="wrt3200acm"
pyenv global 3.5.2
sh build.sh prepare {tools,toolchain}/install -j2
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/wrt3200acm/source/key-build
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/wrt3200acm/source/key-build.pub
- save_cache:
key: cache-{{ checksum "/tmp/cache-target" }}
paths:
- openmptcprouter
- run:
name: Build wrt3200acm
no_output_timeout: 40m
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/wrt3200acm/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
- run:
name: Deploy wrt3200acm
command: |
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rsync -av --delete-after ~/openmptcprouter/wrt3200acm/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/wrt3200acm
rm -rf ~/openmptcprouter/wrt3200acm/source/bin
- save_cache:
key: cache-{{ checksum "/tmp/cache-version" }}
paths:
- openmptcprouter
- run:
name: Build toolchain wrt32x
no_output_timeout: 40m
command: |
cd ~/openmptcprouter/
export OMR_PATH="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_FEED_URL="$CIRCLE_REPOSITORY_URL"
export OMR_FEED_SRC="${CIRCLE_BRANCH:-$CIRCLE_TAG}"
export OMR_TARGET="wrt32x"
ln -s wrt3200acm wrt32x
pyenv global 3.5.2
sh build.sh prepare {tools,toolchain}/install -j2
echo -e "$OMR_PRIVKEY" > ~/openmptcprouter/wrt32x/source/key-build
echo -e "$OMR_PUBKEY" > ~/openmptcprouter/wrt32x/source/key-build.pub
- run:
name: Build wrt32x
no_output_timeout: 40m
command: make IGNORE_ERRORS=m -C ~/openmptcprouter/wrt32x/source package/{compile,install,index} target/compile -j2 package/compile -j2 target/install -j2
- run:
name: Deploy wrt32x
command: |
ssh -p ${OMR_DEPLOY_PORT:-22} deploy@$OMR_DEPLOY_HOST mkdir -p deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/$OMR_TARGET
rsync -av --delete-after ~/openmptcprouter/wrt32x/source/bin/ -e "ssh -q -p ${OMR_DEPLOY_PORT:-22}" deploy@$OMR_DEPLOY_HOST:deploy/${CIRCLE_BRANCH:-release}/${CIRCLE_TAG:-$OMR_KERNEL}/wrt32x
workflows:
version: 2
main:
jobs:
- prepare:
filters:
tags:
only: /.*/
branches:
only:
- develop
- build_x86_64:
requires:
- prepare
filters:
tags:
only: /.*/
branches:
only:
- develop
- build_x86:
requires:
- prepare
filters:
tags:
only: /.*/
branches:
only:
- develop
- build_rpi4:
requires:
- prepare
filters:
tags:
only: /.*/
branches:
only:
- develop
- build_rpi3:
requires:
- prepare
filters:
tags:
only: /.*/
branches:
only:
- develop
- build_espressobin:
requires:
- prepare
filters:
tags:
only: /.*/
branches:
only:
- develop
- build_r2s:
requires:
- prepare
filters:
tags:
only: /.*/
branches:
only:
- develop
- build_rpi2:
requires:
- prepare
filters:
tags:
only: /.*/
branches:
only:
- develop
- build_bpi-r2:
requires:
- prepare
filters:
tags:
only: /.*/
branches:
only:
- develop
- build_wrt32:
requires:
- prepare
filters:
tags:
only: /.*/
branches:
only:
- develop

View file

@ -1,8 +1,8 @@
name: Build OpenMPTCProuter
name: Build antrouter
on: [push]
env:
REPO_URL: 'https://github.com/ysurac/openmptcprouter'
REPO_URL: 'https://github.com/suyuan168/3grouter'
OMR_KERNEL: '5.4'
jobs:
@ -28,7 +28,7 @@ jobs:
- name: Clone source code
working-directory: ../../
env:
REPO_URL: https://github.com/ysurac/openmptcprouter
REPO_URL: https://github.com/suyuan168/3grouter
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
GITHUB_WORKSPACE: ${{ steps.branch_name.outputs.WORKSPACE }}
run: |
@ -44,7 +44,7 @@ jobs:
- name: Build toolchain
working-directory: ../../omr
env:
OMR_FEED_URL: https://github.com/ysurac/openmptcprouter-feeds
OMR_FEED_URL: https://github.com/suyuan168/openmptcprouter-feeds
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
OMR_TARGET: ${{ matrix.OMR_TARGET }}
run: |
@ -79,7 +79,7 @@ jobs:
command: |
mkdir -p deploy/release/${{env.SOURCE_TAG}}/${{matrix.OMR_TARGET}}
host: ${{ secrets.OMR_DEPLOY_HOST }}
user: deploy
user: root
port: ${{ secrets.OMR_DEPLOY_PORT }}
key: ${{ secrets.PRIVATE_KEY }}
- if: steps.branch_name.outputs.SOURCE_BRANCH != ''
@ -93,7 +93,7 @@ jobs:
command: |
mkdir -p deploy/${{env.SOURCE_BRANCH}}/${{env.OMR_KERNEL}}/${{matrix.OMR_TARGET}}
host: ${{ secrets.OMR_DEPLOY_HOST }}
user: deploy
user: root
port: ${{ secrets.OMR_DEPLOY_PORT }}
key: ${{ secrets.PRIVATE_KEY }}
- name: Move binaries for rsync
@ -108,10 +108,10 @@ jobs:
uses: up9cloud/action-rsync@master
env:
ARGS: -av --delete-after
TARGET: deploy/release/${{steps.branch_name.outputs.SOURCE_TAG}}/${{matrix.OMR_TARGET}}
TARGET: root/release/${{steps.branch_name.outputs.SOURCE_TAG}}/${{matrix.OMR_TARGET}}
SOURCE: ./bin/
KEY: ${{ secrets.PRIVATE_KEY }}
USER: deploy
user: root
HOST: ${{ secrets.OMR_DEPLOY_HOST }}
PORT: ${{ secrets.OMR_DEPLOY_PORT }}
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}
@ -123,10 +123,10 @@ jobs:
uses: up9cloud/action-rsync@master
env:
ARGS: -av --delete-after
TARGET: deploy/${{ steps.branch_name.outputs.SOURCE_BRANCH }}/${{env.OMR_KERNEL}}/${{matrix.OMR_TARGET}}
TARGET: root/${{ steps.branch_name.outputs.SOURCE_BRANCH }}/${{env.OMR_KERNEL}}/${{matrix.OMR_TARGET}}
SOURCE: ./bin/
KEY: ${{ secrets.PRIVATE_KEY }}
USER: deploy
user: root
HOST: ${{ secrets.OMR_DEPLOY_HOST }}
PORT: ${{ secrets.OMR_DEPLOY_PORT }}
SOURCE_NAME: ${{ steps.branch_name.outputs.SOURCE_NAME }}

14
luci-app-status/Makefile Normal file
View file

@ -0,0 +1,14 @@
#
# Copyright (C) 2020 Ycarus (Yannick Chabanois) <ycarus@zugaina.org>
#
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=Aggregation status
LUCI_DEPENDS:=+luci-lib-json +luci-app-openmptcprouter
PKG_LICENSE:=GPLv3
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View file

@ -0,0 +1,335 @@
.container {
/* container for entire page. fixes bootstrap theme's ridiculously small page width */
max-width: 1044px;
}
#interface_field {
padding: 12px 20px 20px 20px;
}
#mwan_status_text {
display: table;
font-size: 14px;
margin: auto;
max-width: 1044px;
min-width: 246px;
width: 100%;
}
.wanon {
background-color: #1cc82c;
}
.wanoff {
background-color: #e55712;
}
.wanon,
.wanoff {
border-radius: 60px;
box-shadow: 0px 2px 5px -3px;
float: left;
margin: 8px 3px 0px 3px;
min-height: 30px;
min-width: 235px;
padding: 5px 10px 8px 10px;
text-align: center;
}
/* Mwan3 ligthed CSS */
.container {
/* container for entire page. fixes bootstrap theme's ridiculously small page width */
max-width: 1044px;
}
#interface_field {
padding: 0px;
}
#interface_field td {
padding: 0px;
}
#interface_status_text {
display: table;
font-size: 14px;
margin: auto;
max-width: 1044px;
min-width: 246px;
width: 100%;
}
ul {
margin: 0px;
}
/*Now the CSS*/
.tree ul {
position: relative;
float: left;
transition: all 0.5s;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
}
.tree li {
float: left;
text-align: left;
list-style-type: none;
position: relative;
padding: 5px 0px 5px 85px;
transition: all 0.5s;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
}
.tree ul ul {
padding-left: 85px;
position: relative;
}
.tree > ul > li:first-child {
position: relative;
padding-left: 0px;
}
.tree > ul > li#first-child > a {
position: relative;
top: 50%;
}
/*We will use ::before and ::after to draw the connectors
Before: Bottom part of the element
After: Top part of the element
*/
.tree ul ul li::before,
.tree ul ul li::after {
content: '';
position: absolute;
top: 50%;
left: 0;
border-left: 2px solid black;
width: 85px;
height: 50%;
float: left;
/*z-index: -10;*/
/*
position: absolute;
top: 0;
right: 50%;
border-top: 2px solid black;
width: 50%;
height: 20px;
background-color: red;
*/
}
.tree ul ul li::after {
top: auto;
bottom: 50%;
border-left: 2px solid black;
border-bottom: 2px solid black;
}
.tree li:first-child {
position: relative;
top: 50%;
}
/*We need to remove first top and the last bottom border */
.tree li:only-child::after {
display: none;
}
/*Remove space from the top of single children*/
.tree li:only-child {
padding-top: 0;
}
/*Remove left connector from first child and
right connector from last child*/
.tree li:first-child::after,
.tree li:last-child::before {
border-left: 0px;
}
/*Adding back the vertical connector to the last nodes*/
/*
.tree li:last-child::before{
//border-top: 2px solid black;
border-radius: 0 5px 0 0;
-webkit-border-radius: 0 5px 0 0;
-moz-border-radius: 0 5px 0 0;
}
.tree li:first-child::after{
border-radius: 5px 0 0 0;
-webkit-border-radius: 5px 0 0 0;
-moz-border-radius: 5px 0 0 0;
}
*/
/*Time to add right connectors from parents*/
.tree ul ul::before {
content: '';
position: absolute;
top: 50%;
left: 0;
border-top: 2px solid black;
width: 85px;
height: 100%;
}
.tree li a {
display: inline-block;
background-color: #f3f3f3;
text-decoration: none;
/*
border: 1px solid @color-bg-gray;
padding: 5px 10px;
font-family: arial, verdana, tahoma;
font-size: 11px;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
transition: all 0.5s;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
*/
}
/*Exception*/
.tree li.remote-from-lease {
padding-bottom: 0px;
}
.tree li.remote-from-lease::before,
.tree li#networkRootNode::before {
display: none;
}
.tree li#networkRootNode::after {
border: none;
}
.tree li.remote-from-lease::after {
content: '';
position: absolute;
left: 50%;
top: 83px;
border-left: 2px solid black;
border-bottom: none;
width: 2px;
height: 30px;
z-index: -10;
}
.remote-from-lease a {
height: 90px;
}
.tree li#networkRootNode {
padding: 25px 0 0 0;
}
.tree li.subnode-only-child::before {
content: '';
position: absolute;
top: 50%;
left: 0;
border-top: 2px solid black;
width: 85px;
height: 0;
}
.tree ul li#networkRootNode:not(:first-child) tr.spaceline td {
content: '';
position: absolute;
/*top: 0;
top: 75px;*/
border-left: 2px solid black;
border-bottom: none;
width: 2px;
/*height: 50%;*/
height: 55px;
left: 200px;
/* z-index: -10;*/
}
/*Time for some hover effects*/
/*We will apply the hover effect the the lineage of the element also*/
/*
.tree li a:hover, .tree li a:hover+ul li a {
background: #c8e4f8; color: #000; border: 1px solid #94a0b4;
}
.tree li a:hover+ul li::after,
.tree li a:hover+ul li::before,
.tree li a:hover+ul::before,
.tree li a:hover+ul ul::before{
border-color: #94a0b4;
}
*/
/*Thats all. I hope you enjoyed it.
Thanks :)*/
.network-node {
position: relative;
background-color: #f3f3f3;
padding: 12px;
width: 400px;
max-width: 400px;
box-sizing: border-box;
height: 170px;
}
.network-node .equipment-icon {
position: relative;
float: left;
width: 64px;
max-width: 64px;
box-sizing: border-box;
}
.network-node .equipment-icon emded,
.network-node .equipment-icon img {
width: 64px;
max-width: 64px;
}
.network-node .equipment-icon img {
position: relative;
top: 10px;
}
.network-node .status-icon {
position: relative;
float: left;
width: 30px;
max-width: 30px;
margin-left: 24px;
margin-rigth: 8px;
top: 20px;
box-sizing: border-box;
}
.network-node .status-icon img {
max-width: 30px;
width: 30px;
}
.network-node .info {
position: relative;
float: right;
width: 250px;
text-align: left;
font-size: 12px;
color: #757575;
}
.network-node .info .title {
display: block;
font-size: 17px;
font-weight: 700;
color: #333333;
}
.network-node .info .title i {
font-weight: lighter;
font-size: 8em;
text-transform: uppercase;
}
.network-node .info .status-message {
display: block;
}
.network-node .info .status-message.error {
color: #e55712;
}
.network-node .info .status-message.warning {
color: #eb9e10;
}
.network-node .info .content {
display: block;
}
#networkRootNode table td {
border-top: 0px;
}
.vertdash {
width:5px;
border-right:2px dotted black;
height:70px;
padding-right: 195px;
}
#omr {
height: 190px;
}
#omr-vps {
height: 160px;
}
.space {
height: 55px;
}
.spaceline {
height: 55px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,313 @@
local math = require "math"
local sys = require "luci.sys"
local json = require("luci.json")
local fs = require("nixio.fs")
local net = require "luci.model.network".init()
local ucic = luci.model.uci.cursor()
local ipc = require "luci.ip"
module("luci.controller.status", package.seeall)
function index()
entry({"admin", "system", "status"}, alias("admin", "system", "status", "server"), _("Settings"), 1)
entry({"admin", "system", "status","server"}, template("status/server"),_('Settings'),1).leaf = true
entry({"admin", "system", "status","status"}, template("status/wanstatus"),_('Status'),2).leaf = true
entry({"admin", "system", "status","server_add"}, post("server_add"))
entry({"admin", "system", "status", "interfaces_status"}, call("interfaces_status")).leaf = true
entry({"admin", "system", "status", "multipath_bandwidth"}, call("multipath_bandwidth")).leaf = true
entry({"admin", "system", "status", "interface_bandwidth"}, call("interface_bandwidth")).leaf = true
end
function server_add()
local serversnb = 0
local servers = luci.http.formvaluetable("server")
for server, _ in pairs(servers) do
local server_ip = luci.http.formvalue("%s.server_ip" % server) or ""
local master = luci.http.formvalue("master") or ""
-- OpenMPTCProuter VPS
local openmptcprouter_vps_key = luci.http.formvalue("%s.openmptcprouter_vps_key" % server) or ""
local openmptcprouter_vps_username = luci.http.formvalue("%s.openmptcprouter_vps_username" % server) or ""
ucic:set("openmptcprouter",server,"server")
ucic:set("openmptcprouter",server,"username",openmptcprouter_vps_username)
ucic:set("openmptcprouter",server,"password",openmptcprouter_vps_key)
if master == server or (master == "" and serversnb == 0) then
ucic:set("openmptcprouter",server,"get_config","1")
ucic:set("openmptcprouter",server,"master","1")
ucic:set("openmptcprouter",server,"backup","0")
else
ucic:set("openmptcprouter",server,"get_config","0")
ucic:set("openmptcprouter",server,"master","0")
ucic:set("openmptcprouter",server,"backup","1")
end
if server_ip ~= "" then
serversnb = serversnb + 1
end
ucic:set("openmptcprouter",server,"disabled",openmptcprouter_vps_disabled)
ucic:set("openmptcprouter",server,"ip",server_ip)
ucic:set("openmptcprouter",server,"port","65500")
ucic:save("openmptcprouter")
end
local ss_servers_nginx = {}
local ss_servers_ha = {}
local vpn_servers = {}
local k = 0
local ss_ip
for server, _ in pairs(servers) do
local master = luci.http.formvalue("master") or ""
local server_ip = luci.http.formvalue("%s.server_ip" % server) or ""
-- We have an IP, so set it everywhere
if server_ip ~= "" and luci.http.formvalue("%s.openmptcprouter_vps_disabled" % server) ~= "1" then
-- Check if we have more than one IP, in this case use Nginx HA
if serversnb > 1 then
if master == server then
ss_ip=server_ip
ucic:set("shadowsocks-libev","sss0","server",server_ip)
ucic:set("glorytun","vpn","host",server_ip)
ucic:set("dsvpn","vpn","host",server_ip)
ucic:set("mlvpn","general","host",server_ip)
ucic:set("ubond","general","host",server_ip)
luci.sys.call("uci -q del openvpn.omr.remote")
luci.sys.call("uci -q add_list openvpn.omr.remote=" .. server_ip)
ucic:set("qos","serverin","srchost",server_ip)
ucic:set("qos","serverout","dsthost",server_ip)
end
k = k + 1
ucic:set("nginx-ha","ShadowSocks","enable","0")
ucic:set("nginx-ha","VPN","enable","0")
ucic:set("haproxy-tcp","general","enable","0")
ucic:set("openmptcprouter","settings","ha","1")
else
ucic:set("openmptcprouter","settings","ha","0")
ucic:set("nginx-ha","ShadowSocks","enable","0")
ucic:set("nginx-ha","VPN","enable","0")
ucic:set("shadowsocks-libev","sss0","server",server_ip)
ucic:set("glorytun","vpn","host",server_ip)
ucic:set("dsvpn","vpn","host",server_ip)
ucic:set("mlvpn","general","host",server_ip)
ucic:set("ubond","general","host",server_ip)
luci.sys.call("uci -q del openvpn.omr.remote")
luci.sys.call("uci -q add_list openvpn.omr.remote=" .. server_ip)
ucic:set("qos","serverin","srchost",server_ip)
ucic:set("qos","serverout","dsthost",server_ip)
end
end
end
ucic:save("qos")
ucic:commit("qos")
ucic:save("nginx-ha")
ucic:commit("nginx-ha")
ucic:save("openvpn")
ucic:commit("openvpn")
ucic:save("mlvpn")
ucic:save("ubond")
ucic:commit("mlvpn")
ucic:save("dsvpn")
ucic:commit("dsvpn")
ucic:save("glorytun")
ucic:commit("glorytun")
ucic:save("shadowsocks-libev")
ucic:commit("shadowsocks-libev")
luci.sys.call("(env -i /bin/ubus call network reload) >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/omr-tracker stop >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/mptcp restart >/dev/null 2>/dev/null")
if openmptcprouter_vps_key ~= "" then
luci.sys.call("/etc/init.d/openmptcprouter-vps restart >/dev/null 2>/dev/null")
os.execute("sleep 2")
end
luci.sys.call("/etc/init.d/shadowsocks-libev restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/glorytun restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/glorytun-udp restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/mlvpn restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/ubond restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/openvpn restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/dsvpn restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/omr-tracker start >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/omr-6in4 restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/mptcpovervpn restart >/dev/null 2>/dev/null")
luci.sys.call("/etc/init.d/vnstat restart >/dev/null 2>/dev/null")
luci.http.redirect(luci.dispatcher.build_url("admin/system/status/status"))
end
function interfaces_status()
local ut = require "luci.util"
local mArray = ut.ubus("openmptcprouter", "status", {}) or {_=0}
if mArray ~= nil and mArray.openmptcprouter ~= nil then
mArray.openmptcprouter["remote_addr"] = luci.http.getenv("REMOTE_ADDR") or ""
mArray.openmptcprouter["remote_from_lease"] = false
-- local leases=dhcp_leases_common(4)
-- for _, value in pairs(leases) do
-- if value["ipaddr"] == mArray.openmptcprouter["remote_addr"] then
-- mArray.openmptcprouter["remote_from_lease"] = true
-- mArray.openmptcprouter["remote_hostname"] = value["hostname"]
-- end
-- end
end
luci.http.prepare_content("application/json")
luci.http.write_json(mArray)
end
-- This function come from modules/luci-bbase/luasrc/tools/status.lua from old OpenWrt
-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
local function dhcp_leases_common(family)
local rv = { }
local nfs = require "nixio.fs"
local sys = require "luci.sys"
local leasefile = "/tmp/dhcp.leases"
ucic:foreach("dhcp", "dnsmasq",
function(s)
if s.leasefile and nfs.access(s.leasefile) then
leasefile = s.leasefile
return false
end
end)
local fd = io.open(leasefile, "r")
if fd then
while true do
local ln = fd:read("*l")
if not ln then
break
else
local ts, mac, ip, name, duid = ln:match("^(%d+) (%S+) (%S+) (%S+) (%S+)")
local expire = tonumber(ts) or 0
if ts and mac and ip and name and duid then
if family == 4 and not ip:match(":") then
rv[#rv+1] = {
expires = (expire ~= 0) and os.difftime(expire, os.time()),
macaddr = ipc.checkmac(mac) or "00:00:00:00:00:00",
ipaddr = ip,
hostname = (name ~= "*") and name
}
elseif family == 6 and ip:match(":") then
rv[#rv+1] = {
expires = (expire ~= 0) and os.difftime(expire, os.time()),
ip6addr = ip,
duid = (duid ~= "*") and duid,
hostname = (name ~= "*") and name
}
end
end
end
end
fd:close()
end
local lease6file = "/tmp/hosts/odhcpd"
ucic:foreach("dhcp", "odhcpd",
function(t)
if t.leasefile and nfs.access(t.leasefile) then
lease6file = t.leasefile
return false
end
end)
local fd = io.open(lease6file, "r")
if fd then
while true do
local ln = fd:read("*l")
if not ln then
break
else
local iface, duid, iaid, name, ts, id, length, ip = ln:match("^# (%S+) (%S+) (%S+) (%S+) (-?%d+) (%S+) (%S+) (.*)")
local expire = tonumber(ts) or 0
if ip and iaid ~= "ipv4" and family == 6 then
rv[#rv+1] = {
expires = (expire >= 0) and os.difftime(expire, os.time()),
duid = duid,
ip6addr = ip,
hostname = (name ~= "-") and name
}
elseif ip and iaid == "ipv4" and family == 4 then
rv[#rv+1] = {
expires = (expire >= 0) and os.difftime(expire, os.time()),
macaddr = sys.net.duid_to_mac(duid) or "00:00:00:00:00:00",
ipaddr = ip,
hostname = (name ~= "-") and name
}
end
end
end
fd:close()
end
if family == 6 then
local _, lease
local hosts = sys.net.host_hints()
for _, lease in ipairs(rv) do
local mac = sys.net.duid_to_mac(lease.duid)
local host = mac and hosts[mac]
if host then
if not lease.name then
lease.host_hint = host.name or host.ipv4 or host.ipv6
elseif host.name and lease.hostname ~= host.name then
lease.host_hint = host.name
end
end
end
end
return rv
end
function interface_bandwidth(iface)
luci.http.prepare_content("application/json")
local bwc = io.popen("luci-bwc -i %q 2>/dev/null" % iface)
if bwc then
luci.http.write("[")
while true do
local ln = bwc:read("*l")
if not ln then break end
luci.http.write(ln)
end
luci.http.write("]")
bwc:close()
end
end
function multipath_bandwidth()
local result = { };
local uci = luci.model.uci.cursor()
uci:foreach("network", "interface", function(s)
local intname = s[".name"]
local dev = get_device(intname)
if dev == "" then
dev = get_device(s["ifname"])
end
local multipath = s["multipath"] or ""
if dev ~= "lo" and dev ~= "" then
if multipath == "" then
multipath = uci:get("openmptcprouter", intname, "multipath") or ""
end
if multipath == "" then
multipath = "off"
end
if multipath == "on" or multipath == "master" or multipath == "backup" or multipath == "handover" then
local bwc = luci.sys.exec("luci-bwc -i %q 2>/dev/null" % dev) or ""
if bwc ~= nil then
--result[dev] = "[" .. string.gsub(bwc, '[\r\n]', '') .. "]"
result[intname] = "[" .. string.gsub(bwc, '[\r\n]', '') .. "]"
else
result[dev] = "[]"
end
end
end
end)
luci.http.prepare_content("application/json")
luci.http.write_json(result)
end
function get_device(interface)
local dump = require("luci.util").ubus("network.interface.%s" % interface, "status", {})
if dump ~= nil then
return dump['l3_device']
else
return ""
end
end

View file

@ -0,0 +1,94 @@
<%+header%>
<%
local uci = require("luci.model.uci").cursor()
local net = require "luci.model.network".init()
local fs = require "nixio.fs"
local sys = require "luci.sys"
local ut = require "luci.util"
local ifaces = sys.net:devices()
local servers_ip = {}
local server_ip = uci:get("shadowsocks-libev","sss0","server")
if server_ip == '127.0.0.1' then
local upstreams = uci:get("nginx-ha","ShadowSocks","upstreams")
for _, up in pairs(upstreams) do
local a = up:match("^([^:]+):")
table.insert(servers_ip,a)
end
else
table.insert(servers_ip,server_ip)
end
%>
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-18.243.49640-2f13420" data-strings="{&#34;path&#34;:{&#34;resource&#34;:&#34;\/luci-static\/resources&#34;,&#34;browser&#34;:&#34;\/cgi-bin\/luci\/admin\/filebrowser&#34;}}"></script>
<script src="/luci-static/resources/xhr.js?v=git-18.324.48426-65adb4e"></script>
<script>
function jsshowadv() {
if(document.getElementById('showadv').checked){
document.getElementById('advancedsettings').style.display='inline';
} else {
document.getElementById('advancedsettings').style.display='none';
}
}
</script>
<% if stderr and #stderr > 0 then %><pre class="error"><%=pcdata(stderr)%></pre><% end %>
<form class="inline" method="post" action="<%=url('admin/system/status/server_add')%>" enctype="multipart/form-data">
<div class="cbi-map">
<h2 name="content"><%:Wizard%></h2>
<fieldset class="cbi-section" id="server">
<legend><%:Server settings%></legend>
<%
nbserver=0
uci:foreach("openmptcprouter","server", function(s)
nbserver=nbserver+1
end)
uci:foreach("openmptcprouter","server", function(s)
servername = s[".name"]
%>
<div class="cbi-section-remove right">
<input type="hidden" name="server.<%=servername%>" value="<%=servername%>" />
</div>
<h3><%=servername%></h3>
<div class="cbi-section-node" id="cbi-omr-wizard-<%=servername%>">
<div class="cbi-value">
<label class="cbi-value-title" for="server_ip"><%:Server IP%></label>
<div class="cbi-value-field">
<input name="<%=servername%>.server_ip" id="<%=servername%>.server_ip" placeholder="<%:Server IP%>" class="cbi-input-text" value="<%=uci:get("openmptcprouter",servername,"ip")%>" data-optional="false">
<div class="cbi-value-description">
<%:Server IP%>
</div>
</div>
</div>
<br />
<div class="cbi-value">
<label class="cbi-value-title"><%:Server username%></label>
<div class="cbi-value-field">
<input type="text" name="<%=servername%>.openmptcprouter_vps_username" placeholder="<%:Server username%>" class="cbi-input-text" value="<%=uci:get("openmptcprouter",servername,"username")%>" data-optional="false">
<br />
<div class="cbi-value-description">
<%:API username to retrieve personnalized settings from the server.%>
</div>
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:Server key%></label>
<div class="cbi-value-field">
<input type="text" name="<%=servername%>.openmptcprouter_vps_key" placeholder="<%:Server key%>" class="cbi-input-text" value="<%=uci:get("openmptcprouter",servername,"password")%>" data-optional="false">
<br />
<div class="cbi-value-description">
<%:Key to configure, retrieve others keys and settings from Server.%>
</div>
</div>
</div>
<%
end)
%>
</div>
</fieldset>
</div>
<div class="cbi-page-actions">
<input type="hidden" name="token" value="<%=token%>" />
<input class="cbi-button cbi-button-apply" type="submit" value="<%:Save & Apply%>" /> <input class="cbi-button cbi-button-reset" type="button" value="Reset" onclick="location.href='<%=url('admin/system/status/server')%>'" />
</div>
</form>
<script type="text/javascript">cbi_init();</script>
<%+footer%>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,152 @@
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
#: luci-app-status/luasrc/view/status/wanstatus.htm:1395
msgid "(%d minute window, %d second interval)"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:970
#: luci-app-status/luasrc/view/status/wanstatus.htm:971
msgid "(%d minutes window, %d seconds interval)"
msgstr ""
#: luci-app-status/luasrc/view/status/server.htm:68
msgid "API username to retrieve personnalized settings from the server."
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:1027
#: luci-app-status/luasrc/view/status/wanstatus.htm:1030
#: luci-app-status/luasrc/view/status/wanstatus.htm:1066
#: luci-app-status/luasrc/view/status/wanstatus.htm:1561
#: luci-app-status/luasrc/view/status/wanstatus.htm:1571
msgid "Average:"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:1023
#: luci-app-status/luasrc/view/status/wanstatus.htm:1026
#: luci-app-status/luasrc/view/status/wanstatus.htm:1062
msgid "Current:"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:1537
msgid "Download:"
msgstr ""
#: luci-app-status/root/usr/share/rpcd/acl.d/luci-app-status.json:3
msgid "Grant UCI access for luci-app-status"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:1558
msgid "Inbound:"
msgstr ""
#: luci-app-status/luasrc/view/status/server.htm:78
msgid "Key to configure, retrieve others keys and settings from Server."
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:823
#: luci-app-status/luasrc/view/status/wanstatus.htm:1306
msgid "MB/s"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:832
#: luci-app-status/luasrc/view/status/wanstatus.htm:1315
msgid "Mbit/s"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:1505
#: luci-app-status/luasrc/view/status/wanstatus.htm:1507
msgid "Network overview"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:1568
msgid "Outbound:"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:1031
#: luci-app-status/luasrc/view/status/wanstatus.htm:1034
#: luci-app-status/luasrc/view/status/wanstatus.htm:1070
#: luci-app-status/luasrc/view/status/wanstatus.htm:1564
#: luci-app-status/luasrc/view/status/wanstatus.htm:1574
msgid "Peak:"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:1524
msgid "Realtime Traffic"
msgstr ""
#: luci-app-status/luasrc/view/status/server.htm:90
msgid "Save & Apply"
msgstr ""
#: luci-app-status/luasrc/view/status/server.htm:53
#: luci-app-status/luasrc/view/status/server.htm:55
#: luci-app-status/luasrc/view/status/server.htm:57
msgid "Server IP"
msgstr ""
#: luci-app-status/luasrc/view/status/server.htm:73
#: luci-app-status/luasrc/view/status/server.htm:75
msgid "Server key"
msgstr ""
#: luci-app-status/luasrc/view/status/server.htm:38
msgid "Server settings"
msgstr ""
#: luci-app-status/luasrc/view/status/server.htm:63
#: luci-app-status/luasrc/view/status/server.htm:65
msgid "Server username"
msgstr ""
#: luci-app-status/luasrc/controller/status.lua:11
#: luci-app-status/luasrc/controller/status.lua:12
msgid "Settings"
msgstr ""
#: luci-app-status/luasrc/controller/status.lua:13
#: luci-app-status/root/usr/share/luci/menu.d/luci-app-status.json:3
msgid "Status"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:1543
msgid "Upload:"
msgstr ""
#: luci-app-status/luasrc/view/status/server.htm:36
msgid "Wizard"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:818
#: luci-app-status/luasrc/view/status/wanstatus.htm:1026
#: luci-app-status/luasrc/view/status/wanstatus.htm:1030
#: luci-app-status/luasrc/view/status/wanstatus.htm:1034
#: luci-app-status/luasrc/view/status/wanstatus.htm:1065
#: luci-app-status/luasrc/view/status/wanstatus.htm:1069
#: luci-app-status/luasrc/view/status/wanstatus.htm:1073
#: luci-app-status/luasrc/view/status/wanstatus.htm:1301
#: luci-app-status/luasrc/view/status/wanstatus.htm:1559
#: luci-app-status/luasrc/view/status/wanstatus.htm:1562
#: luci-app-status/luasrc/view/status/wanstatus.htm:1565
#: luci-app-status/luasrc/view/status/wanstatus.htm:1569
#: luci-app-status/luasrc/view/status/wanstatus.htm:1572
#: luci-app-status/luasrc/view/status/wanstatus.htm:1575
msgid "kB/s"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:827
#: luci-app-status/luasrc/view/status/wanstatus.htm:1026
#: luci-app-status/luasrc/view/status/wanstatus.htm:1030
#: luci-app-status/luasrc/view/status/wanstatus.htm:1034
#: luci-app-status/luasrc/view/status/wanstatus.htm:1065
#: luci-app-status/luasrc/view/status/wanstatus.htm:1069
#: luci-app-status/luasrc/view/status/wanstatus.htm:1073
#: luci-app-status/luasrc/view/status/wanstatus.htm:1310
#: luci-app-status/luasrc/view/status/wanstatus.htm:1559
#: luci-app-status/luasrc/view/status/wanstatus.htm:1562
#: luci-app-status/luasrc/view/status/wanstatus.htm:1565
#: luci-app-status/luasrc/view/status/wanstatus.htm:1569
#: luci-app-status/luasrc/view/status/wanstatus.htm:1572
#: luci-app-status/luasrc/view/status/wanstatus.htm:1575
msgid "kbit/s"
msgstr ""

View file

@ -0,0 +1,163 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.3.1\n"
"Last-Translator: \n"
"Plural-Forms: nplurals=1; plural=0;\n"
"Language: zh_CN\n"
#: luci-app-status/luasrc/view/status/wanstatus.htm:1395
msgid "(%d minute window, %d second interval)"
msgstr "最近%d分钟信息, 每%d秒刷新"
#: luci-app-status/luasrc/view/status/wanstatus.htm:970
#: luci-app-status/luasrc/view/status/wanstatus.htm:971
msgid "(%d minutes window, %d seconds interval)"
msgstr "最近%d分钟信息, 每%d秒刷新"
#: luci-app-status/luasrc/view/status/server.htm:68
msgid "API username to retrieve personnalized settings from the server."
msgstr "API用户名用于从服务器检索个性化设置."
#: luci-app-status/luasrc/view/status/wanstatus.htm:1027
#: luci-app-status/luasrc/view/status/wanstatus.htm:1030
#: luci-app-status/luasrc/view/status/wanstatus.htm:1066
#: luci-app-status/luasrc/view/status/wanstatus.htm:1561
#: luci-app-status/luasrc/view/status/wanstatus.htm:1571
msgid "Average:"
msgstr "平均:"
#: luci-app-status/luasrc/view/status/wanstatus.htm:1023
#: luci-app-status/luasrc/view/status/wanstatus.htm:1026
#: luci-app-status/luasrc/view/status/wanstatus.htm:1062
msgid "Current:"
msgstr "当前:"
#: luci-app-status/luasrc/view/status/wanstatus.htm:1537
msgid "Download:"
msgstr "下载:"
#: luci-app-status/root/usr/share/rpcd/acl.d/luci-app-status.json:3
msgid "Grant UCI access for luci-app-status"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:1558
msgid "Inbound:"
msgstr "入站:"
#: luci-app-status/luasrc/view/status/server.htm:78
msgid "Key to configure, retrieve others keys and settings from Server."
msgstr "用于配置的密钥,可从服务器检索其他密钥和设置."
#: luci-app-status/luasrc/view/status/wanstatus.htm:823
#: luci-app-status/luasrc/view/status/wanstatus.htm:1306
msgid "MB/s"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:832
#: luci-app-status/luasrc/view/status/wanstatus.htm:1315
msgid "Mbit/s"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:1505
#: luci-app-status/luasrc/view/status/wanstatus.htm:1507
msgid "Network overview"
msgstr "网络概述"
#: luci-app-status/luasrc/view/status/wanstatus.htm:1568
msgid "Outbound:"
msgstr "出站:"
#: luci-app-status/luasrc/view/status/wanstatus.htm:1031
#: luci-app-status/luasrc/view/status/wanstatus.htm:1034
#: luci-app-status/luasrc/view/status/wanstatus.htm:1070
#: luci-app-status/luasrc/view/status/wanstatus.htm:1564
#: luci-app-status/luasrc/view/status/wanstatus.htm:1574
msgid "Peak:"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:1524
msgid "Realtime Traffic"
msgstr "实时流量"
#: luci-app-status/luasrc/view/status/server.htm:90
msgid "Save & Apply"
msgstr "保存&应用"
#: luci-app-status/luasrc/view/status/server.htm:53
#: luci-app-status/luasrc/view/status/server.htm:55
#: luci-app-status/luasrc/view/status/server.htm:57
msgid "Server IP"
msgstr ""
#: luci-app-status/luasrc/view/status/server.htm:73
#: luci-app-status/luasrc/view/status/server.htm:75
msgid "Server key"
msgstr ""
#: luci-app-status/luasrc/view/status/server.htm:38
msgid "Server settings"
msgstr ""
#: luci-app-status/luasrc/view/status/server.htm:63
#: luci-app-status/luasrc/view/status/server.htm:65
msgid "Server username"
msgstr ""
#: luci-app-status/luasrc/controller/status.lua:11
#: luci-app-status/luasrc/controller/status.lua:12
msgid "Settings"
msgstr "设置"
#: luci-app-status/luasrc/controller/status.lua:13
#: luci-app-status/root/usr/share/luci/menu.d/luci-app-status.json:3
msgid "Status"
msgstr "状态"
#: luci-app-status/luasrc/view/status/wanstatus.htm:1543
msgid "Upload:"
msgstr "上传:"
#: luci-app-status/luasrc/view/status/server.htm:36
msgid "Wizard"
msgstr "蚂蚁聚合设置向导"
#: luci-app-status/luasrc/view/status/wanstatus.htm:818
#: luci-app-status/luasrc/view/status/wanstatus.htm:1026
#: luci-app-status/luasrc/view/status/wanstatus.htm:1030
#: luci-app-status/luasrc/view/status/wanstatus.htm:1034
#: luci-app-status/luasrc/view/status/wanstatus.htm:1065
#: luci-app-status/luasrc/view/status/wanstatus.htm:1069
#: luci-app-status/luasrc/view/status/wanstatus.htm:1073
#: luci-app-status/luasrc/view/status/wanstatus.htm:1301
#: luci-app-status/luasrc/view/status/wanstatus.htm:1559
#: luci-app-status/luasrc/view/status/wanstatus.htm:1562
#: luci-app-status/luasrc/view/status/wanstatus.htm:1565
#: luci-app-status/luasrc/view/status/wanstatus.htm:1569
#: luci-app-status/luasrc/view/status/wanstatus.htm:1572
#: luci-app-status/luasrc/view/status/wanstatus.htm:1575
msgid "kB/s"
msgstr ""
#: luci-app-status/luasrc/view/status/wanstatus.htm:827
#: luci-app-status/luasrc/view/status/wanstatus.htm:1026
#: luci-app-status/luasrc/view/status/wanstatus.htm:1030
#: luci-app-status/luasrc/view/status/wanstatus.htm:1034
#: luci-app-status/luasrc/view/status/wanstatus.htm:1065
#: luci-app-status/luasrc/view/status/wanstatus.htm:1069
#: luci-app-status/luasrc/view/status/wanstatus.htm:1073
#: luci-app-status/luasrc/view/status/wanstatus.htm:1310
#: luci-app-status/luasrc/view/status/wanstatus.htm:1559
#: luci-app-status/luasrc/view/status/wanstatus.htm:1562
#: luci-app-status/luasrc/view/status/wanstatus.htm:1565
#: luci-app-status/luasrc/view/status/wanstatus.htm:1569
#: luci-app-status/luasrc/view/status/wanstatus.htm:1572
#: luci-app-status/luasrc/view/status/wanstatus.htm:1575
msgid "kbit/s"
msgstr ""

View file

@ -0,0 +1,13 @@
{
"admin/system/status": {
"title": "Status",
"order": 1,
"action": {
"type": "template",
"path": "status/wanstatus"
},
"depends": {
"acl": [ "luci-app-status" ]
}
}
}

View file

@ -0,0 +1,14 @@
{
"luci-app-status": {
"description": "Grant UCI access for luci-app-status",
"read": {
"uci": [ "*" ],
"ubus": {
"openmptcprouter": [ "*" ]
}
},
"write": {
"uci": [ "*" ]
}
}
}