Skip to content

Commit

Permalink
De-bloater: update to latest magisk template
Browse files Browse the repository at this point in the history
It will now onwards de-bloat only some useless (for me) LOS and OOS apps. Everything related for Samsung Stock TW (kltexxx) are removed here.

Signed-off-by: sunilpaulmathew <sunil.kde@gmail.com>
  • Loading branch information
sunilpaulmathew committed Jun 20, 2019
1 parent 63485be commit c18e7ab
Show file tree
Hide file tree
Showing 9 changed files with 249 additions and 378 deletions.
114 changes: 56 additions & 58 deletions META-INF/com/google/android/update-binary
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,55 +1,47 @@
#!/sbin/sh
##########################################################################################
#
# Magisk Module Template Install Script
# by topjohnwu
#
##########################################################################################

TMPDIR=/dev/tmp
INSTALLER=$TMPDIR/install
# Always mount under tmp
MOUNTPATH=$TMPDIR/magisk_img
MOUNTPATH=/dev/magisk_img

# Default permissions
umask 022

# Initial cleanup
rm -rf $TMPDIR 2>/dev/null
mkdir -p $INSTALLER
mkdir -p $TMPDIR

# echo before loading util_functions
ui_print() { echo "$1"; }

require_new_magisk() {
ui_print "*******************************"
ui_print " Please install Magisk v17.0+! "
ui_print "*******************************"
ui_print "***********************************"
ui_print " Please install the latest Magisk! "
ui_print "***********************************"
exit 1
}

imageless_magisk() {
[ $MAGISK_VER_CODE -gt 18100 ]
return $?
}

##########################################################################################
# Environment
##########################################################################################

OUTFD=$2
ZIP=$3
ZIPFILE=$3

mount /data 2>/dev/null

# Load utility functions
if [ -f /data/adb/magisk/util_functions.sh ]; then
. /data/adb/magisk/util_functions.sh
elif [ -f /data/magisk/util_functions.sh ]; then
NVBASE=/data
. /data/magisk/util_functions.sh
NVBASE=/data/adb
else
require_new_magisk
fi

# Use alternative image if in BOOTMODE
$BOOTMODE && IMG=$NVBASE/magisk_merge.img

# Preperation for flashable zips
setup_flashable

Expand All @@ -59,9 +51,6 @@ 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

Expand All @@ -70,22 +59,28 @@ $BOOTMODE && boot_actions || recovery_actions
##########################################################################################

# Extract common files
unzip -o "$ZIP" module.prop config.sh 'common/*' -d $INSTALLER >&2
unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2

[ ! -f $INSTALLER/config.sh ] && abort "! Unable to extract zip file!"
# Load configurations
. $INSTALLER/config.sh
[ ! -f $TMPDIR/install.sh ] && abort "! Unable to extract zip file!"
# Load install script
. $TMPDIR/install.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
if imageless_magisk; then
$BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules
MODULEROOT=$NVBASE/$MODDIRNAME
else
$BOOTMODE && IMGNAME=magisk_merge.img || IMGNAME=magisk.img
IMG=$NVBASE/$IMGNAME
request_zip_size_check "$ZIPFILE"
mount_magisk_img
MODULEROOT=$MOUNTPATH
fi

MODID=`grep_prop id $TMPDIR/module.prop`
MODPATH=$MODULEROOT/$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 "******************************"
Expand All @@ -94,47 +89,51 @@ 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
on_install

# Remove placeholder
rm -f $MODPATH/system/placeholder 2>/dev/null

# Handle replace folders
for TARGET in $REPLACE; do
mktouch $MODPATH$TARGET/.replace
done
# Custom uninstaller
[ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh

# Auto Mount
$AUTOMOUNT && touch $MODPATH/auto_mount
if imageless_magisk; then
$SKIPMOUNT && touch $MODPATH/skip_mount
else
$SKIPMOUNT || touch $MODPATH/auto_mount
fi

# prop files
$PROPFILE && cp -af $INSTALLER/common/system.prop $MODPATH/system.prop
$PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop

# Module info
cp -af $INSTALLER/module.prop $MODPATH/module.prop
cp -af $TMPDIR/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
if imageless_magisk; then
mktouch $NVBASE/modules/$MODID/update
cp -af $TMPDIR/module.prop $NVBASE/modules/$MODID/module.prop
else
mktouch /sbin/.magisk/img/$MODID/update
cp -af $TMPDIR/module.prop /sbin/.magisk/img/$MODID/module.prop
fi
fi

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

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

# Handle replace folders
for TARGET in $REPLACE; do
mktouch $MODPATH$TARGET/.replace
done

ui_print "- Setting permissions"
set_permissions
Expand All @@ -143,11 +142,10 @@ set_permissions
# Finalizing
##########################################################################################

# Unmount magisk image and shrink if possible
unmount_magisk_img

cd /
imageless_magisk || unmount_magisk_img
$BOOTMODE || recovery_cleanup
rm -rf $TMPDIR
rm -rf $TMPDIR $MOUNTPATH

ui_print "- Done"
exit 0
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
## System-less De-bloater
#### Version: 2.0

### De-bloat a bunch of System Apps Systemless-ly
by <i>sunilpaulmathew@xda-developers.com</i>

<b>Version</b>: <i>2.1</i>

### De-bloat the following system apps on Lineage and Oxygen-OS
* /system/app/Duo
* /system/app/Music2
* /system/app/Photos
* /system/app/Videos
* /system/app/Jelly
* /system/app/crDroidMusic
* /system/app/Email
* /system/priv-app/FlipFlap
* /system/priv-app/Eleven

### Disclaimer

<b>This module is made for personal use only.</b>
8 changes: 5 additions & 3 deletions common/post-fs-data.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/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
# Do NOT assume where your module will be located.
# ALWAYS use $MODDIR if you need to know where this script
# and module is placed.
# This will make sure your module will still work
# 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
8 changes: 5 additions & 3 deletions common/service.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/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
# Do NOT assume where your module will be located.
# ALWAYS use $MODDIR if you need to know where this script
# and module is placed.
# This will make sure your module will still work
# 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
Loading

0 comments on commit c18e7ab

Please sign in to comment.