From 07cee85873cc7392872920146cfd8afcae258438 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 11:13:58 +0800 Subject: [PATCH 01/31] openwrt package workflows --- .github/workflows/build_pkg.yml | 74 ++++++++++++++++++++++++++ build/openwrt/Makefile | 52 ++++++++++++++++++ esfshell.sh | 2 +- sample/windows-net-tools/esfshellrc.sh | 2 +- 4 files changed, 128 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build_pkg.yml create mode 100644 build/openwrt/Makefile diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml new file mode 100644 index 0000000..0c0401b --- /dev/null +++ b/.github/workflows/build_pkg.yml @@ -0,0 +1,74 @@ +name: CI + +on: + push: + tags: + - '*' + workflow_dispatch: + inputs: + releaseVersion: + description: 'Enter the version number' + required: true + default: 'v.' + +jobs: + openwrt: + name: OpenWrt package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install environment + run: | + sudo apt update + sudo apt install -y build-essential ccache ecj fastjar file g++ gawk \ + gettext git java-propose-classpath libelf-dev libncurses5-dev \ + libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget \ + python3-distutils python3-setuptools python3-dev rsync subversion \ + swig time xsltproc zlib1g-dev aria2 + + - name: Download & extract OpenWrt SDK + run: | + aria2c -x=16 https://downloads.openwrt.org/releases/22.03.5/targets/x86/64/openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64.tar.xz + tar -xvf openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64.tar.xz + cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 + ./scripts/feeds update -a + ./scripts/feeds install -a + + - name: Prepare openwrt package + run: | + mkdir -p openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/package/openwrt-esfshell + cp -rv build/openwrt/* openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/package/openwrt-esfshell + cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 + make package/openwrt-esfshell/download V=s + make package/openwrt-esfshell/prepare V=s + + - name: Compile openwrt package + run: make package/openwrt-esfshell/compile V=s + + - name: Upload compiled package + uses: actions/upload-artifact@v3 + with: + name: openwrt-esfshell + path: openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/bin/packages/x86_64/base/esfshell_${{ github.ref }}-${{ github.run_number }}_all.ipk + + upload-release: + permissions: + contents: write + needs: + - openwrt + runs-on: ubuntu-latest + steps: + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: openwrt-esfshell + + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: EsurfingShell v${{ github.ref }} + tag_name: ${{ github.ref }} + token: ${{ secrets.GITHUB_TOKEN }} + files: | + esfshell_${{ github.ref }}-${{ github.run_number }}_all.ipk \ No newline at end of file diff --git a/build/openwrt/Makefile b/build/openwrt/Makefile new file mode 100644 index 0000000..e108b2f --- /dev/null +++ b/build/openwrt/Makefile @@ -0,0 +1,52 @@ +# +# This is free software, licensed under the GNU General Public License v3.0 +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=esfshell +PKG_VERSION:=$(if $(value GITHUB_REF),$(value GITHUB_REF),master) +PKG_RELEASE:=$(if $(value GITHUB_RUN_NUMBER),$(value GITHUB_RUN_NUMBER),1) + +PKG_SOURCE:=$(PKG_VERSION).tar.gz +PKG_SOURCE_GITTYPE:=$(if $(value GITHUB_REF), tags, heads) +PKG_SOURCE_URL:=https://github.com/SummonHIM/EsurfingShell/archive/$(PKG_SOURCE_GITTYPE)/tags/ +PKG_HASH:=skip + +TAR_DIR:=$(BUILD_DIR)/EsurfingShell-$(PKG_VERSION) + +PKG_MAINTAINER:=SummonHIM +PKG_LICENSE:=GPL-3.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/$(PKG_NAME) + SECTION:=utils + CATEGORY:=Utilities + TITLE:=EsurfingShell + PKGARCH:=all + DEPENDS:=+bash +curl +endef + +define Package/$(PKG_NAME)/description +Esurfing Campus Login Script Based on Bash Shell +endef + +define Package/$(PKG_NAME)/conffiles +/etc/config/esfshell +endef + +define Build/Compile +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(TAR_DIR)/esfshell.sh $(1)/usr/bin/esfshell + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(TAR_DIR)/sample/openwrt-etc/init.d/esfshell $(1)/etc/init.d/esfshell + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) $(TAR_DIR)/sample/openwrt-etc/config/esfshell $(1)/etc/config/esfshell +endef + +$(eval $(call BuildPackage,esfshell)) \ No newline at end of file diff --git a/esfshell.sh b/esfshell.sh index f766d2d..bd6bda3 100644 --- a/esfshell.sh +++ b/esfshell.sh @@ -685,7 +685,7 @@ if [ ! -d "$_ES_HOMEPATH" ]; then mkdir -p "$_ES_HOMEPATH" fi -if [ -v "$funcCall" ]; then +if [ -z "$funcCall" ]; then help else if [ "$_ES_LOG_ENABLE" == true ]; then diff --git a/sample/windows-net-tools/esfshellrc.sh b/sample/windows-net-tools/esfshellrc.sh index 2b3db19..b94378e 100644 --- a/sample/windows-net-tools/esfshellrc.sh +++ b/sample/windows-net-tools/esfshellrc.sh @@ -15,7 +15,7 @@ getActivateEther() { # Params: # Return: MAC getMAC() { - wmic nicconfig where IPEnabled=True get ipaddress,macaddress | iconv -f gbk -t utf-8 | grep $1 | awk '{print $NF}' + wmic nicconfig where IPEnabled=True get ipaddress,macaddress | iconv -f gbk -t utf-8 | grep "$1" | awk '{print $NF}' } # 获取本地IP地址 From 74f8fcc1a36ec8ca6e4f91c1d77b5e620f30f1a7 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 11:15:03 +0800 Subject: [PATCH 02/31] remove workflow_dispatch --- .github/workflows/build_pkg.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 0c0401b..a3d7203 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -4,12 +4,6 @@ on: push: tags: - '*' - workflow_dispatch: - inputs: - releaseVersion: - description: 'Enter the version number' - required: true - default: 'v.' jobs: openwrt: From ac527ea692ffca73ac43b07808f914a90f09a2ed Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 11:23:11 +0800 Subject: [PATCH 03/31] use latest ubuntu pkg env --- .github/workflows/build_pkg.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index a3d7203..1f58bb7 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -15,11 +15,9 @@ jobs: - name: Install environment run: | sudo apt update - sudo apt install -y build-essential ccache ecj fastjar file g++ gawk \ - gettext git java-propose-classpath libelf-dev libncurses5-dev \ - libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget \ - python3-distutils python3-setuptools python3-dev rsync subversion \ - swig time xsltproc zlib1g-dev aria2 + sudo apt install -y build-essential clang flex bison g++ gawk gcc-multilib g++-multilib \ + gettext git libncurses-dev libssl-dev python3-distutils rsync unzip zlib1g-dev \ + file wget aria2 - name: Download & extract OpenWrt SDK run: | From b36748f63004549ba4359143bb95e962131ed131 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 11:28:14 +0800 Subject: [PATCH 04/31] fix aria2 --- .github/workflows/build_pkg.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 1f58bb7..072cd32 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -21,7 +21,7 @@ jobs: - name: Download & extract OpenWrt SDK run: | - aria2c -x=16 https://downloads.openwrt.org/releases/22.03.5/targets/x86/64/openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64.tar.xz + aria2c -x 16 https://downloads.openwrt.org/releases/22.03.5/targets/x86/64/openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64.tar.xz tar -xvf openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64.tar.xz cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 ./scripts/feeds update -a @@ -62,5 +62,6 @@ jobs: name: EsurfingShell v${{ github.ref }} tag_name: ${{ github.ref }} token: ${{ secrets.GITHUB_TOKEN }} + draft: true files: | esfshell_${{ github.ref }}-${{ github.run_number }}_all.ipk \ No newline at end of file From 95521fe5e239fc6e528529b241d85af35072aa33 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 11:42:30 +0800 Subject: [PATCH 05/31] [wf] generate .config --- .github/workflows/build_pkg.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 072cd32..30f380d 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -22,10 +22,11 @@ jobs: - name: Download & extract OpenWrt SDK run: | aria2c -x 16 https://downloads.openwrt.org/releases/22.03.5/targets/x86/64/openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64.tar.xz - tar -xvf openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64.tar.xz + tar -xf openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64.tar.xz cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 ./scripts/feeds update -a ./scripts/feeds install -a + make defconfig - name: Prepare openwrt package run: | From 8b6c3c19ae0feb321d2018225509d6d244bd1c9f Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 11:49:12 +0800 Subject: [PATCH 06/31] [wf] sc for detail --- .github/workflows/build_pkg.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 30f380d..908374f 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -33,11 +33,11 @@ jobs: mkdir -p openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/package/openwrt-esfshell cp -rv build/openwrt/* openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/package/openwrt-esfshell cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 - make package/openwrt-esfshell/download V=s - make package/openwrt-esfshell/prepare V=s + make package/openwrt-esfshell/download V=sc + make package/openwrt-esfshell/prepare V=sc - name: Compile openwrt package - run: make package/openwrt-esfshell/compile V=s + run: make package/openwrt-esfshell/compile V=sc - name: Upload compiled package uses: actions/upload-artifact@v3 From 5a125df7d340a28461deb1eeb78eb975abaa50b1 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 12:03:30 +0800 Subject: [PATCH 07/31] [wf] spilt --- .github/workflows/build_pkg.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 908374f..e26b67b 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -34,8 +34,10 @@ jobs: cp -rv build/openwrt/* openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/package/openwrt-esfshell cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 make package/openwrt-esfshell/download V=sc - make package/openwrt-esfshell/prepare V=sc + - name: Prepare openwrt package + run: make package/openwrt-esfshell/prepare V=sc + - name: Compile openwrt package run: make package/openwrt-esfshell/compile V=sc From ed50c12ffacecfb6baa2855709078201ee65bb45 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 12:10:04 +0800 Subject: [PATCH 08/31] fix makefile url --- .github/workflows/build_pkg.yml | 8 ++++---- build/openwrt/Makefile | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index e26b67b..b18377b 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -28,17 +28,17 @@ jobs: ./scripts/feeds install -a make defconfig - - name: Prepare openwrt package + - name: Download openwrt-esfshell package run: | mkdir -p openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/package/openwrt-esfshell cp -rv build/openwrt/* openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/package/openwrt-esfshell cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 make package/openwrt-esfshell/download V=sc - - name: Prepare openwrt package + - name: Prepare openwrt-esfshell package run: make package/openwrt-esfshell/prepare V=sc - - - name: Compile openwrt package + + - name: Compile openwrt-esfshell package run: make package/openwrt-esfshell/compile V=sc - name: Upload compiled package diff --git a/build/openwrt/Makefile b/build/openwrt/Makefile index e108b2f..0e25dbe 100644 --- a/build/openwrt/Makefile +++ b/build/openwrt/Makefile @@ -11,7 +11,7 @@ PKG_RELEASE:=$(if $(value GITHUB_RUN_NUMBER),$(value GITHUB_RUN_NUMBER),1) PKG_SOURCE:=$(PKG_VERSION).tar.gz PKG_SOURCE_GITTYPE:=$(if $(value GITHUB_REF), tags, heads) -PKG_SOURCE_URL:=https://github.com/SummonHIM/EsurfingShell/archive/$(PKG_SOURCE_GITTYPE)/tags/ +PKG_SOURCE_URL:=https://github.com/SummonHIM/EsurfingShell/archive/refs/$(PKG_SOURCE_GITTYPE)/ PKG_HASH:=skip TAR_DIR:=$(BUILD_DIR)/EsurfingShell-$(PKG_VERSION) From 9f92f620f2bc4b82aa98921a4db0c7210c7a7dde Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 12:15:55 +0800 Subject: [PATCH 09/31] fix makefile url 2 --- build/openwrt/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/openwrt/Makefile b/build/openwrt/Makefile index 0e25dbe..a27d8d7 100644 --- a/build/openwrt/Makefile +++ b/build/openwrt/Makefile @@ -10,7 +10,7 @@ PKG_VERSION:=$(if $(value GITHUB_REF),$(value GITHUB_REF),master) PKG_RELEASE:=$(if $(value GITHUB_RUN_NUMBER),$(value GITHUB_RUN_NUMBER),1) PKG_SOURCE:=$(PKG_VERSION).tar.gz -PKG_SOURCE_GITTYPE:=$(if $(value GITHUB_REF), tags, heads) +PKG_SOURCE_GITTYPE:=$(if $(value GITHUB_REF),tags,heads) PKG_SOURCE_URL:=https://github.com/SummonHIM/EsurfingShell/archive/refs/$(PKG_SOURCE_GITTYPE)/ PKG_HASH:=skip From 1183becd88390a3143643ab13237a8b1bf65d840 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 12:24:13 +0800 Subject: [PATCH 10/31] fix makefile url 3 --- build/openwrt/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/openwrt/Makefile b/build/openwrt/Makefile index a27d8d7..fbd2b6e 100644 --- a/build/openwrt/Makefile +++ b/build/openwrt/Makefile @@ -6,11 +6,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=esfshell -PKG_VERSION:=$(if $(value GITHUB_REF),$(value GITHUB_REF),master) +PKG_VERSION:=$(if $(value GITHUB_REF_NAME),$(value GITHUB_REF_NAME),master) PKG_RELEASE:=$(if $(value GITHUB_RUN_NUMBER),$(value GITHUB_RUN_NUMBER),1) PKG_SOURCE:=$(PKG_VERSION).tar.gz -PKG_SOURCE_GITTYPE:=$(if $(value GITHUB_REF),tags,heads) +PKG_SOURCE_GITTYPE:=$(if $(value GITHUB_REF_NAME),tags,heads) PKG_SOURCE_URL:=https://github.com/SummonHIM/EsurfingShell/archive/refs/$(PKG_SOURCE_GITTYPE)/ PKG_HASH:=skip From 96515e165e86e356cef19dc454c7d7e06558a910 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 12:29:39 +0800 Subject: [PATCH 11/31] [wf] fix prepare & compile dir --- .github/workflows/build_pkg.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index b18377b..9368835 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -36,10 +36,14 @@ jobs: make package/openwrt-esfshell/download V=sc - name: Prepare openwrt-esfshell package - run: make package/openwrt-esfshell/prepare V=sc + run: | + cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 + make package/openwrt-esfshell/prepare V=sc - name: Compile openwrt-esfshell package - run: make package/openwrt-esfshell/compile V=sc + run: | + cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 + make package/openwrt-esfshell/compile V=sc - name: Upload compiled package uses: actions/upload-artifact@v3 From 83da1ac675bbe19a3859ca3008a7c402bb5e35ba Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 12:44:08 +0800 Subject: [PATCH 12/31] [wf]fix upload name --- .github/workflows/build_pkg.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 9368835..18fe4db 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -33,23 +33,23 @@ jobs: mkdir -p openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/package/openwrt-esfshell cp -rv build/openwrt/* openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/package/openwrt-esfshell cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 - make package/openwrt-esfshell/download V=sc + make package/openwrt-esfshell/download - name: Prepare openwrt-esfshell package run: | cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 - make package/openwrt-esfshell/prepare V=sc + make package/openwrt-esfshell/prepare - name: Compile openwrt-esfshell package run: | cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 - make package/openwrt-esfshell/compile V=sc + make package/openwrt-esfshell/compile - name: Upload compiled package uses: actions/upload-artifact@v3 with: name: openwrt-esfshell - path: openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/bin/packages/x86_64/base/esfshell_${{ github.ref }}-${{ github.run_number }}_all.ipk + path: openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/bin/packages/x86_64/base/esfshell_${{ github.ref_name }}-${{ github.run_number }}_all.ipk upload-release: permissions: From bf4a0298cc11994bb8dd80906bfbc9cf19ca1e82 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 12:57:28 +0800 Subject: [PATCH 13/31] [wf] fix workflow release --- .github/workflows/build_pkg.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 18fe4db..fd48f2e 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -52,6 +52,7 @@ jobs: path: openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/bin/packages/x86_64/base/esfshell_${{ github.ref_name }}-${{ github.run_number }}_all.ipk upload-release: + name: Upload releases permissions: contents: write needs: @@ -66,9 +67,9 @@ jobs: - name: Release uses: softprops/action-gh-release@v1 with: - name: EsurfingShell v${{ github.ref }} - tag_name: ${{ github.ref }} + name: EsurfingShell v${{ github.ref_name }} + tag_name: ${{ github.ref_name }} token: ${{ secrets.GITHUB_TOKEN }} draft: true files: | - esfshell_${{ github.ref }}-${{ github.run_number }}_all.ipk \ No newline at end of file + esfshell_${{ github.ref_name }}-${{ github.run_number }}_all.ipk \ No newline at end of file From 47a538441f971a26758bef3481e0778571075d1c Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 13:11:08 +0800 Subject: [PATCH 14/31] update readme --- README.md | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index eec1311..6b432ef 100644 --- a/README.md +++ b/README.md @@ -30,26 +30,33 @@ - cron(crond): 用于自动执行计划任务,OpenWrt自带cron,其他系统可以测试一下。(可选) ## 快速安装 -### Arch Linux/Windows MSYS(请注意阅读下方注释) +### Arch Linux ```Shell sudo pacman -Su bash curl && sudo sh -c "$(curl -fsSL https://fastly.jsdelivr.net/gh/SummonHIM/EsurfingShell@master/install/linux.sh)" ``` -### Ubuntu/Android Termux(请注意阅读下方注释) +### Ubuntu ```Shell sudo apt update && sudo apt install bash curl && sudo sh -c "$(curl -fsSL https://fastly.jsdelivr.net/gh/SummonHIM/EsurfingShell@master/install/linux.sh)" ``` +### Windows MSYS +```Shell +pacman -Su bash curl && _ES_SKIP=true sh -c "$(curl -fsSL https://fastly.jsdelivr.net/gh/SummonHIM/EsurfingShell@master/install/linux.sh)" +``` + +### Android Termux +```Shell +apt update && apt install bash curl && _ES_INSTALL_ESFSHELL_LOC="/data/data/com.termux/files/usr/bin" _ES_SKIP=true sh -c "$(curl -fsSL https://fastly.jsdelivr.net/gh/SummonHIM/EsurfingShell@master/install/linux.sh)" +``` + ### OpenWrt -敬请期待 +[下载最新 IPK](https://github.com/SummonHIM/EsurfingShell/releases/latest) > - 以上命令将一键安装Bash和curl并下载本仓库的esfshell.sh文件至`/usr/bin`,最后赋予执行权限。 > - 其他Unix系系统也大同小异,只需要修改以上命令为系统常用的包管理器即可。 > - 在Windows MSYS和Android Termux中不需要使用sudo来获取管理员权限。可提前定义变量`_ES_SKIP`为`true`来跳过Root检查。 > - Android Termux需要修改`/usr/bin`文件夹为`/data/data/com.termux/files/usr/bin`。即: -> ```Shell -> _ES_INSTALL_ESFSHELL_LOC="/data/data/com.termux/files/usr/bin" _ES_SKIP=true sh -c "$(curl -fsSL https://fastly.jsdelivr.net/gh/SummonHIM/EsurfingShell@master/install/linux.sh)" -> ``` ## 如何使用? ``` @@ -99,13 +106,19 @@ esfshell -O #### OpenWrt init.d [范例文件](/sample/openwrt-etc/init.d/esfshell) -> 注意:需要提前在初始化文件中定义用户名和密码才能正常使用。 -> > [OpenWrt服务使用教程(英文)](https://openwrt.org/docs/guide-user/base-system/managing_services) | [OpenWrt日志查看教程(英文)](https://openwrt.org/docs/guide-user/base-system/log.essentials) -将范例文件下载至`/etc/init.d`文件夹后,修改文件内的路径即可。 +将范例文件下载至`/etc/init.d`文件夹即可使用。 -可在`/etc/esfshell`中新建名为网卡名称的文件夹来自定义默认网卡。若`/etc/esfshell`中没有文件夹则使用`/etc/esfshell`作为主目录。 +本服务文件已适配[UCI系统](https://openwrt.org/docs/guide-user/base-system/uci)。可使用UCI命令来配置脚本。 +``` +uci set esfshell.@esfshell[0].enable='1' # 选项'enable'用于控制是否启用本配置 +uci set esfshell.@esfshell[0].username='用户名' # 选项'username'用于定义用户名 +uci set esfshell.@esfshell[0].password='密码' # 选项'password'用于定义密码 +uci set esfshell.@esfshell[0].interface='网络接口' # 选项'interface'用于定义网络接口 +uci add_list esfshell.@esfshell[0].env='_ES_LANG=zh_CN' # 列表'env'用于定义自定义变量 +uci add_list esfshell.@esfshell[0].env='_ES_DAEMON_SLEEPTIME=1m' +``` ## 初始化文件 初始化文件能在不修改脚本的前提下为脚本新增/修改功能、函数以及变量。其定位与Bash中的`.bashrc`一致。 From 252e4ba79d95c8437d5ea8b0bec60b7d86fe65a3 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Wed, 14 Jun 2023 13:18:57 +0800 Subject: [PATCH 15/31] update readme --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6b432ef..6b0a7f3 100644 --- a/README.md +++ b/README.md @@ -108,16 +108,18 @@ esfshell -O > [OpenWrt服务使用教程(英文)](https://openwrt.org/docs/guide-user/base-system/managing_services) | [OpenWrt日志查看教程(英文)](https://openwrt.org/docs/guide-user/base-system/log.essentials) -将范例文件下载至`/etc/init.d`文件夹即可使用。 +一般情况下IPK软件包已经集成服务文件。若不存在则将范例文件下载至`/etc/init.d`文件夹即可使用。 本服务文件已适配[UCI系统](https://openwrt.org/docs/guide-user/base-system/uci)。可使用UCI命令来配置脚本。 ``` +uci add esfshell esfshell # 若配置为空,则新建一个新配置 uci set esfshell.@esfshell[0].enable='1' # 选项'enable'用于控制是否启用本配置 uci set esfshell.@esfshell[0].username='用户名' # 选项'username'用于定义用户名 uci set esfshell.@esfshell[0].password='密码' # 选项'password'用于定义密码 uci set esfshell.@esfshell[0].interface='网络接口' # 选项'interface'用于定义网络接口 uci add_list esfshell.@esfshell[0].env='_ES_LANG=zh_CN' # 列表'env'用于定义自定义变量 -uci add_list esfshell.@esfshell[0].env='_ES_DAEMON_SLEEPTIME=1m' +uci add_list esfshell.@esfshell[0].env='_ES_DAEMON_SLEEPTIME=1m' +uci commit # 保存正缓存的配置 ``` ## 初始化文件 From 11b018a75dad14af546a66eebc4f286cd8c92cd5 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Thu, 15 Jun 2023 21:39:47 +0800 Subject: [PATCH 16/31] fix openwrt service bug --- build/openwrt/Makefile | 2 +- sample/openwrt-etc/config/esfshell | 2 +- sample/openwrt-etc/init.d/esfshell | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/openwrt/Makefile b/build/openwrt/Makefile index fbd2b6e..fa623ed 100644 --- a/build/openwrt/Makefile +++ b/build/openwrt/Makefile @@ -30,7 +30,7 @@ define Package/$(PKG_NAME) endef define Package/$(PKG_NAME)/description -Esurfing Campus Login Script Based on Bash Shell +Esurfing Campus Login Script Based on Bash Shell. endef define Package/$(PKG_NAME)/conffiles diff --git a/sample/openwrt-etc/config/esfshell b/sample/openwrt-etc/config/esfshell index 6b71168..030ffd0 100644 --- a/sample/openwrt-etc/config/esfshell +++ b/sample/openwrt-etc/config/esfshell @@ -1,6 +1,6 @@ config esfshell - option enable '0' + option enabled '0' option username '' option password '' option interface '' diff --git a/sample/openwrt-etc/init.d/esfshell b/sample/openwrt-etc/init.d/esfshell index 8d7b63a..ad7abe3 100644 --- a/sample/openwrt-etc/init.d/esfshell +++ b/sample/openwrt-etc/init.d/esfshell @@ -41,10 +41,10 @@ config_esfshell_stop() { start_service() { config_load esfshell - config_foreach config_esfshell_start esfshell + config_foreach config_esfshell_start } service_stopped() { config_load esfshell - config_foreach config_esfshell_stop esfshell + config_foreach config_esfshell_stop } From bb53136579fb7c07f43521ff18d88e2d2b358449 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Thu, 15 Jun 2023 21:44:13 +0800 Subject: [PATCH 17/31] openwrt service force logout --- sample/openwrt-etc/init.d/esfshell | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sample/openwrt-etc/init.d/esfshell b/sample/openwrt-etc/init.d/esfshell index ad7abe3..b618043 100644 --- a/sample/openwrt-etc/init.d/esfshell +++ b/sample/openwrt-etc/init.d/esfshell @@ -31,7 +31,8 @@ config_esfshell_stop() { export _ES_ACC_USERNAME="$username" export _ES_ACC_PASSWD="$password" export _ES_GLOBAL_DEVICE="$interface" - export _ES_HOMEPATH="/etc/esfshell/$interface" + export _ES_HOMEPATH="/etc/esfshell/$interface" + export _ES_FORCE=true for ex_env in $env; do export $ex_env done From ccc0308b16cea5ae3300d158050394df5c73a30e Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 12:43:02 +0800 Subject: [PATCH 18/31] better svc trigger --- install/linux.sh | 2 +- sample/openwrt-etc/init.d/esfshell | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/install/linux.sh b/install/linux.sh index 5f3ce81..752f792 100644 --- a/install/linux.sh +++ b/install/linux.sh @@ -22,7 +22,7 @@ _exists() { } if [ -z "$_ES_SKIP" ]; then - if [[ $(id -u) != 0 ]]; then + if [ $(id -u) != 0 ]; then echo Please run this script as root. exit 1 fi diff --git a/sample/openwrt-etc/init.d/esfshell b/sample/openwrt-etc/init.d/esfshell index b618043..d732f3e 100644 --- a/sample/openwrt-etc/init.d/esfshell +++ b/sample/openwrt-etc/init.d/esfshell @@ -6,9 +6,11 @@ START=99 config_esfshell_start() { config_get_bool enabled $1 enabled 0 - [ "$enabled" = "1" ] || { return 1; } config_get username $1 username config_get password $1 password + [ "$enabled" = "1" ] || { return 1; } + [ -n "$username" ] || { return 1; } + [ -n "$password" ] || { return 1; } config_get interface $1 interface config_get env $1 env @@ -22,9 +24,11 @@ config_esfshell_start() { config_esfshell_stop() { config_get_bool enabled $1 enabled 0 - [ "$enabled" = "1" ] || { return 1; } config_get username $1 username config_get password $1 password + [ "$enabled" = "1" ] || { return 1; } + [ -n "$username" ] || { return 1; } + [ -n "$password" ] || { return 1; } config_get interface $1 interface config_get env $1 env @@ -49,3 +53,7 @@ service_stopped() { config_load esfshell config_foreach config_esfshell_stop } + +service_triggers() { + procd_add_reload_trigger "esfshell" +} \ No newline at end of file From 69144a84f530e5d196b2c2c1e42a2aa67fed555f Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 12:56:59 +0800 Subject: [PATCH 19/31] use gh-action-sdk --- .github/workflows/build_pkg.yml | 38 +++++---------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index fd48f2e..df4ec59 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -12,44 +12,16 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install environment - run: | - sudo apt update - sudo apt install -y build-essential clang flex bison g++ gawk gcc-multilib g++-multilib \ - gettext git libncurses-dev libssl-dev python3-distutils rsync unzip zlib1g-dev \ - file wget aria2 - - - name: Download & extract OpenWrt SDK - run: | - aria2c -x 16 https://downloads.openwrt.org/releases/22.03.5/targets/x86/64/openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64.tar.xz - tar -xf openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64.tar.xz - cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 - ./scripts/feeds update -a - ./scripts/feeds install -a - make defconfig - - - name: Download openwrt-esfshell package - run: | - mkdir -p openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/package/openwrt-esfshell - cp -rv build/openwrt/* openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/package/openwrt-esfshell - cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 - make package/openwrt-esfshell/download - - - name: Prepare openwrt-esfshell package - run: | - cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 - make package/openwrt-esfshell/prepare - - - name: Compile openwrt-esfshell package - run: | - cd openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64 - make package/openwrt-esfshell/compile + - name: Build + uses: openwrt/gh-action-sdk@main + env: + ARCH: x86_64 - name: Upload compiled package uses: actions/upload-artifact@v3 with: name: openwrt-esfshell - path: openwrt-sdk-22.03.5-x86-64_gcc-11.2.0_musl.Linux-x86_64/bin/packages/x86_64/base/esfshell_${{ github.ref_name }}-${{ github.run_number }}_all.ipk + path: bin/packages/x86_64/packages/*.ipk upload-release: name: Upload releases From 354708a1079ea3249a0e46c3f607950e5806d5f5 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 13:06:26 +0800 Subject: [PATCH 20/31] use matrix --- .github/workflows/build_pkg.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index df4ec59..ffd3b0a 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -9,19 +9,25 @@ jobs: openwrt: name: OpenWrt package runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + arch: + - x86_64 + steps: - uses: actions/checkout@v3 - - name: Build + - name: Build OpenWrt package uses: openwrt/gh-action-sdk@main env: - ARCH: x86_64 + ARCH: ${{ matrix.arch }} - name: Upload compiled package uses: actions/upload-artifact@v3 with: name: openwrt-esfshell - path: bin/packages/x86_64/packages/*.ipk + path: bin/packages/${{ matrix.arch }}/packages/*.ipk upload-release: name: Upload releases @@ -41,7 +47,6 @@ jobs: with: name: EsurfingShell v${{ github.ref_name }} tag_name: ${{ github.ref_name }} - token: ${{ secrets.GITHUB_TOKEN }} draft: true files: | - esfshell_${{ github.ref_name }}-${{ github.run_number }}_all.ipk \ No newline at end of file + *.ipk \ No newline at end of file From 818040c5091c799ace6f3e6170af7cebc2a7137b Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 13:11:16 +0800 Subject: [PATCH 21/31] add -master to fix openwrt/gh-action-sdk --- .github/workflows/build_pkg.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index ffd3b0a..1c98799 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -9,25 +9,19 @@ jobs: openwrt: name: OpenWrt package runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - arch: - - x86_64 - steps: - uses: actions/checkout@v3 - name: Build OpenWrt package uses: openwrt/gh-action-sdk@main env: - ARCH: ${{ matrix.arch }} + ARCH: x86_64-master - name: Upload compiled package uses: actions/upload-artifact@v3 with: name: openwrt-esfshell - path: bin/packages/${{ matrix.arch }}/packages/*.ipk + path: bin/packages/x86_64/packages/*.ipk upload-release: name: Upload releases From 7891d142ddb1d360a7f0ef4c4d2289f7808c16e4 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 13:20:37 +0800 Subject: [PATCH 22/31] add package name to openwrt/gh-action-sdk --- .github/workflows/build_pkg.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 1c98799..fc78100 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -16,6 +16,7 @@ jobs: uses: openwrt/gh-action-sdk@main env: ARCH: x86_64-master + PACKAGES: openwrt-esfshell - name: Upload compiled package uses: actions/upload-artifact@v3 From dc048b9d04c37b154a71f64f9cd3b9e7b465be3a Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 13:30:07 +0800 Subject: [PATCH 23/31] [wf] set feed dir --- .github/workflows/build_pkg.yml | 1 + build/openwrt/{ => openwrt-esfshell}/Makefile | 0 2 files changed, 1 insertion(+) rename build/openwrt/{ => openwrt-esfshell}/Makefile (100%) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index fc78100..6b44cba 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -16,6 +16,7 @@ jobs: uses: openwrt/gh-action-sdk@main env: ARCH: x86_64-master + FEED_DIR: ${{ github.workspace }}/build/openwrt PACKAGES: openwrt-esfshell - name: Upload compiled package diff --git a/build/openwrt/Makefile b/build/openwrt/openwrt-esfshell/Makefile similarity index 100% rename from build/openwrt/Makefile rename to build/openwrt/openwrt-esfshell/Makefile From 216a632e666b389e188f6c9743c6d928f5810904 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 17:53:59 +0800 Subject: [PATCH 24/31] [wf] try move makefile to root --- .github/workflows/build_pkg.yml | 4 +++- build/openwrt/{openwrt-esfshell => }/Makefile | 14 +++----------- 2 files changed, 6 insertions(+), 12 deletions(-) rename build/openwrt/{openwrt-esfshell => }/Makefile (64%) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 6b44cba..fa009ea 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -12,11 +12,13 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Prepare OpenWrt makefile + run: cp build/openwrt/Makefile ./ + - name: Build OpenWrt package uses: openwrt/gh-action-sdk@main env: ARCH: x86_64-master - FEED_DIR: ${{ github.workspace }}/build/openwrt PACKAGES: openwrt-esfshell - name: Upload compiled package diff --git a/build/openwrt/openwrt-esfshell/Makefile b/build/openwrt/Makefile similarity index 64% rename from build/openwrt/openwrt-esfshell/Makefile rename to build/openwrt/Makefile index fa623ed..1608ef6 100644 --- a/build/openwrt/openwrt-esfshell/Makefile +++ b/build/openwrt/Makefile @@ -8,14 +8,6 @@ include $(TOPDIR)/rules.mk PKG_NAME:=esfshell PKG_VERSION:=$(if $(value GITHUB_REF_NAME),$(value GITHUB_REF_NAME),master) PKG_RELEASE:=$(if $(value GITHUB_RUN_NUMBER),$(value GITHUB_RUN_NUMBER),1) - -PKG_SOURCE:=$(PKG_VERSION).tar.gz -PKG_SOURCE_GITTYPE:=$(if $(value GITHUB_REF_NAME),tags,heads) -PKG_SOURCE_URL:=https://github.com/SummonHIM/EsurfingShell/archive/refs/$(PKG_SOURCE_GITTYPE)/ -PKG_HASH:=skip - -TAR_DIR:=$(BUILD_DIR)/EsurfingShell-$(PKG_VERSION) - PKG_MAINTAINER:=SummonHIM PKG_LICENSE:=GPL-3.0 @@ -42,11 +34,11 @@ endef define Package/$(PKG_NAME)/install $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(TAR_DIR)/esfshell.sh $(1)/usr/bin/esfshell + $(INSTALL_BIN) ./esfshell.sh $(1)/usr/bin/esfshell $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) $(TAR_DIR)/sample/openwrt-etc/init.d/esfshell $(1)/etc/init.d/esfshell + $(INSTALL_BIN) ./sample/openwrt-etc/init.d/esfshell $(1)/etc/init.d/esfshell $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DATA) $(TAR_DIR)/sample/openwrt-etc/config/esfshell $(1)/etc/config/esfshell + $(INSTALL_DATA) ./sample/openwrt-etc/config/esfshell $(1)/etc/config/esfshell endef $(eval $(call BuildPackage,esfshell)) \ No newline at end of file From e6589fad58808803198079e22f728cf353532b9d Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 18:28:48 +0800 Subject: [PATCH 25/31] [wf] try use /artifacts --- .github/workflows/build_pkg.yml | 4 +--- build/openwrt/{ => openwrt-esfshell}/Makefile | 12 +++++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) rename build/openwrt/{ => openwrt-esfshell}/Makefile (72%) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index fa009ea..4f8fa78 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -12,14 +12,12 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Prepare OpenWrt makefile - run: cp build/openwrt/Makefile ./ - - name: Build OpenWrt package uses: openwrt/gh-action-sdk@main env: ARCH: x86_64-master PACKAGES: openwrt-esfshell + FEED_DIR: ${{ github.workspace }}/build/openwrt - name: Upload compiled package uses: actions/upload-artifact@v3 diff --git a/build/openwrt/Makefile b/build/openwrt/openwrt-esfshell/Makefile similarity index 72% rename from build/openwrt/Makefile rename to build/openwrt/openwrt-esfshell/Makefile index 1608ef6..56adad0 100644 --- a/build/openwrt/Makefile +++ b/build/openwrt/openwrt-esfshell/Makefile @@ -11,6 +11,12 @@ PKG_RELEASE:=$(if $(value GITHUB_RUN_NUMBER),$(value GITHUB_RUN_NUMBER),1) PKG_MAINTAINER:=SummonHIM PKG_LICENSE:=GPL-3.0 +ifneq ($(wildcard /artifacts),) +PKG_DIRECTORY:=/artifacts +else +PKG_DIRECTORY:=../.. +endif + include $(INCLUDE_DIR)/package.mk define Package/$(PKG_NAME) @@ -34,11 +40,11 @@ endef define Package/$(PKG_NAME)/install $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) ./esfshell.sh $(1)/usr/bin/esfshell + $(INSTALL_BIN) $(PKG_DIRECTORY)/esfshell.sh $(1)/usr/bin/esfshell $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./sample/openwrt-etc/init.d/esfshell $(1)/etc/init.d/esfshell + $(INSTALL_BIN) $(PKG_DIRECTORY)/sample/openwrt-etc/init.d/esfshell $(1)/etc/init.d/esfshell $(INSTALL_DIR) $(1)/etc/config - $(INSTALL_DATA) ./sample/openwrt-etc/config/esfshell $(1)/etc/config/esfshell + $(INSTALL_DATA) $(PKG_DIRECTORY)/sample/openwrt-etc/config/esfshell $(1)/etc/config/esfshell endef $(eval $(call BuildPackage,esfshell)) \ No newline at end of file From 33f889a9e0e2f0085d123594eebde0b445b8c65e Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 18:29:06 +0800 Subject: [PATCH 26/31] fix makefile --- build/openwrt/openwrt-esfshell/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/openwrt/openwrt-esfshell/Makefile b/build/openwrt/openwrt-esfshell/Makefile index 56adad0..3df73e7 100644 --- a/build/openwrt/openwrt-esfshell/Makefile +++ b/build/openwrt/openwrt-esfshell/Makefile @@ -14,7 +14,7 @@ PKG_LICENSE:=GPL-3.0 ifneq ($(wildcard /artifacts),) PKG_DIRECTORY:=/artifacts else -PKG_DIRECTORY:=../.. +PKG_DIRECTORY:=../../.. endif include $(INCLUDE_DIR)/package.mk From d8451ed9914ff2b4eb5d12ad27362f012ab5c0f3 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 18:43:22 +0800 Subject: [PATCH 27/31] [wf] filename rule --- .github/workflows/build_pkg.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 4f8fa78..309d2e8 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -23,7 +23,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: openwrt-esfshell - path: bin/packages/x86_64/packages/*.ipk + path: bin/packages/x86_64/base/esfshell*.ipk upload-release: name: Upload releases @@ -45,4 +45,4 @@ jobs: tag_name: ${{ github.ref_name }} draft: true files: | - *.ipk \ No newline at end of file + esfshell*.ipk \ No newline at end of file From f6eb1a92d73d98ce0482d02907fa35cb17cfdc23 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 19:01:46 +0800 Subject: [PATCH 28/31] [wf] fix regex --- .github/workflows/build_pkg.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 309d2e8..a7ec53e 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -23,7 +23,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: openwrt-esfshell - path: bin/packages/x86_64/base/esfshell*.ipk + path: bin/packages/x86_64/base/esfshell.*.ipk upload-release: name: Upload releases @@ -45,4 +45,4 @@ jobs: tag_name: ${{ github.ref_name }} draft: true files: | - esfshell*.ipk \ No newline at end of file + esfshell.*.ipk \ No newline at end of file From a9005b18347f8569fa8113740160626ef63f1802 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 19:12:33 +0800 Subject: [PATCH 29/31] [wf]test path --- .github/workflows/build_pkg.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index a7ec53e..291839c 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -2,6 +2,8 @@ name: CI on: push: + branches: + - dev tags: - '*' @@ -23,7 +25,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: openwrt-esfshell - path: bin/packages/x86_64/base/esfshell.*.ipk + path: bin/packages/x86_64 upload-release: name: Upload releases @@ -45,4 +47,4 @@ jobs: tag_name: ${{ github.ref_name }} draft: true files: | - esfshell.*.ipk \ No newline at end of file + *.ipk \ No newline at end of file From 8a821dcc73b11942b83f4dfe8f8b40c32bd2a5f9 Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 19:20:00 +0800 Subject: [PATCH 30/31] [wf] final path test --- .github/workflows/build_pkg.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_pkg.yml b/.github/workflows/build_pkg.yml index 291839c..e17caf7 100644 --- a/.github/workflows/build_pkg.yml +++ b/.github/workflows/build_pkg.yml @@ -25,7 +25,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: openwrt-esfshell - path: bin/packages/x86_64 + path: bin/packages/x86_64/action/*.ipk upload-release: name: Upload releases From 0ed3313f49cff4915dfc61637ebc118f01188f8d Mon Sep 17 00:00:00 2001 From: SummonHIM <2239760702@qq.com> Date: Fri, 16 Jun 2023 19:38:12 +0800 Subject: [PATCH 31/31] update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6b0a7f3..6d1c39a 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ apt update && apt install bash curl && _ES_INSTALL_ESFSHELL_LOC="/data/data/com. ``` ### OpenWrt -[下载最新 IPK](https://github.com/SummonHIM/EsurfingShell/releases/latest) +[下载最新 IPK](https://github.com/SummonHIM/EsurfingShell/releases/latest) | [下载图形化界面(LuCI)](https://github.com/SummonHIM/luci-app-esfshell) > - 以上命令将一键安装Bash和curl并下载本仓库的esfshell.sh文件至`/usr/bin`,最后赋予执行权限。 > - 其他Unix系系统也大同小异,只需要修改以上命令为系统常用的包管理器即可。 @@ -106,7 +106,7 @@ esfshell -O #### OpenWrt init.d [范例文件](/sample/openwrt-etc/init.d/esfshell) -> [OpenWrt服务使用教程(英文)](https://openwrt.org/docs/guide-user/base-system/managing_services) | [OpenWrt日志查看教程(英文)](https://openwrt.org/docs/guide-user/base-system/log.essentials) +可前去系统→启动项来控制该服务启停与开机自启。详细信息可参阅:[OpenWrt服务使用教程(英文)](https://openwrt.org/docs/guide-user/base-system/managing_services) | [OpenWrt日志查看教程(英文)](https://openwrt.org/docs/guide-user/base-system/log.essentials) 一般情况下IPK软件包已经集成服务文件。若不存在则将范例文件下载至`/etc/init.d`文件夹即可使用。