mirror of
https://github.com/Magisk-Modules-Repo/MagiskHidePropsConf.git
synced 2025-02-28 12:40:12 +00:00
Magisk Module Template 1500
This commit is contained in:
parent
f8c14b4455
commit
50249f660a
8
.gitattributes
vendored
Normal file
8
.gitattributes
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Declare files that will always have LF line endings on checkout.
|
||||||
|
META-INF/** text eol=lf
|
||||||
|
*.prop text eol=lf
|
||||||
|
*.sh text eol=lf
|
||||||
|
*.md text eol=lf
|
||||||
|
|
||||||
|
# Denote all files that are truly binary and should not be modified.
|
||||||
|
system/** binary
|
153
META-INF/com/google/android/update-binary
Executable file
153
META-INF/com/google/android/update-binary
Executable file
@ -0,0 +1,153 @@
|
|||||||
|
#!/sbin/sh
|
||||||
|
##########################################################################################
|
||||||
|
#
|
||||||
|
# Magisk Module Template Install Script
|
||||||
|
# by topjohnwu
|
||||||
|
#
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# Detect whether in boot mode
|
||||||
|
ps | grep zygote | grep -v grep >/dev/null && BOOTMODE=true || BOOTMODE=false
|
||||||
|
$BOOTMODE || ps -A 2>/dev/null | grep zygote | grep -v grep >/dev/null && BOOTMODE=true
|
||||||
|
|
||||||
|
TMPDIR=/dev/tmp
|
||||||
|
INSTALLER=$TMPDIR/install
|
||||||
|
MAGISKBIN=/data/adb/magisk
|
||||||
|
|
||||||
|
# Default permissions
|
||||||
|
umask 022
|
||||||
|
|
||||||
|
# Initial cleanup
|
||||||
|
rm -rf $TMPDIR 2>/dev/null
|
||||||
|
mkdir -p $INSTALLER
|
||||||
|
|
||||||
|
# echo before loading util_functions
|
||||||
|
ui_print() { echo "$1"; }
|
||||||
|
|
||||||
|
require_new_magisk() {
|
||||||
|
ui_print "*******************************"
|
||||||
|
ui_print " Please install Magisk v15.0+! "
|
||||||
|
ui_print "*******************************"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Environment
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
OUTFD=$2
|
||||||
|
ZIP=$3
|
||||||
|
|
||||||
|
mount /data 2>/dev/null
|
||||||
|
|
||||||
|
# Utility functions must exist
|
||||||
|
[ -f $MAGISKBIN/util_functions.sh ] || require_new_magisk
|
||||||
|
# Load utility fuctions
|
||||||
|
. $MAGISKBIN/util_functions.sh
|
||||||
|
|
||||||
|
# We can't alter magisk image live, use alternative image if required
|
||||||
|
$BOOTMODE && IMG=/data/adb/magisk_merge.img
|
||||||
|
# Always mount under tmp
|
||||||
|
MOUNTPATH=$TMPDIR/magisk_img
|
||||||
|
|
||||||
|
# Preperation for flashable zips
|
||||||
|
get_outfd
|
||||||
|
|
||||||
|
# Mount partitions
|
||||||
|
mount_partitions
|
||||||
|
|
||||||
|
# Detect version and architecture
|
||||||
|
api_level_arch_detect
|
||||||
|
|
||||||
|
# You can get the Android API version from $API, the CPU architecture from $ARCH
|
||||||
|
# Useful if you are creating Android version / platform dependent mods
|
||||||
|
|
||||||
|
# Setup busybox and binaries
|
||||||
|
$BOOTMODE && boot_actions || recovery_actions
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Preparation
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# Extract common files
|
||||||
|
unzip -o "$ZIP" module.prop config.sh 'common/*' -d $INSTALLER >&2
|
||||||
|
|
||||||
|
[ ! -f $INSTALLER/config.sh ] && abort "! Unable to extract zip file!"
|
||||||
|
# Load configurations
|
||||||
|
. $INSTALLER/config.sh
|
||||||
|
|
||||||
|
# Check the installed magisk version
|
||||||
|
MIN_VER=`grep_prop minMagisk $INSTALLER/module.prop`
|
||||||
|
[ ! -z $MAGISK_VER_CODE -a $MAGISK_VER_CODE -ge $MIN_VER ] || require_new_magisk
|
||||||
|
MODID=`grep_prop id $INSTALLER/module.prop`
|
||||||
|
MODPATH=$MOUNTPATH/$MODID
|
||||||
|
|
||||||
|
# Print mod name
|
||||||
|
print_modname
|
||||||
|
|
||||||
|
# Please leave this message in your flashable zip for credits :)
|
||||||
|
ui_print "******************************"
|
||||||
|
ui_print "Powered by Magisk (@topjohnwu)"
|
||||||
|
ui_print "******************************"
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Install
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# Get the variable reqSizeM. Use your own method to determine reqSizeM if needed
|
||||||
|
request_zip_size_check "$ZIP"
|
||||||
|
|
||||||
|
# This function will mount $IMG to $MOUNTPATH, and resize the image based on $reqSizeM
|
||||||
|
mount_magisk_img
|
||||||
|
|
||||||
|
# Create mod paths
|
||||||
|
rm -rf $MODPATH 2>/dev/null
|
||||||
|
mkdir -p $MODPATH
|
||||||
|
|
||||||
|
# Extract files to system. Use your own method if needed
|
||||||
|
ui_print "- Extracting module files"
|
||||||
|
unzip -o "$ZIP" 'system/*' -d $MODPATH >&2
|
||||||
|
|
||||||
|
# Remove placeholder
|
||||||
|
rm -f $MODPATH/system/placeholder 2>/dev/null
|
||||||
|
|
||||||
|
# Handle replace folders
|
||||||
|
for TARGET in $REPLACE; do
|
||||||
|
mktouch $MODPATH$TARGET/.replace
|
||||||
|
done
|
||||||
|
|
||||||
|
# Auto Mount
|
||||||
|
$AUTOMOUNT && touch $MODPATH/auto_mount
|
||||||
|
|
||||||
|
# prop files
|
||||||
|
$PROPFILE && cp -af $INSTALLER/common/system.prop $MODPATH/system.prop
|
||||||
|
|
||||||
|
# Module info
|
||||||
|
cp -af $INSTALLER/module.prop $MODPATH/module.prop
|
||||||
|
if $BOOTMODE; then
|
||||||
|
# Update info for Magisk Manager
|
||||||
|
mktouch /sbin/.core/img/$MODID/update
|
||||||
|
cp -af $INSTALLER/module.prop /sbin/.core/img/$MODID/module.prop
|
||||||
|
fi
|
||||||
|
|
||||||
|
# post-fs-data mode scripts
|
||||||
|
$POSTFSDATA && cp -af $INSTALLER/common/post-fs-data.sh $MODPATH/post-fs-data.sh
|
||||||
|
|
||||||
|
# service mode scripts
|
||||||
|
$LATESTARTSERVICE && cp -af $INSTALLER/common/service.sh $MODPATH/service.sh
|
||||||
|
|
||||||
|
ui_print "- Setting permissions"
|
||||||
|
set_permissions
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Finalizing
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# Unmount magisk image and shrink if possible
|
||||||
|
unmount_magisk_img
|
||||||
|
|
||||||
|
$BOOTMODE || recovery_cleanup
|
||||||
|
rm -rf $TMPDIR
|
||||||
|
|
||||||
|
ui_print "- Done"
|
||||||
|
exit 0
|
1
META-INF/com/google/android/updater-script
Normal file
1
META-INF/com/google/android/updater-script
Normal file
@ -0,0 +1 @@
|
|||||||
|
#MAGISK
|
@ -1 +1,9 @@
|
|||||||
# Magisk Module Template
|
# Magisk Module Template
|
||||||
|
|
||||||
|
This `README.md` will be shown in Magisk Manager. Place any information / changelog / notes you like.
|
||||||
|
|
||||||
|
**Please update `README.md` if you want to submit your module to the online repo!**
|
||||||
|
|
||||||
|
Github has its own online markdown editor with a preview feature, you can use it to update your `README.md`! If you need more advanced syntax, check the [Markdown Cheat Sheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).
|
||||||
|
|
||||||
|
For more information about modules and repos, please check the [official documentations](https://github.com/topjohnwu/Magisk/blob/master/docs/modules.md)
|
||||||
|
7
common/post-fs-data.sh
Normal file
7
common/post-fs-data.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/system/bin/sh
|
||||||
|
# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/...
|
||||||
|
# This will make your scripts compatible even if Magisk change its mount point in the future
|
||||||
|
MODDIR=${0%/*}
|
||||||
|
|
||||||
|
# This script will be executed in post-fs-data mode
|
||||||
|
# More info in the main Magisk thread
|
7
common/service.sh
Normal file
7
common/service.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/system/bin/sh
|
||||||
|
# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/...
|
||||||
|
# This will make your scripts compatible even if Magisk change its mount point in the future
|
||||||
|
MODDIR=${0%/*}
|
||||||
|
|
||||||
|
# This script will be executed in late_start service mode
|
||||||
|
# More info in the main Magisk thread
|
3
common/system.prop
Normal file
3
common/system.prop
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# This file will be read by resetprop
|
||||||
|
# Example: Change dpi
|
||||||
|
# ro.sf.lcd_density=320
|
99
config.sh
Normal file
99
config.sh
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
##########################################################################################
|
||||||
|
#
|
||||||
|
# Magisk Module Template Config Script
|
||||||
|
# by topjohnwu
|
||||||
|
#
|
||||||
|
##########################################################################################
|
||||||
|
##########################################################################################
|
||||||
|
#
|
||||||
|
# Instructions:
|
||||||
|
#
|
||||||
|
# 1. Place your files into system folder (delete the placeholder file)
|
||||||
|
# 2. Fill in your module's info into module.prop
|
||||||
|
# 3. Configure the settings in this file (config.sh)
|
||||||
|
# 4. If you need boot scripts, add them into common/post-fs-data.sh or common/service.sh
|
||||||
|
# 5. Add your additional or modified system properties into common/system.prop
|
||||||
|
#
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Configs
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# Set to true if you need to enable Magic Mount
|
||||||
|
# Most mods would like it to be enabled
|
||||||
|
AUTOMOUNT=true
|
||||||
|
|
||||||
|
# Set to true if you need to load system.prop
|
||||||
|
PROPFILE=false
|
||||||
|
|
||||||
|
# Set to true if you need post-fs-data script
|
||||||
|
POSTFSDATA=false
|
||||||
|
|
||||||
|
# Set to true if you need late_start service script
|
||||||
|
LATESTARTSERVICE=false
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Installation Message
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# Set what you want to show when installing your mod
|
||||||
|
|
||||||
|
print_modname() {
|
||||||
|
ui_print "*******************************"
|
||||||
|
ui_print " Magisk Module Template "
|
||||||
|
ui_print "*******************************"
|
||||||
|
}
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Replace list
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# List all directories you want to directly replace in the system
|
||||||
|
# Check the documentations for more info about how Magic Mount works, and why you need this
|
||||||
|
|
||||||
|
# This is an example
|
||||||
|
REPLACE="
|
||||||
|
/system/app/Youtube
|
||||||
|
/system/priv-app/SystemUI
|
||||||
|
/system/priv-app/Settings
|
||||||
|
/system/framework
|
||||||
|
"
|
||||||
|
|
||||||
|
# Construct your own list here, it will override the example above
|
||||||
|
# !DO NOT! remove this if you don't need to replace anything, leave it empty as it is now
|
||||||
|
REPLACE="
|
||||||
|
"
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Permissions
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
set_permissions() {
|
||||||
|
# Only some special files require specific permissions
|
||||||
|
# The default permissions should be good enough for most cases
|
||||||
|
|
||||||
|
# Here are some examples for the set_perm functions:
|
||||||
|
|
||||||
|
# set_perm_recursive <dirname> <owner> <group> <dirpermission> <filepermission> <contexts> (default: u:object_r:system_file:s0)
|
||||||
|
# set_perm_recursive $MODPATH/system/lib 0 0 0755 0644
|
||||||
|
|
||||||
|
# set_perm <filename> <owner> <group> <permission> <contexts> (default: u:object_r:system_file:s0)
|
||||||
|
# set_perm $MODPATH/system/bin/app_process32 0 2000 0755 u:object_r:zygote_exec:s0
|
||||||
|
# set_perm $MODPATH/system/bin/dex2oat 0 2000 0755 u:object_r:dex2oat_exec:s0
|
||||||
|
# set_perm $MODPATH/system/lib/libart.so 0 0 0644
|
||||||
|
|
||||||
|
# The following is default permissions, DO NOT remove
|
||||||
|
set_perm_recursive $MODPATH 0 0 0755 0644
|
||||||
|
}
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Custom Functions
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
# This file (config.sh) will be sourced by the main flash script after util_functions.sh
|
||||||
|
# If you need custom logic, please add them here as functions, and call these functions in
|
||||||
|
# update-binary. Refrain from adding code directly into update-binary, as it will make it
|
||||||
|
# difficult for you to migrate your modules to newer template versions.
|
||||||
|
# Make update-binary as clean as possible, try to only do function calls in it.
|
||||||
|
|
7
module.prop
Normal file
7
module.prop
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
id=template
|
||||||
|
name=Template Module
|
||||||
|
version=v1
|
||||||
|
versionCode=1
|
||||||
|
author=topjohnwu
|
||||||
|
description=A short description
|
||||||
|
minMagisk=1500
|
1
system/placeholder
Normal file
1
system/placeholder
Normal file
@ -0,0 +1 @@
|
|||||||
|
This file will be deleted in Magisk Manager, it is only a placeholder for git
|
Loading…
x
Reference in New Issue
Block a user