Skip to content

Commit 071f7d7

Browse files
committed
feat(sh): 🔥 #45 Compatible with AdGuard
1. Compatible with AdGuard, Skip AdGuard Intermediate CA
1 parent 5981f41 commit 071f7d7

File tree

4 files changed

+37
-6
lines changed

4 files changed

+37
-6
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
- feat(sh): :fire: #45 Compatible with AdGuard
2+
- 1. Compatible with AdGuard, Skip "AdGuard Intermediate CA"
3+
---
14
- chore(UI): :tada: Adapt to dark mode
25
---
36
- Merge pull request #41 from SafaSafari/iyue

module.prop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id=MoveCertificate
22
name=MoveCertificate
3-
version=v1.5.4
4-
versionCode=20
3+
version=v1.5.5
4+
versionCode=22
55
author=Contributors
66
description=Supports magiskv20.4+/kernelsu/APatch Android 7-15 move certificates
77
updateJson=https://pfile.ys1231.cn/modules/MoveCertificate/update.json

post-fs-data.sh

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,31 @@ set_selinux_context(){
7272
fi
7373
}
7474

75+
compatible(){
76+
# compatible adguard or other
77+
# Hash 47ec1af8 is for "AdGuard Intermediate CA" intermediate.
78+
print_log "Compatible adguard"
79+
cert_dir="$MODDIR/certificates"
80+
print_log "Running compatibility cleanup for potentially conflicting certificates."
81+
82+
# Remove by filename pattern (hash: 47ec1af8.*)
83+
rm -f "$cert_dir"/47ec1af8.*
84+
print_log "Removed files matching '47ec1af8.*'."
85+
86+
# Remove by content string "Guard Personal Intermediate"
87+
for cert_file in "$cert_dir"/*; do
88+
# Ensure it is a file before trying to read it
89+
if [ -f "$cert_file" ]; then
90+
# Use grep -q for a silent, efficient check
91+
if grep -q "Guard Personal Intermediate" "$cert_file"; then
92+
print_log "Removing file containing 'Guard Personal Intermediate': $(basename "$cert_file")"
93+
rm -f "$cert_file"
94+
fi
95+
fi
96+
done
97+
print_log "Compatibility cleanup status:$?"
98+
}
99+
75100
# Android version <= 13 execute
76101
if [ "$sdk_version_number" -le 33 ]; then
77102
print_log "start move cert !"
@@ -83,11 +108,12 @@ if [ "$sdk_version_number" -le 33 ]; then
83108
# Android 13 or lower versions perform
84109
move_custom_cert
85110
fix_user_permissions
111+
compatible
86112

87113
selinux_context=$(ls -Zd /system/etc/security/cacerts | awk '{print $1}')
88114
mount -t tmpfs tmpfs /system/etc/security/cacerts
89115
print_log "mount /system/etc/security/cacerts status:$?"
90-
116+
91117
cp -f $MODDIR/certificates/* /system/etc/security/cacerts
92118
print_log "Install /system/etc/security/cacerts status:$?"
93119
fix_system_permissions
@@ -113,6 +139,7 @@ else
113139
move_custom_cert
114140
fix_user_permissions
115141
fix_system_permissions14 $MODDIR/certificates
142+
compatible
116143

117144
print_log "find system conscrypt directory"
118145
apex_dir=$(find /apex -type d -name "com.android.conscrypt@*")
@@ -125,6 +152,7 @@ else
125152
mount -o bind $MODDIR/certificates $apex_dir/cacerts
126153
for pid in 1 $(pgrep zygote) $(pgrep zygote64); do
127154
nsenter --mount=/proc/${pid}/ns/mnt -- mount --bind $MODDIR/certificates /apex/com.android.conscrypt/cacerts
155+
nsenter --mount=/proc/${pid}/ns/mnt -- mount --bind $MODDIR/certificates $apex_dir/cacerts
128156
done
129157
print_log "mount bind $MODDIR/certificates $apex_dir/cacerts status:$?"
130158
print_log "certificates installed"

update.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"versionCode": 20,
3-
"version": "v1.5.4",
4-
"zipUrl": "https://pfile.ys1231.cn/modules/MoveCertificate/MoveCertificate-v1.5.4.zip",
2+
"versionCode": 21,
3+
"version": "v1.5.5",
4+
"zipUrl": "https://pfile.ys1231.cn/modules/MoveCertificate/MoveCertificate-v1.5.5.zip",
55
"changelog": "https://pfile.ys1231.cn/modules/MoveCertificate/changelog.md"
66
}

0 commit comments

Comments
 (0)