Skip to content

Commit 1abf130

Browse files
committed
Init
0 parents  commit 1abf130

File tree

6 files changed

+237
-0
lines changed

6 files changed

+237
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Kid
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
#!/sbin/sh
2+
3+
#################
4+
# Initialization
5+
#################
6+
7+
umask 022
8+
9+
# echo before loading util_functions
10+
ui_print() { echo "$1"; }
11+
12+
require_new_magisk() {
13+
ui_print "*******************************"
14+
ui_print " Please install Magisk v20.0+! "
15+
ui_print "*******************************"
16+
exit 1
17+
}
18+
19+
#########################
20+
# Load util_functions.sh
21+
#########################
22+
23+
OUTFD=$2
24+
ZIPFILE=$3
25+
26+
mount /data 2>/dev/null
27+
28+
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
29+
. /data/adb/magisk/util_functions.sh
30+
[ $MAGISK_VER_CODE -lt 20000 ] && require_new_magisk
31+
32+
if [ $MAGISK_VER_CODE -ge 20400 ]; then
33+
# New Magisk have complete installation logic within util_functions.sh
34+
install_module
35+
exit 0
36+
fi
37+
38+
#################
39+
# Legacy Support
40+
#################
41+
42+
TMPDIR=/dev/tmp
43+
PERSISTDIR=/sbin/.magisk/mirror/persist
44+
45+
is_legacy_script() {
46+
unzip -l "$ZIPFILE" install.sh | grep -q install.sh
47+
return $?
48+
}
49+
50+
print_modname() {
51+
local authlen len namelen pounds
52+
namelen=`echo -n $MODNAME | wc -c`
53+
authlen=$((`echo -n $MODAUTH | wc -c` + 3))
54+
[ $namelen -gt $authlen ] && len=$namelen || len=$authlen
55+
len=$((len + 2))
56+
pounds=$(printf "%${len}s" | tr ' ' '*')
57+
ui_print "$pounds"
58+
ui_print " $MODNAME "
59+
ui_print " by $MODAUTH "
60+
ui_print "$pounds"
61+
ui_print "*******************"
62+
ui_print " Powered by Magisk "
63+
ui_print "*******************"
64+
}
65+
66+
# Override abort as old scripts have some issues
67+
abort() {
68+
ui_print "$1"
69+
$BOOTMODE || recovery_cleanup
70+
[ -n $MODPATH ] && rm -rf $MODPATH
71+
rm -rf $TMPDIR
72+
exit 1
73+
}
74+
75+
rm -rf $TMPDIR 2>/dev/null
76+
mkdir -p $TMPDIR
77+
78+
# Preperation for flashable zips
79+
setup_flashable
80+
81+
# Mount partitions
82+
mount_partitions
83+
84+
# Detect version and architecture
85+
api_level_arch_detect
86+
87+
# Setup busybox and binaries
88+
$BOOTMODE && boot_actions || recovery_actions
89+
90+
##############
91+
# Preparation
92+
##############
93+
94+
# Extract prop file
95+
unzip -o "$ZIPFILE" module.prop -d $TMPDIR >&2
96+
[ ! -f $TMPDIR/module.prop ] && abort "! Unable to extract zip file!"
97+
98+
$BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules
99+
MODULEROOT=$NVBASE/$MODDIRNAME
100+
MODID=`grep_prop id $TMPDIR/module.prop`
101+
MODNAME=`grep_prop name $TMPDIR/module.prop`
102+
MODAUTH=`grep_prop author $TMPDIR/module.prop`
103+
MODPATH=$MODULEROOT/$MODID
104+
105+
# Create mod paths
106+
rm -rf $MODPATH 2>/dev/null
107+
mkdir -p $MODPATH
108+
109+
##########
110+
# Install
111+
##########
112+
113+
if is_legacy_script; then
114+
unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2
115+
116+
# Load install script
117+
. $TMPDIR/install.sh
118+
119+
# Callbacks
120+
print_modname
121+
on_install
122+
123+
# Custom uninstaller
124+
[ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh
125+
126+
# Skip mount
127+
$SKIPMOUNT && touch $MODPATH/skip_mount
128+
129+
# prop file
130+
$PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop
131+
132+
# Module info
133+
cp -af $TMPDIR/module.prop $MODPATH/module.prop
134+
135+
# post-fs-data scripts
136+
$POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh
137+
138+
# service scripts
139+
$LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh
140+
141+
ui_print "- Setting permissions"
142+
set_permissions
143+
else
144+
print_modname
145+
146+
unzip -o "$ZIPFILE" customize.sh -d $MODPATH >&2
147+
148+
if ! grep -q '^SKIPUNZIP=1$' $MODPATH/customize.sh 2>/dev/null; then
149+
ui_print "- Extracting module files"
150+
unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2
151+
152+
# Default permissions
153+
set_perm_recursive $MODPATH 0 0 0755 0644
154+
fi
155+
156+
# Load customization script
157+
[ -f $MODPATH/customize.sh ] && . $MODPATH/customize.sh
158+
fi
159+
160+
# Handle replace folders
161+
for TARGET in $REPLACE; do
162+
ui_print "- Replace target: $TARGET"
163+
mktouch $MODPATH$TARGET/.replace
164+
done
165+
166+
if $BOOTMODE; then
167+
# Update info for Magisk Manager
168+
mktouch $NVBASE/modules/$MODID/update
169+
cp -af $MODPATH/module.prop $NVBASE/modules/$MODID/module.prop
170+
fi
171+
172+
# Copy over custom sepolicy rules
173+
if [ -f $MODPATH/sepolicy.rule -a -e $PERSISTDIR ]; then
174+
ui_print "- Installing custom sepolicy patch"
175+
# Remove old recovery logs (which may be filling partition) to make room
176+
rm -f $PERSISTDIR/cache/recovery/*
177+
PERSISTMOD=$PERSISTDIR/magisk/$MODID
178+
mkdir -p $PERSISTMOD
179+
cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule || abort "! Insufficient partition size"
180+
fi
181+
182+
# Remove stuffs that don't belong to modules
183+
rm -rf \
184+
$MODPATH/system/placeholder $MODPATH/customize.sh \
185+
$MODPATH/README.md $MODPATH/.git* 2>/dev/null
186+
187+
#############
188+
# Finalizing
189+
#############
190+
191+
cd /
192+
$BOOTMODE || recovery_cleanup
193+
rm -rf $TMPDIR
194+
195+
ui_print "- Done"
196+
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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Magisk Blobmoji
2+
3+
Use [Noto Emoji font with Blobs enabled](https://github.com/C1710/blobmoji) on your Android device with [Magisk](https://github.com/topjohnwu/Magisk).
4+
5+
This module simply replaces `/system/fonts/NotoColorEmoji.ttf`, which may conflict with other modules or not take effect.
6+
7+
## Download
8+
9+
Via [GitHub releases](https://github.com/kidonng/magisk-blobmoji/releases/download/latest/magisk-blobmoji.zip).
10+
11+
## See also
12+
13+
- [Prior art](https://github.com/simonsmh/blobmoji)

module.prop

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
id=blobmoji
2+
name=Blobmoji
3+
version=Emoji 12
4+
versionCode=1
5+
author=Kid
6+
description=Noto Emoji font with Blobs enabled (https://github.com/kidonng/magisk-blobmoji)

system/fonts/NotoColorEmoji.ttf

7.92 MB
Binary file not shown.

0 commit comments

Comments
 (0)