mirror of
https://github.com/remittor/zapret-openwrt.git
synced 2026-01-30 22:30:36 +03:00
Compare commits
3 Commits
v0.8.20260
...
v0.8.20260
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d747201f9b | ||
|
|
9ead0e1d30 | ||
|
|
b37b35db80 |
220
.github/workflows/build.yml
vendored
220
.github/workflows/build.yml
vendored
@@ -27,6 +27,7 @@ on:
|
|||||||
options:
|
options:
|
||||||
- true
|
- true
|
||||||
- false
|
- false
|
||||||
|
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- v[0-9]+*
|
- v[0-9]+*
|
||||||
@@ -36,17 +37,19 @@ env:
|
|||||||
FAKE_BUILD: ${{ github.event.inputs.fake_build == 'true' }}
|
FAKE_BUILD: ${{ github.event.inputs.fake_build == 'true' }}
|
||||||
MAX_SPEED: ${{ github.event.inputs.max_speed != 'false' }}
|
MAX_SPEED: ${{ github.event.inputs.max_speed != 'false' }}
|
||||||
TAG_SUFFIX: ${{ github.event.inputs.fake_build == 'true' && '-fake' || github.event.inputs.test_build == 'true' && '-test' || '' }}
|
TAG_SUFFIX: ${{ github.event.inputs.fake_build == 'true' && '-fake' || github.event.inputs.test_build == 'true' && '-test' || '' }}
|
||||||
|
REPO_NAME: zapret-openwrt
|
||||||
REPO_URL: https://github.com/remittor/zapret-openwrt
|
REPO_URL: https://github.com/remittor/zapret-openwrt
|
||||||
REPO_LNK: remittor/zapret-openwrt
|
REPO_LNK: remittor/zapret-openwrt
|
||||||
REPO_BRANCH: master
|
REPO_BRANCH: master
|
||||||
BUILD_ROOT: ${{ github.workspace }}/builder
|
PKGDIR: ${{ github.workspace }}/zapret-openwrt
|
||||||
|
SDKDIR: /builder
|
||||||
BUILD_DATE: unknown
|
BUILD_DATE: unknown
|
||||||
REPO_DATE: unknown
|
REPO_DATE: unknown
|
||||||
LUCI_ARCH: aarch64_cortex-a53
|
LUCI_ARCH: aarch64_cortex-a53
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
outputs:
|
outputs:
|
||||||
tag: ${{ steps.gh.outputs.tag }}
|
tag: ${{ steps.gh.outputs.tag }}
|
||||||
date: ${{ steps.gh.outputs.date }}
|
date: ${{ steps.gh.outputs.date }}
|
||||||
@@ -103,14 +106,29 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
echo "is_active=$is_active" >> $GITHUB_OUTPUT
|
echo "is_active=$is_active" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
var:
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
outputs:
|
||||||
|
IPK_BRANCH: ${{ steps.set.outputs.IPK_BRANCH }}
|
||||||
|
APK_BRANCH: ${{ steps.set.outputs.APK_BRANCH }}
|
||||||
|
XXX_BRANCH: ${{ steps.set.outputs.XXX_BRANCH }}
|
||||||
|
steps:
|
||||||
|
- id: set
|
||||||
|
run: |
|
||||||
|
echo "IPK_BRANCH=v24.10.5" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "APK_BRANCH=v25.12.0-rc2" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "XXX_BRANCH=SNAPSHOT" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
needs: check
|
needs: [ check, var ]
|
||||||
#if: needs.check.outputs.is_active == 'true'
|
#if: needs.check.outputs.is_active == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
branch: [ openwrt-24.10, SNAPSHOT ]
|
branch:
|
||||||
|
- ${{ needs.var.outputs.IPK_BRANCH }}
|
||||||
|
- ${{ needs.var.outputs.APK_BRANCH }}
|
||||||
arch:
|
arch:
|
||||||
- aarch64_cortex-a53
|
- aarch64_cortex-a53
|
||||||
- aarch64_cortex-a72
|
- aarch64_cortex-a72
|
||||||
@@ -141,33 +159,63 @@ jobs:
|
|||||||
isTestOrFake:
|
isTestOrFake:
|
||||||
- ${{ needs.check.outputs.test_build == 'true' || needs.check.outputs.fake_build == 'true' }}
|
- ${{ needs.check.outputs.test_build == 'true' || needs.check.outputs.fake_build == 'true' }}
|
||||||
exclude:
|
exclude:
|
||||||
- branch: SNAPSHOT
|
- branch: ${{ needs.var.outputs.APK_BRANCH }}
|
||||||
arch: arm_cortex-a9_vfpv3-d16
|
arch: arm_cortex-a9_vfpv3-d16
|
||||||
|
- branch: ${{ needs.var.outputs.APK_BRANCH }}
|
||||||
|
arch: mips_4kec
|
||||||
- { isTestOrFake: true }
|
- { isTestOrFake: true }
|
||||||
include:
|
include:
|
||||||
- branch: openwrt-24.10
|
- branch: ${{ needs.var.outputs.IPK_BRANCH }}
|
||||||
arch: x86_64
|
arch: x86_64
|
||||||
- branch: openwrt-24.10
|
- branch: ${{ needs.var.outputs.IPK_BRANCH }}
|
||||||
arch: aarch64_cortex-a53
|
arch: aarch64_cortex-a53
|
||||||
- branch: SNAPSHOT
|
- branch: ${{ needs.var.outputs.APK_BRANCH }}
|
||||||
arch: aarch64_cortex-a53
|
arch: aarch64_cortex-a53
|
||||||
container:
|
container:
|
||||||
image: openwrt/sdk:${{ matrix.arch }}-${{ matrix.branch }}
|
image: ghcr.io/openwrt/sdk:${{ matrix.arch }}-${{ matrix.branch }}
|
||||||
options: --user root
|
options: --user root
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
pkgver: ${{ steps.build.outputs.pkgver }}
|
pkgver: ${{ steps.prepare.outputs.pkgver }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: ${{ env.REPO_LNK }}
|
repository: ${{ env.REPO_LNK }}
|
||||||
path: zapret-openwrt
|
path: ${{ env.REPO_NAME }}
|
||||||
|
|
||||||
|
- name: Fix SDK paths
|
||||||
|
run: |
|
||||||
|
mkdir -p $SDKDIR/shared-workdir
|
||||||
|
rm -rf $SDKDIR/shared-workdir/build
|
||||||
|
ln -sf $SDKDIR $SDKDIR/shared-workdir/build
|
||||||
|
|
||||||
|
- name: Initialization environment
|
||||||
|
working-directory: ${{ env.SDKDIR }}
|
||||||
|
env:
|
||||||
|
DEBIAN_FRONTEND: noninteractive
|
||||||
|
ARCH_TAG: ${{ matrix.arch }}
|
||||||
|
BRANCH: ${{ matrix.branch }}
|
||||||
|
FAKE_BUILD: ${{ env.FAKE_BUILD == 'true' || ( env.TEST_BUILD == 'true' && matrix.branch == needs.var.outputs.APK_BRANCH ) }}
|
||||||
|
run: |
|
||||||
|
if [ "$BRANCH" = "${{ needs.var.outputs.IPK_BRANCH }}" ]; then
|
||||||
|
echo "PKGTYPE=ipk" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "PKGTYPE=apk" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
mkdir -p ./logs
|
||||||
|
#echo ============== $SDKDIR ======================
|
||||||
|
#ls -la $SDKDIR
|
||||||
|
#echo ----------------------------------------------
|
||||||
|
echo "FAKE_BUILD=$FAKE_BUILD" >> $GITHUB_ENV
|
||||||
|
echo "ARCH_TAG=$ARCH_TAG" >> $GITHUB_ENV
|
||||||
|
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
|
||||||
|
echo "TZ=UTC" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Setup OpenWrt SDK
|
- name: Setup OpenWrt SDK
|
||||||
working-directory: /builder
|
if: false
|
||||||
env:
|
working-directory: ${{ env.SDKDIR }}
|
||||||
BRANCH: ${{ matrix.branch }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
# gpg --verbose --recv-keys 0x1D53D1877742E911
|
# gpg --verbose --recv-keys 0x1D53D1877742E911
|
||||||
# gpg --verbose --import <(wget -qO- 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/0x1D53D1877742E911.asc')
|
# gpg --verbose --import <(wget -qO- 'https://git.openwrt.org/?p=keyring.git;a=blob_plain;f=gpg/0x1D53D1877742E911.asc')
|
||||||
@@ -178,120 +226,120 @@ jobs:
|
|||||||
sed -r -i 's/^rm.+//' setup.sh
|
sed -r -i 's/^rm.+//' setup.sh
|
||||||
./setup.sh
|
./setup.sh
|
||||||
ls -lh
|
ls -lh
|
||||||
if [ "$BRANCH" = "openwrt-24.10" ]; then
|
|
||||||
echo "PKGTYPE=ipk" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "PKGTYPE=apk" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Setup ccache
|
- name: Setup ccache
|
||||||
|
if: false
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: '/builder/.ccache'
|
path: ${{ env.SDKDIR }}/.ccache
|
||||||
key: ccache-${{ matrix.arch }}-${{ matrix.branch }}-${{ github.run_id }}
|
key: ccache-${{ matrix.arch }}-${{ matrix.branch }}-${{ github.run_id }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
ccache-${{ matrix.arch }}-${{ matrix.branch }}-
|
ccache-${{ matrix.arch }}-${{ matrix.branch }}-
|
||||||
|
|
||||||
- name: Init packages
|
- name: Prepare packages
|
||||||
id: init
|
id: prepare
|
||||||
working-directory: '/builder'
|
working-directory: ${{ env.SDKDIR }}
|
||||||
env:
|
|
||||||
FAKE_BUILD: ${{ env.FAKE_BUILD == 'true' || ( env.TEST_BUILD == 'true' && matrix.branch == 'SNAPSHOT' ) }}
|
|
||||||
BUILD_DATE: ${{ needs.check.outputs.build_date }}
|
|
||||||
ARCH: ${{ matrix.arch }}
|
|
||||||
BRANCH: ${{ matrix.branch }}
|
|
||||||
SIGN_KEY: ${{ secrets.SIGN_PRIVATE_KEY }}
|
|
||||||
CCACHE_DIR: '/builder/.ccache'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
PKGDIR=$GITHUB_WORKSPACE/zapret-openwrt
|
MKFN=$( ls -1 $PKGDIR/luci-app-zapret*/Makefile )
|
||||||
MKFN=$PKGDIR/luci-app-zapret2/Makefile
|
|
||||||
PKGVER=$( grep -s '^PKG_VERSION:=.*' $MKFN | cut -d'=' -f2 )
|
PKGVER=$( grep -s '^PKG_VERSION:=.*' $MKFN | cut -d'=' -f2 )
|
||||||
PKGREL=$( grep -s '^PKG_RELEASE:=.*' $MKFN | cut -d'=' -f2 )
|
PKGREL=$( grep -s '^PKG_RELEASE:=.*' $MKFN | cut -d'=' -f2 )
|
||||||
[ "$PKGREL" != "1" ] && PKGVER=$PKGVER-r$PKGREL
|
[ "$PKGREL" != "1" ] && PKGVER=$PKGVER-r$PKGREL
|
||||||
echo "PKG_VERSION = $PKGVER"
|
echo "PKG_VERSION = $PKGVER"
|
||||||
cp -vr $PKGDIR ./package/zapret-openwrt/
|
cp -vr $PKGDIR ./package/$REPO_NAME/
|
||||||
|
|
||||||
mv feeds.conf.default feeds.conf
|
|
||||||
sed -i -e 's|base.*\.git|base https://github.com/openwrt/openwrt.git|' feeds.conf
|
|
||||||
sed -i -e 's|packages.*\.git|packages https://github.com/openwrt/packages.git|' feeds.conf
|
|
||||||
sed -i -e 's|luci.*\.git|luci https://github.com/openwrt/luci.git|' feeds.conf
|
|
||||||
mkdir -p ./logs
|
|
||||||
|
|
||||||
if [ "$FAKE_BUILD" = "false" ]; then
|
|
||||||
./scripts/feeds update base packages luci
|
|
||||||
./scripts/feeds install -a
|
|
||||||
fi
|
|
||||||
echo "FAKE_BUILD=$FAKE_BUILD" >> $GITHUB_ENV
|
|
||||||
echo "PKGVER=$PKGVER" >> $GITHUB_ENV
|
echo "PKGVER=$PKGVER" >> $GITHUB_ENV
|
||||||
echo "pkgver=$PKGVER" >> $GITHUB_OUTPUT
|
echo "pkgver=$PKGVER" >> $GITHUB_OUTPUT
|
||||||
echo "status=success" >> $GITHUB_OUTPUT
|
echo "status=success" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Build packages
|
- name: Init packages
|
||||||
id: build
|
id: init
|
||||||
if: steps.init.outputs.status == 'success'
|
if: steps.prepare.outputs.status == 'success'
|
||||||
working-directory: '/builder'
|
working-directory: ${{ env.SDKDIR }}
|
||||||
env:
|
|
||||||
BUILD_DATE: ${{ needs.check.outputs.build_date }}
|
|
||||||
ARCH: ${{ matrix.arch }}
|
|
||||||
BRANCH: ${{ matrix.branch }}
|
|
||||||
SIGN_KEY: ${{ secrets.SIGN_PRIVATE_KEY }}
|
|
||||||
CCACHE_DIR: '/builder/.ccache'
|
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
MAKE_JOBS=$(($(nproc)+1))
|
mv feeds.conf.default feeds.conf
|
||||||
echo "$MAKE_JOBS thread compile"
|
sed -i -e 's|base.*\.git|base https://github.com/openwrt/openwrt.git|' feeds.conf
|
||||||
|
sed -i -e 's|packages.*\.git|packages https://github.com/openwrt/packages.git|' feeds.conf
|
||||||
|
sed -i -e 's|luci.*\.git|luci https://github.com/openwrt/luci.git|' feeds.conf
|
||||||
|
./scripts/feeds update base packages luci
|
||||||
|
./scripts/feeds install -a
|
||||||
|
echo "status=success" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
if [ "$FAKE_BUILD" = "false" ]; then
|
- name: Init config
|
||||||
|
id: config
|
||||||
|
if: steps.init.outputs.status == 'success'
|
||||||
|
working-directory: ${{ env.SDKDIR }}
|
||||||
|
run: |
|
||||||
make defconfig
|
make defconfig
|
||||||
sed -i 's/CONFIG_LUCI_JSMIN=y/CONFIG_LUCI_JSMIN=n/g' .config
|
sed -i 's/CONFIG_LUCI_JSMIN=y/CONFIG_LUCI_JSMIN=n/g' .config
|
||||||
echo "------------- .config BEG -------------------"
|
echo "status=success" >> $GITHUB_OUTPUT
|
||||||
cat .config
|
|
||||||
echo "------------- .config END -------------------"
|
- name: Show config
|
||||||
if [ "$ARCH" = "$LUCI_ARCH" ]; then
|
working-directory: ${{ env.SDKDIR }}
|
||||||
PKGLIST=`echo package/zapret-openwrt/{zapret2,luci-app-zapret2}/compile`
|
run: |
|
||||||
else
|
cat .config || echo "File .config not found"
|
||||||
PKGLIST=`echo package/zapret-openwrt/zapret2/compile`
|
|
||||||
|
- name: Build packages
|
||||||
|
id: build
|
||||||
|
if: steps.config.outputs.status == 'success' && env.FAKE_BUILD != 'true'
|
||||||
|
working-directory: ${{ env.SDKDIR }}
|
||||||
|
env:
|
||||||
|
ARCH_TAG: ${{ matrix.arch }}
|
||||||
|
run: |
|
||||||
|
PKGLIST="package/zapret-openwrt/zapret2/compile"
|
||||||
|
if [ "$ARCH_TAG" = "$LUCI_ARCH" ]; then
|
||||||
|
PKGLIST="$PKGLIST package/zapret-openwrt/luci-app-zapret2/compile"
|
||||||
fi
|
fi
|
||||||
if [ "$MAX_SPEED" = "false" ]; then
|
MAKE_JOBS=$(nproc)
|
||||||
make $PKGLIST V=s CONFIG_CCACHE=1 BUILD_LOG=1
|
echo "$MAKE_JOBS thread compile"
|
||||||
|
if [ "$MAX_SPEED" != "true" ]; then
|
||||||
|
make $PKGLIST V=sc BUILD_LOG=1
|
||||||
else
|
else
|
||||||
make -j$MAKE_JOBS $PKGLIST CONFIG_CCACHE=1
|
make $PKGLIST -j$MAKE_JOBS
|
||||||
fi
|
fi
|
||||||
else
|
echo "status=success" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Build packages (FAKE)
|
||||||
|
id: build_fake
|
||||||
|
if: env.FAKE_BUILD == 'true'
|
||||||
|
working-directory: ${{ env.SDKDIR }}
|
||||||
|
env:
|
||||||
|
ARCH_TAG: ${{ matrix.arch }}
|
||||||
|
run: |
|
||||||
OUT_DIR=./bin/packages/dev_x/base
|
OUT_DIR=./bin/packages/dev_x/base
|
||||||
mkdir -p $OUT_DIR
|
mkdir -p $OUT_DIR
|
||||||
touch $OUT_DIR/zapret2_$PKGVER-$ARCH.$PKGTYPE
|
touch $OUT_DIR/zapret2_$PKGVER-$ARCH_TAG.$PKGTYPE
|
||||||
touch $OUT_DIR/luci-app-zapret2_$PKGVER-all.$PKGTYPE
|
touch $OUT_DIR/luci-app-zapret2_$PKGVER-all.$PKGTYPE
|
||||||
fi
|
echo "status=success" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Install packages
|
||||||
|
id: install
|
||||||
|
if: steps.build.outputs.status == 'success' || steps.build_fake.outputs.status == 'success'
|
||||||
|
working-directory: ${{ env.SDKDIR }}
|
||||||
|
env:
|
||||||
|
ARCH_TAG: ${{ matrix.arch }}
|
||||||
|
SIGN_KEY: ${{ secrets.SIGN_PRIVATE_KEY }}
|
||||||
|
run: |
|
||||||
find ./bin/packages/*/base -type f ! -regex ".*\(zapret2\).*\.[ai]pk$" -delete
|
find ./bin/packages/*/base -type f ! -regex ".*\(zapret2\).*\.[ai]pk$" -delete
|
||||||
|
|
||||||
#echo ">>>>>>> build a repository index to make the output directory usable as local OPKG source"
|
#echo ">>>>>>> build a repository index to make the output directory usable as local OPKG source"
|
||||||
#ln -s `which usign` staging_dir/host/bin/usign
|
#ln -s `which usign` staging_dir/host/bin/usign
|
||||||
#echo "$SIGN_KEY" | base64 -d > key-build
|
#echo "$SIGN_KEY" | base64 -d > key-build
|
||||||
#make package/index
|
#make package/index
|
||||||
|
OUTDIR=$GITHUB_WORKSPACE/$PKGTYPE-$ARCH_TAG
|
||||||
OUTDIR=$GITHUB_WORKSPACE/$PKGTYPE-$ARCH
|
|
||||||
mkdir -p $OUTDIR
|
mkdir -p $OUTDIR
|
||||||
cp -R ./bin/packages/*/base/. $OUTDIR/
|
cp -R ./bin/packages/*/base/. $OUTDIR/
|
||||||
./staging_dir/host/bin/ccache --max-size=10M --show-stats
|
|
||||||
|
|
||||||
echo "OUTDIR=$OUTDIR" >> $GITHUB_ENV
|
echo "OUTDIR=$OUTDIR" >> $GITHUB_ENV
|
||||||
echo "pkgver=$PKGVER" >> $GITHUB_OUTPUT
|
|
||||||
echo "status=success" >> $GITHUB_OUTPUT
|
echo "status=success" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Compress build logs
|
- name: Compress build logs
|
||||||
if: always()
|
if: always()
|
||||||
env:
|
env:
|
||||||
ARCH: ${{ matrix.arch }}
|
ARCH_TAG: ${{ matrix.arch }}
|
||||||
BRANCH: ${{ matrix.branch }}
|
BRANCH: ${{ matrix.branch }}
|
||||||
LOGS_DIR: '/builder/logs'
|
LOGS_DIR: ${{ env.SDKDIR }}/logs
|
||||||
run: |
|
run: |
|
||||||
tar -cJvf logs-$BRANCH-$ARCH.tar.xz $LOGS_DIR
|
tar -cJvf logs-$BRANCH-$ARCH_TAG.tar.xz $LOGS_DIR
|
||||||
|
|
||||||
- name: Upload packages
|
- name: Upload packages
|
||||||
if: steps.build.outcome == 'success'
|
if: steps.install.outcome == 'success'
|
||||||
uses: actions/upload-artifact@main
|
uses: actions/upload-artifact@main
|
||||||
with:
|
with:
|
||||||
path: ${{ env.OUTDIR }}
|
path: ${{ env.OUTDIR }}
|
||||||
@@ -309,7 +357,7 @@ jobs:
|
|||||||
needs: [ check, build ]
|
needs: [ check, build ]
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-zapret2
|
PKG_NAME:=luci-app-zapret2
|
||||||
PKG_VERSION:=0.8.20260107
|
PKG_VERSION:=0.8.20260109
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
PKG_LICENSE:=MIT
|
PKG_LICENSE:=MIT
|
||||||
PKG_MAINTAINER:=remittor <https://github.com/remittor>
|
PKG_MAINTAINER:=remittor <https://github.com/remittor>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=zapret2
|
PKG_NAME:=zapret2
|
||||||
PKG_VERSION:=0.8.20260107
|
PKG_VERSION:=0.8.20260109
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_MAINTAINER:=bol-van
|
PKG_MAINTAINER:=bol-van
|
||||||
@@ -14,8 +14,8 @@ PKG_LICENSE_FILES:=docs/LICENSE.txt
|
|||||||
|
|
||||||
PKG_SOURCE_URL:=https://github.com/bol-van/zapret2.git
|
PKG_SOURCE_URL:=https://github.com/bol-van/zapret2.git
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_VERSION:=790a2ca3557f902915531aad0ee90fb6996009e2
|
PKG_SOURCE_VERSION:=8e6387a6dfdaa227b50a34f4beb1d5ec2a770d54
|
||||||
PKG_SOURCE_DATE:=2026-01-07
|
PKG_SOURCE_DATE:=2026-01-09
|
||||||
|
|
||||||
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret2/archive/refs/tags/v$(PKG_VERSION).tar.gz?
|
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret2/archive/refs/tags/v$(PKG_VERSION).tar.gz?
|
||||||
|
|||||||
@@ -3,10 +3,6 @@
|
|||||||
|
|
||||||
EXE_DIR=$(cd "$(dirname "$0")" 2>/dev/null || exit 1; pwd)
|
EXE_DIR=$(cd "$(dirname "$0")" 2>/dev/null || exit 1; pwd)
|
||||||
|
|
||||||
. $EXE_DIR/comfunc.sh
|
|
||||||
. /usr/share/libubox/jshn.sh
|
|
||||||
. /etc/openwrt_release
|
|
||||||
|
|
||||||
opt_check=
|
opt_check=
|
||||||
opt_prerelease=
|
opt_prerelease=
|
||||||
opt_update=
|
opt_update=
|
||||||
@@ -16,13 +12,33 @@ opt_test=
|
|||||||
while getopts "cu:pft:" opt; do
|
while getopts "cu:pft:" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
c) opt_check=true;;
|
c) opt_check=true;;
|
||||||
p) opt_prerelease=true;;
|
p) opt_prerelease="true";;
|
||||||
u) opt_update="$OPTARG";;
|
u) opt_update="$OPTARG";;
|
||||||
f) opt_forced=true;;
|
f) opt_forced="true";;
|
||||||
t) opt_test="$OPTARG";;
|
t) opt_test="$OPTARG";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$EXE_DIR" = "/tmp" ]; then
|
||||||
|
ZAPRET_CFG_NAME="zapret"
|
||||||
|
if [ "$opt_update" = "1" ]; then
|
||||||
|
ZAPRET_CFG_NAME="zapret"
|
||||||
|
opt_update="@"
|
||||||
|
opt_forced="true"
|
||||||
|
fi
|
||||||
|
if [ "$opt_update" = "2" ]; then
|
||||||
|
ZAPRET_CFG_NAME="zapret2"
|
||||||
|
opt_update="@"
|
||||||
|
opt_forced="true"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
[ -f "$EXE_DIR/comfunc.sh" ] || { echo "ERROR: file $EXE_DIR/comfunc.sh not founded!"; exit 1; }
|
||||||
|
. $EXE_DIR/comfunc.sh
|
||||||
|
fi
|
||||||
|
|
||||||
|
. /usr/share/libubox/jshn.sh
|
||||||
|
. /etc/openwrt_release
|
||||||
|
|
||||||
ZAP_PKG_DIR=/tmp/$ZAPRET_CFG_NAME-pkg
|
ZAP_PKG_DIR=/tmp/$ZAPRET_CFG_NAME-pkg
|
||||||
|
|
||||||
if [ "$opt_test" != "" ]; then
|
if [ "$opt_test" != "" ]; then
|
||||||
@@ -35,7 +51,7 @@ if [ "$opt_test" != "" ]; then
|
|||||||
return "$opt_test"
|
return "$opt_test"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ZAP_CPU_ARCH=$(get_cpu_arch)
|
ZAP_CPU_ARCH="$DISTRIB_ARCH"
|
||||||
|
|
||||||
if [ $ZAPRET_CFG_NAME = "zapret" ]; then
|
if [ $ZAPRET_CFG_NAME = "zapret" ]; then
|
||||||
ZAP_REL_URL="https://raw.githubusercontent.com/remittor/zapret-openwrt/gh-pages/releases/releases_zap1_$ZAP_CPU_ARCH.json"
|
ZAP_REL_URL="https://raw.githubusercontent.com/remittor/zapret-openwrt/gh-pages/releases/releases_zap1_$ZAP_CPU_ARCH.json"
|
||||||
@@ -69,11 +85,73 @@ fi
|
|||||||
|
|
||||||
# -------------------------------------------------------------------------------------------------------
|
# -------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function download_json
|
function get_distrib_param
|
||||||
{
|
{
|
||||||
local url="$1"
|
local parname=$1
|
||||||
curl -s -L --max-time $CURL_TIMEOUT -H "$CURL_HEADER1" -H "$CURL_HEADER2" "$url" 2>/dev/null
|
local value="__unknown__"
|
||||||
|
if [ -f /etc/openwrt_release ]; then
|
||||||
|
while IFS='=' read -r key val; do
|
||||||
|
val="${val#\'}"
|
||||||
|
val="${val%\'}"
|
||||||
|
val="${val#\"}"
|
||||||
|
val="${val%\"}"
|
||||||
|
if [ "$key" = "$parname" ]; then
|
||||||
|
value="$val"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done < /etc/openwrt_release
|
||||||
|
fi
|
||||||
|
printf '%s' "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
function pkg_mgr_update
|
||||||
|
{
|
||||||
|
local forced=$1
|
||||||
|
if [ "$PKG_MGR" = "opkg" ]; then
|
||||||
|
PKG_TOTAL=$( opkg list | wc -l )
|
||||||
|
PKG_INSTALLED=$( opkg list-installed | wc -l )
|
||||||
|
if [ "$PKG_TOTAL" = "$PKG_INSTALLED" ]; then
|
||||||
|
echo ">>> OPKG update..."
|
||||||
|
opkg update
|
||||||
return $?
|
return $?
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
PKG_AVAIL=$( apk list --available 2>/dev/null | wc -l )
|
||||||
|
if [ "$PKG_AVAIL" -lt 100 ]; then
|
||||||
|
echo ">>> APK update..."
|
||||||
|
apk update
|
||||||
|
return $?
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function curl_install
|
||||||
|
{
|
||||||
|
if command -v curl >/dev/null 2>&1; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
pkg_mgr_update || { echo "ERROR: cannot update packages list"; return 1; }
|
||||||
|
echo ">>> Package curl not found, installing..."
|
||||||
|
if [ "$PKG_MGR" = "opkg" ]; then
|
||||||
|
opkg install curl
|
||||||
|
else
|
||||||
|
apk add curl
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function unzip_install
|
||||||
|
{
|
||||||
|
if command -v unzip >/dev/null 2>&1; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
pkg_mgr_update || { echo "ERROR: cannot update packages list"; return 1; }
|
||||||
|
echo ">>> Package unzip not found, installing..."
|
||||||
|
if [ "$PKG_MGR" = "opkg" ]; then
|
||||||
|
opkg install unzip
|
||||||
|
else
|
||||||
|
apk add unzip
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_pkg_version
|
function get_pkg_version
|
||||||
@@ -185,7 +263,7 @@ function download_releases_info
|
|||||||
echo "ERROR: Cannot download file \"$ZAP_REL_URL\" (status = $status)"
|
echo "ERROR: Cannot download file \"$ZAP_REL_URL\" (status = $status)"
|
||||||
return 103
|
return 103
|
||||||
fi
|
fi
|
||||||
txtlen=$( printf '%s\n' "$hdr" | awk -F': ' 'BEGIN{IGNORECASE=1} $1=="Content-Length"{print $2}' | tr -d '\r')
|
txtlen=$( printf '%s\n' "$hdr" | awk -F': ' 'BEGIN{IGNORECASE=1} $1=="Content-Length"{print $2}' | tr -d '\r' )
|
||||||
echo "Content-Length: $txtlen bytes"
|
echo "Content-Length: $txtlen bytes"
|
||||||
txt="${resp#*$'\r\n\r\n'}"
|
txt="${resp#*$'\r\n\r\n'}"
|
||||||
txtlen=${#txt}
|
txtlen=${#txt}
|
||||||
@@ -195,7 +273,7 @@ function download_releases_info
|
|||||||
return 104
|
return 104
|
||||||
fi
|
fi
|
||||||
echo "Releases info downloaded! Size = $txtlen, Lines = $txtlines"
|
echo "Releases info downloaded! Size = $txtlen, Lines = $txtlines"
|
||||||
generated_at=$(printf '%s\n' "$txt" | grep -m1 -o '"generated_at"[[:space:]]*:[[:space:]]*".*"' | cut -d'"' -f4)
|
generated_at=$( printf '%s\n' "$txt" | grep -m1 -o '"generated_at"[[:space:]]*:[[:space:]]*".*"' | cut -d'"' -f4 )
|
||||||
if [[ "$generated_at" = "" ]]; then
|
if [[ "$generated_at" = "" ]]; then
|
||||||
echo "ERROR: Cannot download releases info! (incorrect generated_at)"
|
echo "ERROR: Cannot download releases info! (incorrect generated_at)"
|
||||||
return 105
|
return 105
|
||||||
@@ -275,11 +353,16 @@ fi
|
|||||||
|
|
||||||
#echo "DISTRIB_ID: $DISTRIB_ID"
|
#echo "DISTRIB_ID: $DISTRIB_ID"
|
||||||
echo "DISTRIB_RELEASE: $DISTRIB_RELEASE"
|
echo "DISTRIB_RELEASE: $DISTRIB_RELEASE"
|
||||||
echo "DISTRIB_DESCRIPTION:" $(get_distrib_param DISTRIB_DESCRIPTION)
|
echo "DISTRIB_DESCRIPTION:" $( get_distrib_param DISTRIB_DESCRIPTION )
|
||||||
echo "DISTRIB_ARCH:" $(get_distrib_param DISTRIB_ARCH)
|
echo "DISTRIB_ARCH:" $( get_distrib_param DISTRIB_ARCH )
|
||||||
|
|
||||||
if ! command -v curl >/dev/null 2>&1; then
|
if ! command -v curl >/dev/null 2>&1; then
|
||||||
echo "ERROR: package \"curl\" not installed!"
|
if [ "$opt_forced" = true ]; then
|
||||||
|
curl_install
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if ! command -v curl >/dev/null 2>&1; then
|
||||||
|
echo "ERROR: Required package \"curl\" not installed!"
|
||||||
return 10
|
return 10
|
||||||
fi
|
fi
|
||||||
CURL_INFO=$( curl -V )
|
CURL_INFO=$( curl -V )
|
||||||
@@ -301,6 +384,11 @@ if [ "$opt_check" = "true" ]; then
|
|||||||
fi
|
fi
|
||||||
get_actual_release
|
get_actual_release
|
||||||
ZAP_ERR=$?
|
ZAP_ERR=$?
|
||||||
|
if [ $ZAP_ERR = 150 ] && [ "$opt_prerelease" != true ] && [ "$opt_forced" = true ]; then
|
||||||
|
opt_prerelease="true"
|
||||||
|
get_actual_release
|
||||||
|
ZAP_ERR=$?
|
||||||
|
fi
|
||||||
if [ $ZAP_ERR -ne 0 ]; then
|
if [ $ZAP_ERR -ne 0 ]; then
|
||||||
echo "ERROR: Func get_actual_release return error code: $ZAP_ERR"
|
echo "ERROR: Func get_actual_release return error code: $ZAP_ERR"
|
||||||
return $ZAP_ERR
|
return $ZAP_ERR
|
||||||
@@ -393,6 +481,11 @@ if [ "$opt_update" != "" ]; then
|
|||||||
echo "ERROR: downloaded package is incorrect! (size = $ZAP_PKG_SZ)"
|
echo "ERROR: downloaded package is incorrect! (size = $ZAP_PKG_SZ)"
|
||||||
return 216
|
return 216
|
||||||
fi
|
fi
|
||||||
|
if ! command -v unzip >/dev/null 2>&1; then
|
||||||
|
if [ "$opt_forced" = true ]; then
|
||||||
|
unzip_install
|
||||||
|
fi
|
||||||
|
fi
|
||||||
if ! command -v unzip >/dev/null 2>&1; then
|
if ! command -v unzip >/dev/null 2>&1; then
|
||||||
echo "ERROR: package \"upzip\" not installed!"
|
echo "ERROR: package \"upzip\" not installed!"
|
||||||
return 218
|
return 218
|
||||||
@@ -429,6 +522,9 @@ if [ "$opt_update" != "" ]; then
|
|||||||
return 232
|
return 232
|
||||||
fi
|
fi
|
||||||
echo "ZAP_PKG_LUCI_FN = $ZAP_PKG_LUCI_FN"
|
echo "ZAP_PKG_LUCI_FN = $ZAP_PKG_LUCI_FN"
|
||||||
|
if [ "$opt_forced" = true ]; then
|
||||||
|
pkg_mgr_update
|
||||||
|
fi
|
||||||
echo "Install downloaded packages..."
|
echo "Install downloaded packages..."
|
||||||
if [ "$PKG_MGR" != "apk" ]; then
|
if [ "$PKG_MGR" != "apk" ]; then
|
||||||
opkg install --force-reinstall "$ZAP_PKG_BASE_FN"
|
opkg install --force-reinstall "$ZAP_PKG_BASE_FN"
|
||||||
|
|||||||
Reference in New Issue
Block a user