From 66e5fdc7e4fbd91be6a89a07c1e54f5eb7fb6e90 Mon Sep 17 00:00:00 2001 From: chengyujia Date: Mon, 15 Jan 2024 09:59:46 +0800 Subject: [PATCH] change structure --- .github/workflows/workflow.yml | 9 +++-- .gitmodules | 0 META-INF/com/google/android/update-binary | 33 +++++++++++++++++++ META-INF/com/google/android/updater-script | 1 + dist.sh | 16 --------- module/module.prop => module.prop | 4 +-- module/.gitignore | 2 -- module/post-fs-data.sh => post-fs-data.sh | 1 + .../etc/security/cacerts/.gitkeep | 0 update.json | 8 ++--- 10 files changed, 48 insertions(+), 26 deletions(-) delete mode 100644 .gitmodules create mode 100644 META-INF/com/google/android/update-binary create mode 100644 META-INF/com/google/android/updater-script delete mode 100755 dist.sh rename module/module.prop => module.prop (90%) delete mode 100644 module/.gitignore rename module/post-fs-data.sh => post-fs-data.sh (97%) rename {module/system => system}/etc/security/cacerts/.gitkeep (100%) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index a21d7dc..44459a0 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -17,8 +17,13 @@ jobs: - name: build dist run: | - git submodule init && git submodule update - ./dist.sh + UPDATE_BINARY_URL="https://raw.githubusercontent.com/topjohnwu/Magisk/master/scripts/module_installer.sh" + curl "${UPDATE_BINARY_URL}" > ./META-INF/com/google/android/update-binary + echo "#MAGISK" > ./META-INF/com/google/android/updater-script + VERSION=$(sed -ne "s/version=\(.*\)/\1/gp" ./module.prop) + NAME=$(sed -ne "s/id=\(.*\)/\1/gp" ./module.prop) + rm -f ${NAME}-${VERSION}.zip + zip -r ${NAME}-${VERSION}.zip META-INF system module.prop post-fs-data.sh ls -la - name: create release diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29..0000000 diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary new file mode 100644 index 0000000..28b48e5 --- /dev/null +++ b/META-INF/com/google/android/update-binary @@ -0,0 +1,33 @@ +#!/sbin/sh + +################# +# Initialization +################# + +umask 022 + +# echo before loading util_functions +ui_print() { echo "$1"; } + +require_new_magisk() { + ui_print "*******************************" + ui_print " Please install Magisk v20.4+! " + ui_print "*******************************" + exit 1 +} + +######################### +# Load util_functions.sh +######################### + +OUTFD=$2 +ZIPFILE=$3 + +mount /data 2>/dev/null + +[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk +. /data/adb/magisk/util_functions.sh +[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk + +install_module +exit 0 diff --git a/META-INF/com/google/android/updater-script b/META-INF/com/google/android/updater-script new file mode 100644 index 0000000..11d5c96 --- /dev/null +++ b/META-INF/com/google/android/updater-script @@ -0,0 +1 @@ +#MAGISK diff --git a/dist.sh b/dist.sh deleted file mode 100755 index 4bdf8a3..0000000 --- a/dist.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -UPDATE_BINARY_URL="https://raw.githubusercontent.com/topjohnwu/Magisk/master/scripts/module_installer.sh" - -mkdir -p ./module/META-INF/com/google/android -curl "${UPDATE_BINARY_URL}" > ./module/META-INF/com/google/android/update-binary -echo "#MAGISK" > ./module/META-INF/com/google/android/updater-script - -VERSION=$(sed -ne "s/version=\(.*\)/\1/gp" ./module/module.prop) -NAME=$(sed -ne "s/id=\(.*\)/\1/gp" ./module/module.prop) - -rm -f ${NAME}-${VERSION}.zip -( - cd ./module - zip ../${NAME}-${VERSION}.zip -r * -x ".*" "*/.*" -) diff --git a/module/module.prop b/module.prop similarity index 90% rename from module/module.prop rename to module.prop index 6ac4822..8fc7498 100644 --- a/module/module.prop +++ b/module.prop @@ -1,7 +1,7 @@ id=custom-certificates name=Custom Certificates -version=v2.2 -versionCode=35 +version=v2.3 +versionCode=38 author=YujiaCheng1996 description=A Magisk module which adds custom certificates to the system trust store. updateJson=https://raw.githubusercontent.com/YujiaCheng1996/custom-certificates/master/update.json diff --git a/module/.gitignore b/module/.gitignore deleted file mode 100644 index 90233b6..0000000 --- a/module/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/zygisk -/META-INF diff --git a/module/post-fs-data.sh b/post-fs-data.sh similarity index 97% rename from module/post-fs-data.sh rename to post-fs-data.sh index 9e88371..f641635 100644 --- a/module/post-fs-data.sh +++ b/post-fs-data.sh @@ -51,6 +51,7 @@ if [ -d /apex/com.android.conscrypt/cacerts ]; then set_context /apex/com.android.conscrypt/cacerts /data/local/tmp/all-ca-copy # Mount directory inside APEX and remove temporary one. + CERTS_NUM="$(ls -1 /data/local/tmp/all-ca-copy | wc -l)" if [ "$CERTS_NUM" -gt 15 ]; then mount --bind /data/local/tmp/all-ca-copy /apex/com.android.conscrypt/cacerts else diff --git a/module/system/etc/security/cacerts/.gitkeep b/system/etc/security/cacerts/.gitkeep similarity index 100% rename from module/system/etc/security/cacerts/.gitkeep rename to system/etc/security/cacerts/.gitkeep diff --git a/update.json b/update.json index 4b35dfb..bc1632f 100644 --- a/update.json +++ b/update.json @@ -1,6 +1,6 @@ { - "version": "v2.2", - "versionCode": 35, - "zipUrl": "https://github.com/YujiaCheng1996/custom-certificates/releases/download/v2.2/custom-certificates-v2.2.zip", - "changelog": "https://github.com/YujiaCheng1996/custom-certificates/releases/tag/v2.2" + "version": "v2.3", + "versionCode": 38, + "zipUrl": "https://github.com/YujiaCheng1996/custom-certificates/releases/download/v2.3/custom-certificates-v2.3.zip", + "changelog": "https://github.com/YujiaCheng1996/custom-certificates/releases/tag/v2.3" } \ No newline at end of file