Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
f9ae4ab4
Commit
f9ae4ab4
authored
Mar 23, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add base Magisk module installer script
parent
8de03eef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
147 additions
and
1 deletion
+147
-1
module_installer.sh
scripts/module_installer.sh
+146
-0
util_functions.sh
scripts/util_functions.sh
+1
-1
No files found.
scripts/module_installer.sh
0 → 100644
View file @
f9ae4ab4
#!/sbin/sh
TMPDIR
=
/dev/tmp
MOUNTPATH
=
/dev/magisk_img
# Default permissions
umask
022
# Initial cleanup
rm
-rf
$TMPDIR
2>/dev/null
mkdir
-p
$TMPDIR
# echo before loading util_functions
ui_print
()
{
echo
"
$1
"
;
}
require_new_magisk
()
{
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
mount /data 2>/dev/null
# Load utility functions
if
[
-f
/data/adb/magisk/util_functions.sh
]
;
then
.
/data/adb/magisk/util_functions.sh
NVBASE
=
/data/adb
else
require_new_magisk
fi
# 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 common files
unzip
-oj
"
$ZIP
"
module.prop install.sh uninstall.sh
'common/*'
-d
$TMPDIR
>
&2
[
!
-f
$TMPDIR
/install.sh
]
&&
abort
"! Unable to extract zip file!"
# Load install script
.
$TMPDIR
/install.sh
if
imageless_magisk
;
then
$BOOTMODE
&&
MODDIRNAME
=
modules_update
||
MODDIRNAME
=
modules
MODULEROOT
=
$NVBASE
/
$MODDIRNAME
else
$BOOTMODE
&&
IMGNAME
=
magisk.img
||
IMGNAME
=
magisk_merge.img
IMG
=
$NVBASE
/
$IMGNAME
request_zip_size_check
"
$ZIP
"
mount_magisk_img
MODULEROOT
=
$MOUNTPATH
fi
MODID
=
`
grep_prop
id
$TMPDIR
/module.prop
`
MODPATH
=
$MODULEROOT
/
$MODID
print_modname
ui_print
"******************************"
ui_print
"Powered by Magisk (@topjohnwu)"
ui_print
"******************************"
##########################################################################################
# Install
##########################################################################################
# Create mod paths
rm
-rf
$MODPATH
2>/dev/null
mkdir
-p
$MODPATH
# Remove placeholder
rm
-f
$MODPATH
/system/placeholder 2>/dev/null
# Custom uninstaller
[
-f
$TMPDIR
/uninstall.sh
]
&&
cp
-af
$TMPDIR
/uninstall.sh
$MODPATH
/uninstall.sh
# Auto Mount
if
imageless_magisk
;
then
$SKIPMOUNT
&&
touch
$MODPATH
/skip_mount
else
$SKIPMOUNT
||
touch
$MODPATH
/auto_mount
fi
# prop files
$PROPFILE
&&
cp
-af
$TMPDIR
/system.prop
$MODPATH
/system.prop
# Module info
cp
-af
$TMPDIR
/module.prop
$MODPATH
/module.prop
if
$BOOTMODE
;
then
# Update info for Magisk Manager
mktouch
$NVBASE
/modules/
$MODID
/update
cp
-af
$TMPDIR
/module.prop
$NVBASE
/modules/
$MODID
/module.prop
fi
# post-fs-data mode scripts
$POSTFSDATA
&&
cp
-af
$TMPDIR
/post-fs-data.sh
$MODPATH
/post-fs-data.sh
# service mode scripts
$LATESTARTSERVICE
&&
cp
-af
$TMPDIR
/service.sh
$MODPATH
/service.sh
on_install
# Handle replace folders
for
TARGET
in
$REPLACE
;
do
mktouch
$MODPATH$TARGET
/.replace
done
ui_print
"- Setting permissions"
set_permissions
##########################################################################################
# Finalizing
##########################################################################################
cd
/
imageless_magisk
||
unmount_magisk_img
$BOOTMODE
||
recovery_cleanup
rm
-rf
$TMPDIR
$MOUNTPATH
ui_print
"- Done"
exit
0
scripts/util_functions.sh
View file @
f9ae4ab4
...
@@ -412,7 +412,7 @@ mount_magisk_img() {
...
@@ -412,7 +412,7 @@ mount_magisk_img() {
}
}
unmount_magisk_img
()
{
unmount_magisk_img
()
{
rm
-f
$MO
DULE
PATH
2>/dev/null
rm
-f
$MO
UNT
PATH
2>/dev/null
}
}
boot_actions
()
{
return
;
}
boot_actions
()
{
return
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment