Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
soralis0912 committed Apr 7, 2022
0 parents commit cf378f8
Show file tree
Hide file tree
Showing 14 changed files with 323 additions and 0 deletions.
196 changes: 196 additions & 0 deletions META-INF/com/google/android/update-binary
@@ -0,0 +1,196 @@
#!/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.0+! "
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 20000 ] && require_new_magisk

if [ $MAGISK_VER_CODE -ge 20400 ]; then
# New Magisk have complete installation logic within util_functions.sh
install_module
exit 0
fi

#################
# Legacy Support
#################

TMPDIR=/dev/tmp
PERSISTDIR=/sbin/.magisk/mirror/persist

is_legacy_script() {
unzip -l "$ZIPFILE" install.sh | grep -q install.sh
return $?
}

print_modname() {
local authlen len namelen pounds
namelen=`echo -n $MODNAME | wc -c`
authlen=$((`echo -n $MODAUTH | wc -c` + 3))
[ $namelen -gt $authlen ] && len=$namelen || len=$authlen
len=$((len + 2))
pounds=$(printf "%${len}s" | tr ' ' '*')
ui_print "$pounds"
ui_print " $MODNAME "
ui_print " by $MODAUTH "
ui_print "$pounds"
ui_print "*******************"
ui_print " Powered by Magisk "
ui_print "*******************"
}

# Override abort as old scripts have some issues
abort() {
ui_print "$1"
$BOOTMODE || recovery_cleanup
[ -n $MODPATH ] && rm -rf $MODPATH
rm -rf $TMPDIR
exit 1
}

rm -rf $TMPDIR 2>/dev/null
mkdir -p $TMPDIR

# Preperation for flashable zips
setup_flashable

# Mount partitions
mount_partitions

# Detect version and architecture
api_level_arch_detect

# Setup busybox and binaries
$BOOTMODE && boot_actions || recovery_actions

##############
# Preparation
##############

# Extract prop file
unzip -o "$ZIPFILE" module.prop -d $TMPDIR >&2
[ ! -f $TMPDIR/module.prop ] && abort "! Unable to extract zip file!"

$BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules
MODULEROOT=$NVBASE/$MODDIRNAME
MODID=`grep_prop id $TMPDIR/module.prop`
MODNAME=`grep_prop name $TMPDIR/module.prop`
MODAUTH=`grep_prop author $TMPDIR/module.prop`
MODPATH=$MODULEROOT/$MODID

# Create mod paths
rm -rf $MODPATH 2>/dev/null
mkdir -p $MODPATH

##########
# Install
##########

if is_legacy_script; then
unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2

# Load install script
. $TMPDIR/install.sh

# Callbacks
print_modname
on_install

# Custom uninstaller
[ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh

# Skip mount
$SKIPMOUNT && touch $MODPATH/skip_mount

# prop file
$PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop

# Module info
cp -af $TMPDIR/module.prop $MODPATH/module.prop

# post-fs-data scripts
$POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh

# service scripts
$LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh

ui_print "- Setting permissions"
set_permissions
else
print_modname

unzip -o "$ZIPFILE" customize.sh -d $MODPATH >&2

if ! grep -q '^SKIPUNZIP=1$' $MODPATH/customize.sh 2>/dev/null; then
ui_print "- Extracting module files"
unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2

# Default permissions
set_perm_recursive $MODPATH 0 0 0755 0644
fi

# Load customization script
[ -f $MODPATH/customize.sh ] && . $MODPATH/customize.sh
fi

# Handle replace folders
for TARGET in $REPLACE; do
ui_print "- Replace target: $TARGET"
mktouch $MODPATH$TARGET/.replace
done

if $BOOTMODE; then
# Update info for Magisk Manager
mktouch $NVBASE/modules/$MODID/update
cp -af $MODPATH/module.prop $NVBASE/modules/$MODID/module.prop
fi

# Copy over custom sepolicy rules
if [ -f $MODPATH/sepolicy.rule -a -e $PERSISTDIR ]; then
ui_print "- Installing custom sepolicy patch"
# Remove old recovery logs (which may be filling partition) to make room
rm -f $PERSISTDIR/cache/recovery/*
PERSISTMOD=$PERSISTDIR/magisk/$MODID
mkdir -p $PERSISTMOD
cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule || abort "! Insufficient partition size"
fi

# Remove stuffs that don't belong to modules
rm -rf \
$MODPATH/system/placeholder $MODPATH/customize.sh \
$MODPATH/README.md $MODPATH/.git* 2>/dev/null

#############
# Finalizing
#############

cd /
$BOOTMODE || recovery_cleanup
rm -rf $TMPDIR

ui_print "- Done"
exit 0
1 change: 1 addition & 0 deletions META-INF/com/google/android/updater-script
@@ -0,0 +1 @@
#MAGISK
2 changes: 2 additions & 0 deletions customize.sh
@@ -0,0 +1,2 @@
REPLACE="
"
6 changes: 6 additions & 0 deletions module.prop
@@ -0,0 +1,6 @@
id=vili-jp-felica
name=Patch for Xiaomi 11T Pro Japan
version=v1
versionCode=1
author=soralis0912
description=Xiaomi 11T Pro 日本版Felica有効化パッチ
19 changes: 19 additions & 0 deletions system.prop
@@ -0,0 +1,19 @@
ro.product.model=2107113SR
ro.product.name=vili_jp

ro.product.system.model=missi system image for arm64
ro.product.system.name=missi

ro.product.vendor.model=2107113SR
ro.product.vendor.name=vili_jp

ro.product.product.model=2107113SR
ro.product.product.name=vili_jp

ro.product.odm.model=2107113SR
ro.product.odm.name=vili_jp

ro.product.system_ext.model=missi system image for arm64
ro.product.system_ext.name=missi

ro.vendor.se.type=eSE,HCE,UICC
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
14 changes: 14 additions & 0 deletions system/etc/felica/common.cfg
@@ -0,0 +1,14 @@
00000001,100008
00000002,000068
00000003,com.android.chrome
00000004,com.android.vending
00000005,1
00000010,1
00000011,eSE1
02020001,3031333030320000000000
02030001,0
02030002,0
02030003,intent:#Intent;action=android.settings.NFC_SETTINGS;end
00000012,1
00000013,1
00000016,0001
29 changes: 29 additions & 0 deletions system/etc/felica/mfm.cfg
@@ -0,0 +1,29 @@
02030201,3000
02030202,0
02030304,30000
02030306,60000
02030308,60000
02030309,D78810210439CEACCCD1E56E0BF8D09F
0203030A,https://ms.fnopf.jp/ws/trouble
0203030B,30000
0203030C,Asia/Tokyo
02030311,0001
02030312,30000
02030313,60000
02030314,60000
02030316,30000
02030319,30000
0203031A,30000
02030501,0
02030601,com.felicanetworks.mfs
02030602,com.felicanetworks.mfs.MobileFeliCaSettings
02030607,com.felicanetworks.mfm.START
02030702,10000
02030703,10000
02030704,10000
02030801,MIIB4DCB2BYEMDAwMRYCMDIWBjAwMDAwMBYMU04wMDAwMDAxMzA5FgQwMDAwMCoYEzIwMTAwNzA3MDAwMDAwKzA5MDAYEzIwOTkxMjMxMDAwMDAwKzA5MDAWCFNWMDAwMDAzFgAweDASFgQwMDAxBAowCBYGMTAwMDA4MDQWBDAwMDIELDAqBAIAAQQCAAMwIDAeFgRGRkZGMBYwFBYIMDAwMDAwMDAWCEZGRkZGRkZGMCwWBDAwMDQEJDAiBCC+Udv0/sib0yhGRXsTtzAIdq9VlNKHTe4CaQSWWuSmywOCAQEATm92Zj58RmAyhXILb1TP2fh/1ZIn624h22hQHdJGxG+oIJc47fo3sJukbXLip6I4VhELwFQmLhmhdj6uryHYDNE+szKJoBB2mctd0F7GJwuENm6AUhsYIYV0xb7Lt7wybb4RUkmiZPd6tMJUfmAJVEa6IuHYcXl+vz/Lpu+2fmIq3I9dI9uEHDDQb0QiP5xCRK5YHSk9ncCZngf/ZOP0/UVFzJsrOlgBLtna+sbZpmAIWNs3E9Rg6a6YirCDOpuZ7FpSc1WyqgFgqkTCEf4QFPMQsww1Nq3ptKB74zpitPbcP2qNyGIc5Eiim97UfN4xOqi3tCsY5ulAUZfMtKft4g==
02030906,1
02030A01,com.felicanetworks.mfm.main
02030A02,com.felicanetworks.mfm.main.ServiceListActivity
02030A03,BE51DBF4FEC89BD32846457B13B7300876AF5594D2874DEE026904965AE4A6CB
02030A04,market://details?id=com.felicanetworks.mfm.main
14 changes: 14 additions & 0 deletions system/etc/felica/mfs.cfg
@@ -0,0 +1,14 @@
02020201,3000
02020202,0
0202030A,https://ms.fnopf.jp/ws/trouble
0202030B,30000
0202030C,Asia/Tokyo
0202030D,https://int.fnrs.jp/ios/auth?cid=C0
0202030E,60000
0202030F,00
02020315,60000
02020316,30000
02020317,720
02020501,0
02020801,0
02020A04,market://details?id=com.felicanetworks.mfm.main
21 changes: 21 additions & 0 deletions system/etc/permissions/android.hardware.nfc.ese.xml
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- This feature indicates that the device supports eSE-based NFC card
emulation -->
<permissions>
<feature name="android.hardware.nfc.ese" />
</permissions>
21 changes: 21 additions & 0 deletions system/etc/permissions/android.hardware.se.omapi.ese.xml
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- This feature indicates that the device supports The device supports
Open Mobile API capable ESE-based secure elements-->
<permissions>
<feature name="android.hardware.se.omapi.ese" />
</permissions>

0 comments on commit cf378f8

Please sign in to comment.