From 200d778ef103d7d1c48aeb76ef8a7f531a769c7f Mon Sep 17 00:00:00 2001 From: Sergey Fionov Date: Thu, 18 Jan 2024 18:58:49 +0200 Subject: [PATCH 1/3] Fix moving cert on Android 14 with Magisk Canary 26.4 --- module/module.prop | 2 +- module/post-fs-data.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/module/module.prop b/module/module.prop index d73ed25..e1a62db 100644 --- a/module/module.prop +++ b/module/module.prop @@ -1,6 +1,6 @@ id=adguardcert name=AdGuard Certificate -version=v2.0 +version=v2.1-beta1 versionCode=35 author=AdGuard description=Moves AdGuard's root CA certificate from the user certificate store to the system certificate store. diff --git a/module/post-fs-data.sh b/module/post-fs-data.sh index 3492e0f..29c270b 100644 --- a/module/post-fs-data.sh +++ b/module/post-fs-data.sh @@ -57,7 +57,7 @@ if [ -d /apex/com.android.conscrypt/cacerts ]; then cp -f /apex/com.android.conscrypt/cacerts/* /data/local/tmp/adg-ca-copy/ # Do the same as in Magisk module - cp -f ${AG_CERT_FILE} /data/local/tmp/adg-ca-copy + cp -f ${AG_CERT_FILE} /data/local/tmp/adg-ca-copy/${AG_CERT_HASH}.0 chown -R 0:0 /data/local/tmp/adg-ca-copy set_context /apex/com.android.conscrypt/cacerts /data/local/tmp/adg-ca-copy @@ -65,6 +65,10 @@ if [ -d /apex/com.android.conscrypt/cacerts ]; then CERTS_NUM="$(ls -1 /data/local/tmp/adg-ca-copy | wc -l)" if [ "$CERTS_NUM" -gt 10 ]; then mount --bind /data/local/tmp/adg-ca-copy /apex/com.android.conscrypt/cacerts + for pid in 1 $(pgrep zygote) $(pgrep zygote64); do + nsenter --mount=/proc/${pid}/ns/mnt -- \ + /bin/mount --bind /data/local/tmp/adg-ca-copy /apex/com.android.conscrypt/cacerts + done else echo "Cancelling replacing CA storage due to safety" fi From a98b35693d2cdf214e6ae90c82e9922bf6ac8693 Mon Sep 17 00:00:00 2001 From: Sergey Fionov Date: Tue, 23 Jan 2024 10:02:55 +0200 Subject: [PATCH 2/3] skipci: Update update.json --- update.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/update.json b/update.json index adcfc46..db49af8 100644 --- a/update.json +++ b/update.json @@ -1,6 +1,6 @@ { - "version": "v2.0", - "versionCode": 35, - "zipUrl": "https://github.com/AdguardTeam/adguardcert/releases/download/v2.0/adguardcert-v2.0.zip", - "changelog": "https://github.com/AdguardTeam/adguardcert/releases/tag/v2.0" + "version": "v2.1", + "versionCode": 36, + "zipUrl": "https://github.com/AdguardTeam/adguardcert/releases/download/v2.1/adguardcert-v2.1.zip", + "changelog": "https://github.com/AdguardTeam/adguardcert/releases/tag/v2.1" } From e88bcdcb8e452e050d144390d650f0a8550a5067 Mon Sep 17 00:00:00 2001 From: Sergey Fionov Date: Tue, 23 Jan 2024 10:02:32 +0200 Subject: [PATCH 3/3] ci fixes --- .github/workflows/workflow.yml | 9 ++++++++- module/module.prop | 4 ++-- update.sh | 25 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) create mode 100755 update.sh diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index eb7fab9..07e319c 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -17,7 +17,6 @@ jobs: - name: build dist run: | - git submodule init && git submodule update ./dist.sh ls -la @@ -28,6 +27,7 @@ jobs: artifacts: "adguardcert-*.zip" token: ${{ secrets.GITHUB_TOKEN }} generateReleaseNotes: true + prerelease: ${{ contains(github.ref, '-') }} - name: write PR url if: github.event_name == 'pull_request' @@ -43,3 +43,10 @@ jobs: adguardcert-*.zip README.md pull_request_url.txt + + - name: update json + if: startsWith(github.ref, 'refs/tags/v') + run: | + ./update.sh + git push origin master + ls -la diff --git a/module/module.prop b/module/module.prop index e1a62db..7687b7d 100644 --- a/module/module.prop +++ b/module/module.prop @@ -1,7 +1,7 @@ id=adguardcert name=AdGuard Certificate -version=v2.1-beta1 -versionCode=35 +version=v2.1 +versionCode=36 author=AdGuard description=Moves AdGuard's root CA certificate from the user certificate store to the system certificate store. updateJson=https://raw.githubusercontent.com/AdguardTeam/adguardcert/master/update.json diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..6675b19 --- /dev/null +++ b/update.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +case version in +*-*) + ;; +*) + git checkout -B master origin/master + cat module/module.prop | ( + IFS="=" + while read k v; do + read $k <<< "$v" + done + cat << EOF > update.json +{ + "version": "$version", + "versionCode": $versionCode, + "zipUrl": "https://github.com/AdguardTeam/adguardcert/releases/download/$version/adguardcert-$version.zip", + "changelog": "https://github.com/AdguardTeam/adguardcert/releases/tag/$version" +} +EOF + ) + git add update.json + git commit -m "skipci: Update update.json" + ;; +esac