Skip to content

Commit eefe194

Browse files
committed
Initial commit
1 parent c099803 commit eefe194

20 files changed

+444
-0
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Declare files that will always have LF line endings on checkout.
2+
META-INF/** text eol=lf
3+
*.prop text eol=lf
4+
*.sh text eol=lf
5+
*.md text eol=lf

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_builds/
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
#!/sbin/sh
2+
3+
TMPDIR=/dev/tmp
4+
MOUNTPATH=/dev/magisk_img
5+
6+
# Default permissions
7+
umask 022
8+
9+
# Initial cleanup
10+
rm -rf $TMPDIR 2>/dev/null
11+
mkdir -p $TMPDIR
12+
13+
# echo before loading util_functions
14+
ui_print() { echo "$1"; }
15+
16+
require_new_magisk() {
17+
ui_print "***********************************"
18+
ui_print " Please install the latest Magisk! "
19+
ui_print "***********************************"
20+
exit 1
21+
}
22+
23+
imageless_magisk() {
24+
[ $MAGISK_VER_CODE -gt 18100 ]
25+
return $?
26+
}
27+
28+
##########################################################################################
29+
# Environment
30+
##########################################################################################
31+
32+
OUTFD=$2
33+
ZIPFILE=$3
34+
35+
mount /data 2>/dev/null
36+
37+
# Load utility functions
38+
if [ -f /data/adb/magisk/util_functions.sh ]; then
39+
. /data/adb/magisk/util_functions.sh
40+
NVBASE=/data/adb
41+
else
42+
require_new_magisk
43+
fi
44+
45+
# Preperation for flashable zips
46+
setup_flashable
47+
48+
# Mount partitions
49+
mount_partitions
50+
51+
# Detect version and architecture
52+
api_level_arch_detect
53+
54+
# Setup busybox and binaries
55+
$BOOTMODE && boot_actions || recovery_actions
56+
57+
##########################################################################################
58+
# Preparation
59+
##########################################################################################
60+
61+
# Extract common files
62+
unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2
63+
64+
[ ! -f $TMPDIR/install.sh ] && abort "! Unable to extract zip file!"
65+
# Load install script
66+
. $TMPDIR/install.sh
67+
68+
if imageless_magisk; then
69+
$BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules
70+
MODULEROOT=$NVBASE/$MODDIRNAME
71+
else
72+
$BOOTMODE && IMGNAME=magisk_merge.img || IMGNAME=magisk.img
73+
IMG=$NVBASE/$IMGNAME
74+
request_zip_size_check "$ZIPFILE"
75+
mount_magisk_img
76+
MODULEROOT=$MOUNTPATH
77+
fi
78+
79+
MODID=`grep_prop id $TMPDIR/module.prop`
80+
MODPATH=$MODULEROOT/$MODID
81+
82+
print_modname
83+
84+
ui_print "******************************"
85+
ui_print "Powered by Magisk (@topjohnwu)"
86+
ui_print "******************************"
87+
88+
##########################################################################################
89+
# Install
90+
##########################################################################################
91+
92+
# Create mod paths
93+
rm -rf $MODPATH 2>/dev/null
94+
mkdir -p $MODPATH
95+
96+
on_install
97+
98+
# Remove placeholder
99+
rm -f $MODPATH/system/placeholder 2>/dev/null
100+
101+
# Custom uninstaller
102+
[ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh
103+
104+
# Auto Mount
105+
if imageless_magisk; then
106+
$SKIPMOUNT && touch $MODPATH/skip_mount
107+
else
108+
$SKIPMOUNT || touch $MODPATH/auto_mount
109+
fi
110+
111+
# prop files
112+
$PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop
113+
114+
# Module info
115+
cp -af $TMPDIR/module.prop $MODPATH/module.prop
116+
if $BOOTMODE; then
117+
# Update info for Magisk Manager
118+
if imageless_magisk; then
119+
mktouch $NVBASE/modules/$MODID/update
120+
cp -af $TMPDIR/module.prop $NVBASE/modules/$MODID/module.prop
121+
else
122+
mktouch /sbin/.magisk/img/$MODID/update
123+
cp -af $TMPDIR/module.prop /sbin/.magisk/img/$MODID/module.prop
124+
fi
125+
fi
126+
127+
# post-fs-data mode scripts
128+
$POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh
129+
130+
# service mode scripts
131+
$LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh
132+
133+
# Handle replace folders
134+
for TARGET in $REPLACE; do
135+
mktouch $MODPATH$TARGET/.replace
136+
done
137+
138+
ui_print "- Setting permissions"
139+
set_permissions
140+
141+
##########################################################################################
142+
# Finalizing
143+
##########################################################################################
144+
145+
cd /
146+
imageless_magisk || unmount_magisk_img
147+
$BOOTMODE || recovery_cleanup
148+
rm -rf $TMPDIR $MOUNTPATH
149+
150+
ui_print "- Done"
151+
exit 0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#MAGISK

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Magisk Revoke China Certificates
2+
==============
3+
This Magisk module revokes risky Chinese certificates in case of potential security and censorship problem
4+
5+
此面具模块用于吊销可疑和风险证书
6+
7+
## LEGAL
8+
9+
Copyright (C) 2019 Eason Chai (hackerchai)
10+
11+
This program is free software: you can redistribute it and/or modify
12+
it under the terms of the GNU General Public License as published by
13+
the Free Software Foundation, either version 3 of the License, or
14+
(at your option) any later version.
15+
16+
This program is distributed in the hope that it will be useful,
17+
but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
GNU General Public License for more details.
20+
21+
You should have received a copy of the GNU General Public License
22+
along with this program. If not, see <https://www.gnu.org/licenses/>.
23+
24+
## Releases
25+
26+
27+
## Usage
28+
* 安装
29+
- 下载最新的Release文件
30+
- 安装[Magisk](https://forum.xda-developers.com/apps/magisk)
31+
- 安装下载zip文件
32+
* 卸载
33+
- 直接在[Magisk Manager](https://magiskmanager.com)中卸载中模块,自动还原设置
34+
35+
## License
36+
* [GNU General Public License/GNU GPL v3](https://github.com/hackerchai/Magisk-Revoke-China-Certs/blob/master/LICENSE)
37+
38+
## Thanks
39+
* [Revoke China Certs - chengr28](https://github.com/chengr28/RevokeChinaCerts)
40+
* [Android: Certificates Blacklisting - phoeagon](https://github.com/phoeagon/RevokeChinaCerts/tree/master/Android)
41+

build.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
# Flashable Zip Builder
4+
# Copyright (C) 2018-2019, VR25 @ xda-developers
5+
# License: GPLv3+
6+
7+
echo
8+
get_value() { sed -n "s/^$1=//p" module.prop; }
9+
#set_value() { sed -i "s/^$1=.*/$1=$2/" module.prop; }
10+
get_file_value() {
11+
if [ -f "$1" ]; then
12+
cat $1 | grep $2 | sed "s|.*${2}||" | sed 's|"||g'
13+
fi
14+
}
15+
16+
VER=$(grep "version=" module.prop | sed 's|.*=||' | sed 's|-.*||')
17+
#VERCODE=$(grep "versionCode=" module.prop | sed 's|.*=||' | sed 's|-.*||')
18+
MODID=$(grep "id=" module.prop | sed 's|.*=||' | sed 's|-.*||')
19+
20+
cd ${0%/*} 2>/dev/null
21+
22+
#version=$(grep '\*\*.*\(.*\)\*\*' README.md \
23+
# | head -n1 | sed 's/\*\*//; s/ .*//')
24+
25+
#versionCode=$(grep '\*\*.*\(.*\)\*\*' README.md \
26+
# | head -n1 | sed 's/\*\*//g; s/.* //' | tr -d ')' | tr -d '(')
27+
28+
#set_value version $version
29+
#set_value versionCode $versionCode
30+
31+
mkdir -p _builds
32+
33+
if [[ ${1:-x} != f ]]; then
34+
echo "Downloading latest update-binary..."
35+
curl -#L https://raw.githubusercontent.com/topjohnwu/Magisk/master/scripts/module_installer.sh > _builds/update-binary \
36+
&& mv -f _builds/update-binary META-INF/com/google/android/
37+
fi
38+
39+
zip -r9v _builds/"$MODID-$VER".zip \
40+
* .gitattributes .gitignore \
41+
-x _\*/\* | grep .. && echo

common/post-fs-data.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/system/bin/sh
2+
# Do NOT assume where your module will be located.
3+
# ALWAYS use $MODDIR if you need to know where this script
4+
# and module is placed.
5+
# This will make sure your module will still work
6+
# if Magisk change its mount point in the future
7+
MODDIR=${0%/*}
8+
9+
# This script will be executed in post-fs-data mode

common/service.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/system/bin/sh
2+
# Do NOT assume where your module will be located.
3+
# ALWAYS use $MODDIR if you need to know where this script
4+
# and module is placed.
5+
# This will make sure your module will still work
6+
# if Magisk change its mount point in the future
7+
MODDIR=${0%/*}
8+
9+
# This script will be executed in late_start service mode

common/system.prop

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file will be read by resetprop
2+
# Example: Change dpi
3+
# ro.sf.lcd_density=320

0 commit comments

Comments
 (0)