mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 10:05:23 +00:00
Update scripts
This commit is contained in:
parent
4c96d23f48
commit
623a879797
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -10,7 +10,8 @@
|
|||||||
*.cmd text eol=crlf
|
*.cmd text eol=crlf
|
||||||
|
|
||||||
# Denote all files that are truly binary and should not be modified.
|
# Denote all files that are truly binary and should not be modified.
|
||||||
binaries/** binary
|
zip_static/chromeos/** binary
|
||||||
|
uninstaller/chromeos/** binary
|
||||||
*.jar binary
|
*.jar binary
|
||||||
*.exe binary
|
*.exe binary
|
||||||
*.apk binary
|
*.apk binary
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,12 +7,10 @@ zip_static/arm/*
|
|||||||
zip_static/arm64/*
|
zip_static/arm64/*
|
||||||
zip_static/x86/*
|
zip_static/x86/*
|
||||||
zip_static/x64/*
|
zip_static/x64/*
|
||||||
zip_static/chromeos/*
|
|
||||||
uninstaller/arm/*
|
uninstaller/arm/*
|
||||||
uninstaller/arm64/*
|
uninstaller/arm64/*
|
||||||
uninstaller/x86/*
|
uninstaller/x86/*
|
||||||
uninstaller/x64/*
|
uninstaller/x64/*
|
||||||
uninstaller/chromeos/*
|
|
||||||
ziptools/zipadjust
|
ziptools/zipadjust
|
||||||
|
|
||||||
# Generated scripts
|
# Generated scripts
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
# Magisk
|
# Magisk
|
||||||
### Static binaries included:
|
|
||||||
* Busybox: http://forum.xda-developers.com/android/software-hacking/tool-busybox-flashable-archs-t3348543
|
|
||||||
|
|
||||||
### How to build Magisk
|
### How to build Magisk
|
||||||
1. Download and install NDK
|
1. Download and install NDK
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16
build.cmd
16
build.cmd
@ -95,7 +95,6 @@ EXIT /B %ERRORLEVEL%
|
|||||||
2>NUL RMDIR /S /Q zip_static\arm64
|
2>NUL RMDIR /S /Q zip_static\arm64
|
||||||
2>NUL RMDIR /S /Q zip_static\x86
|
2>NUL RMDIR /S /Q zip_static\x86
|
||||||
2>NUL RMDIR /S /Q zip_static\x64
|
2>NUL RMDIR /S /Q zip_static\x64
|
||||||
2>NUL RMDIR /S /Q zip_static\chromeos
|
|
||||||
2>NUL DEL zip_static\META-INF\com\google\android\update-binary
|
2>NUL DEL zip_static\META-INF\com\google\android\update-binary
|
||||||
2>NUL DEL zip_static\common\*.sh
|
2>NUL DEL zip_static\common\*.sh
|
||||||
2>NUL DEL zip_static\common\*.rc
|
2>NUL DEL zip_static\common\*.rc
|
||||||
@ -104,7 +103,6 @@ EXIT /B %ERRORLEVEL%
|
|||||||
2>NUL RMDIR /S /Q uninstaller\arm64
|
2>NUL RMDIR /S /Q uninstaller\arm64
|
||||||
2>NUL RMDIR /S /Q uninstaller\x86
|
2>NUL RMDIR /S /Q uninstaller\x86
|
||||||
2>NUL RMDIR /S /Q uninstaller\x64
|
2>NUL RMDIR /S /Q uninstaller\x64
|
||||||
2>NUL RMDIR /S /Q uninstaller\chromeos
|
|
||||||
EXIT /B 0
|
EXIT /B 0
|
||||||
|
|
||||||
:zip
|
:zip
|
||||||
@ -119,18 +117,13 @@ EXIT /B %ERRORLEVEL%
|
|||||||
ECHO ************************
|
ECHO ************************
|
||||||
ECHO * Adding version info
|
ECHO * Adding version info
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
powershell.exe -nologo -noprofile -command "(gc -Raw scripts\flash_script.sh) -replace 'MAGISK_VERSION_STUB', 'Magisk v%~1 Boot Image Patcher' | sc zip_static\META-INF\com\google\android\update-binary"
|
powershell.exe -nologo -noprofile -command "(gc -Raw scripts\flash_script.sh) -replace 'MAGISK_VERSION_STUB', 'Magisk v%~1 Installer' | sc zip_static\META-INF\com\google\android\update-binary"
|
||||||
powershell.exe -nologo -noprofile -command "(gc -Raw scripts\magic_mask.sh) -replace 'MAGISK_VERSION_STUB', 'setprop magisk.version \"%~1\"' | sc zip_static\common\magic_mask.sh"
|
rem powershell.exe -nologo -noprofile -command "(gc -Raw scripts\magic_mask.sh) -replace 'MAGISK_VERSION_STUB', 'setprop magisk.version \"%~1\"' | sc zip_static\common\magic_mask.sh"
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
ECHO * Copying Files
|
ECHO * Copying Files
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
COPY /Y scripts\custom_ramdisk_patch.sh zip_static\common\custom_ramdisk_patch.sh
|
COPY /Y scripts\custom_ramdisk_patch.sh zip_static\common\custom_ramdisk_patch.sh
|
||||||
COPY /Y scripts\init.magisk.rc zip_static\common\init.magisk.rc
|
COPY /Y scripts\init.magisk.rc zip_static\common\init.magisk.rc
|
||||||
COPY /Y binaries\busybox-arm zip_static\arm\busybox
|
|
||||||
COPY /Y binaries\busybox-arm64 zip_static\arm64\busybox
|
|
||||||
COPY /Y binaries\busybox-x86 zip_static\x86\busybox
|
|
||||||
COPY /Y binaries\busybox-x64 zip_static\x64\busybox
|
|
||||||
CALL :mkcp binaries\chromeos zip_static\chromeos
|
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
ECHO * Zipping Magisk v%~1
|
ECHO * Zipping Magisk v%~1
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
@ -149,11 +142,6 @@ EXIT /B %ERRORLEVEL%
|
|||||||
ECHO * Copying Files
|
ECHO * Copying Files
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
CALL :mkcp scripts\magisk_uninstaller.sh uninstaller\common
|
CALL :mkcp scripts\magisk_uninstaller.sh uninstaller\common
|
||||||
COPY /Y binaries\busybox-arm uninstaller\arm\busybox
|
|
||||||
COPY /Y binaries\busybox-arm64 uninstaller\arm64\busybox
|
|
||||||
COPY /Y binaries\busybox-x86 uninstaller\x86\busybox
|
|
||||||
COPY /Y binaries\busybox-x64 uninstaller\x64\busybox
|
|
||||||
CALL :mkcp binaries\chromeos uninstaller\chromeos
|
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
ECHO * Zipping uninstaller
|
ECHO * Zipping uninstaller
|
||||||
ECHO ************************
|
ECHO ************************
|
||||||
|
20
build.sh
20
build.sh
@ -26,7 +26,6 @@ cleanup() {
|
|||||||
rm -rfv zip_static/arm64
|
rm -rfv zip_static/arm64
|
||||||
rm -rfv zip_static/x86
|
rm -rfv zip_static/x86
|
||||||
rm -rfv zip_static/x64
|
rm -rfv zip_static/x64
|
||||||
rm -rfv zip_static/chromeos
|
|
||||||
rm -rfv zip_static/META-INF/com/google/android/update-binary
|
rm -rfv zip_static/META-INF/com/google/android/update-binary
|
||||||
rm -rfv zip_static/common/*.sh
|
rm -rfv zip_static/common/*.sh
|
||||||
rm -rfv zip_static/common/*.rc
|
rm -rfv zip_static/common/*.rc
|
||||||
@ -35,7 +34,6 @@ cleanup() {
|
|||||||
rm -rfv uninstaller/arm64
|
rm -rfv uninstaller/arm64
|
||||||
rm -rfv uninstaller/x86
|
rm -rfv uninstaller/x86
|
||||||
rm -rfv uninstaller/x64
|
rm -rfv uninstaller/x64
|
||||||
rm -rfv uninstaller/chromeos
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mkcp() {
|
mkcp() {
|
||||||
@ -76,22 +74,17 @@ build_bin() {
|
|||||||
|
|
||||||
zip_package() {
|
zip_package() {
|
||||||
[ -z "$1" ] && echo -e "! Missing version info\n" && usage
|
[ -z "$1" ] && echo -e "! Missing version info\n" && usage
|
||||||
[ ! -f "zip_static/arm/magiskboot" ] && error "Missing binaries!! Please run '$0 build' before zipping"
|
[ ! -f "zip_static/arm/magiskboot" ] && error "Missing binaries!! Please run '$ME build' before zipping"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
echo "* Adding version info"
|
echo "* Adding version info"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
sed "s/MAGISK_VERSION_STUB/Magisk v$1 Boot Image Patcher/g" scripts/flash_script.sh > zip_static/META-INF/com/google/android/update-binary
|
sed "s/MAGISK_VERSION_STUB/Magisk v$1 Installer/g" scripts/flash_script.sh > zip_static/META-INF/com/google/android/update-binary
|
||||||
sed "s/MAGISK_VERSION_STUB/setprop magisk.version \"$1\"/g" scripts/magic_mask.sh > zip_static/common/magic_mask.sh
|
# sed "s/MAGISK_VERSION_STUB/setprop magisk.version \"$1\"/g" scripts/magic_mask.sh > zip_static/common/magic_mask.sh
|
||||||
echo "************************"
|
echo "************************"
|
||||||
echo "* Copying files"
|
echo "* Copying files"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
cp -afv scripts/custom_ramdisk_patch.sh zip_static/common/custom_ramdisk_patch.sh
|
cp -afv scripts/custom_ramdisk_patch.sh zip_static/common/custom_ramdisk_patch.sh
|
||||||
cp -afv scripts/init.magisk.rc zip_static/common/init.magisk.rc
|
cp -afv scripts/init.magisk.rc zip_static/common/init.magisk.rc
|
||||||
cp -afv binaries/busybox-arm zip_static/arm/busybox
|
|
||||||
cp -afv binaries/busybox-arm64 zip_static/arm64/busybox
|
|
||||||
cp -afv binaries/busybox-x86 zip_static/x86/busybox
|
|
||||||
cp -afv binaries/busybox-x64 zip_static/x64/busybox
|
|
||||||
cp -afv binaries/chromeos/. zip_static/chromeos
|
|
||||||
echo "************************"
|
echo "************************"
|
||||||
echo "* Zipping Magisk v$1"
|
echo "* Zipping Magisk v$1"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
@ -110,15 +103,9 @@ zip_uninstaller() {
|
|||||||
echo "* Copying files"
|
echo "* Copying files"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
mkcp scripts/magisk_uninstaller.sh uninstaller/common
|
mkcp scripts/magisk_uninstaller.sh uninstaller/common
|
||||||
cp -afv binaries/busybox-arm uninstaller/arm/busybox
|
|
||||||
cp -afv binaries/busybox-arm64 uninstaller/arm64/busybox
|
|
||||||
cp -afv binaries/busybox-x86 uninstaller/x86/busybox
|
|
||||||
cp -afv binaries/busybox-x64 uninstaller/x64/busybox
|
|
||||||
cp -afv binaries/chromeos/. zip_static/chromeos
|
|
||||||
echo "************************"
|
echo "************************"
|
||||||
echo "* Zipping uninstaller"
|
echo "* Zipping uninstaller"
|
||||||
echo "************************"
|
echo "************************"
|
||||||
mkcp scripts/magisk_uninstaller.sh uninstaller/common
|
|
||||||
cd uninstaller
|
cd uninstaller
|
||||||
find . -type f -exec chmod 644 {} \;
|
find . -type f -exec chmod 644 {} \;
|
||||||
find . -type d -exec chmod 755 {} \;
|
find . -type d -exec chmod 755 {} \;
|
||||||
@ -155,7 +142,6 @@ sign_zip() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DIR="$(cd "$(dirname "$0")"; pwd)"
|
DIR="$(cd "$(dirname "$0")"; pwd)"
|
||||||
cd "$DIR"
|
|
||||||
DEBUG=
|
DEBUG=
|
||||||
CPUNUM=`getconf _NPROCESSORS_ONLN`
|
CPUNUM=`getconf _NPROCESSORS_ONLN`
|
||||||
ME=$0
|
ME=$0
|
||||||
|
@ -47,11 +47,10 @@ cpio_add 750 init.rc init.rc
|
|||||||
|
|
||||||
# sepolicy patches
|
# sepolicy patches
|
||||||
cpio_extract sepolicy sepolicy
|
cpio_extract sepolicy sepolicy
|
||||||
LD_LIBRARY_PATH=$SYSTEMLIB $MAGISKBIN/magiskpolicy --load sepolicy --save sepolicy --minimal
|
LD_LIBRARY_PATH=$SYSTEMLIB $MAGISKBIN/magisk magiskpolicy --load sepolicy --save sepolicy --minimal
|
||||||
cpio_add 644 sepolicy sepolicy
|
cpio_add 644 sepolicy sepolicy
|
||||||
|
|
||||||
# Add new items
|
# Add new items
|
||||||
cpio_mkdir 755 magisk
|
|
||||||
cpio_add 750 init.magisk.rc $MAGISKBIN/init.magisk.rc
|
cpio_add 750 init.magisk.rc $MAGISKBIN/init.magisk.rc
|
||||||
cpio_add 750 sbin/magic_mask.sh $MAGISKBIN/magic_mask.sh
|
cpio_add 755 sbin/magisk $MAGISKBIN/magisk
|
||||||
|
|
||||||
|
@ -190,9 +190,9 @@ cpio_mkdir() {
|
|||||||
# Detection
|
# Detection
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
ui_print "*****************************"
|
ui_print "************************"
|
||||||
ui_print "MAGISK_VERSION_STUB"
|
ui_print "* MAGISK_VERSION_STUB"
|
||||||
ui_print "*****************************"
|
ui_print "************************"
|
||||||
|
|
||||||
if [ ! -d "$COMMONDIR" ]; then
|
if [ ! -d "$COMMONDIR" ]; then
|
||||||
ui_print "! Failed: Unable to extract zip file!"
|
ui_print "! Failed: Unable to extract zip file!"
|
||||||
@ -256,36 +256,22 @@ fi
|
|||||||
# Environment
|
# Environment
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
# TODO: Environment
|
ui_print "- Constructing environment"
|
||||||
|
|
||||||
# ui_print "- Constructing environment"
|
is_mounted /data && MAGISKBIN=/data/magisk || MAGISKBIN=/cache/data_bin
|
||||||
|
|
||||||
# is_mounted /data && MAGISKBIN=/data/magisk || MAGISKBIN=/cache/data_bin
|
# Copy required files
|
||||||
|
rm -rf $MAGISKBIN 2>/dev/null
|
||||||
|
mkdir -p $MAGISKBIN
|
||||||
|
cp -af $BINDIR/. $COMMONDIR/magisk.apk $COMMONDIR/init.magisk.rc $COMMONDIR/custom_ramdisk_patch.sh $MAGISKBIN
|
||||||
|
|
||||||
# # Copy required files
|
chmod -R 755 $MAGISKBIN
|
||||||
# rm -rf $MAGISKBIN 2>/dev/null
|
chcon -h u:object_r:system_file:s0 $MAGISKBIN $MAGISKBIN/*
|
||||||
# mkdir -p $MAGISKBIN
|
|
||||||
# cp -af $BINDIR/busybox $BINDIR/magiskboot $BINDIR/magiskpolicy $COMMONDIR/magisk.apk \
|
|
||||||
# $COMMONDIR/init.magisk.rc $COMMONDIR/custom_ramdisk_patch.sh $COMMONDIR/magic_mask.sh $MAGISKBIN
|
|
||||||
# # Legacy support
|
|
||||||
# ln -sf /data/magisk/magiskpolicy $MAGISKBIN/sepolicy-inject
|
|
||||||
|
|
||||||
# chmod -R 755 $MAGISKBIN
|
|
||||||
# chcon -h u:object_r:system_file:s0 $MAGISKBIN $MAGISKBIN/*
|
|
||||||
|
|
||||||
# # Temporary busybox for installation
|
|
||||||
# rm -rf $TMPDIR/busybox 2>/dev/null
|
|
||||||
# mkdir -p $TMPDIR/busybox
|
|
||||||
# $BINDIR/busybox --install -s $TMPDIR/busybox
|
|
||||||
# rm -f $TMPDIR/busybox/su $TMPDIR/busybox/sh $TMPDIR/busybox/reboot
|
|
||||||
# PATH=$TMPDIR/busybox:$PATH
|
|
||||||
|
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
# Magisk Image
|
# Magisk Image
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
|
|
||||||
# TODO: Magisk Image
|
|
||||||
|
|
||||||
# Fix SuperSU.....
|
# Fix SuperSU.....
|
||||||
$BOOTMODE && $BINDIR/magiskpolicy --live "allow fsck * * *"
|
$BOOTMODE && $BINDIR/magiskpolicy --live "allow fsck * * *"
|
||||||
|
|
||||||
@ -311,7 +297,7 @@ fi
|
|||||||
MAGISKLOOP=$LOOPDEVICE
|
MAGISKLOOP=$LOOPDEVICE
|
||||||
|
|
||||||
# Core folders and scripts
|
# Core folders and scripts
|
||||||
mkdir -p $COREDIR/bin $COREDIR/props $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d 2>/dev/null
|
mkdir -p $COREDIR/props $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d 2>/dev/null
|
||||||
cp -af $COMMONDIR/magiskhide/. $COREDIR/magiskhide
|
cp -af $COMMONDIR/magiskhide/. $COREDIR/magiskhide
|
||||||
|
|
||||||
chmod -R 755 $COREDIR/bin $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d
|
chmod -R 755 $COREDIR/bin $COREDIR/magiskhide $COREDIR/post-fs-data.d $COREDIR/service.d
|
||||||
@ -450,12 +436,8 @@ else
|
|||||||
cpio_add 644 sepolicy sepolicy
|
cpio_add 644 sepolicy sepolicy
|
||||||
|
|
||||||
# Add new items
|
# Add new items
|
||||||
cpio_mkdir 755 magisk
|
|
||||||
|
|
||||||
[ ! -z $SHA1 ] && echo "# STOCKSHA1=$SHA1" >> $COMMONDIR/init.magisk.rc
|
[ ! -z $SHA1 ] && echo "# STOCKSHA1=$SHA1" >> $COMMONDIR/init.magisk.rc
|
||||||
cpio_add 750 init.magisk.rc $COMMONDIR/init.magisk.rc
|
cpio_add 750 init.magisk.rc $COMMONDIR/init.magisk.rc
|
||||||
|
|
||||||
# cpio_add 750 sbin/magic_mask.sh $COMMONDIR/magic_mask.sh
|
|
||||||
cpio_add 755 sbin/magisk $BINDIR/magisk
|
cpio_add 755 sbin/magisk $BINDIR/magisk
|
||||||
|
|
||||||
# Create ramdisk backups
|
# Create ramdisk backups
|
||||||
|
@ -44,11 +44,6 @@ find_boot_image() {
|
|||||||
# Environments
|
# Environments
|
||||||
# Set permissions
|
# Set permissions
|
||||||
chmod -R 755 $CHROMEDIR/futility $MAGISKBIN 2>/dev/null
|
chmod -R 755 $CHROMEDIR/futility $MAGISKBIN 2>/dev/null
|
||||||
# Temporary busybox for installation
|
|
||||||
mkdir -p $TMPDIR/busybox
|
|
||||||
$MAGISKBIN/busybox --install -s $TMPDIR/busybox
|
|
||||||
rm -f $TMPDIR/busybox/su $TMPDIR/busybox/sh $TMPDIR/busybox/reboot
|
|
||||||
PATH=$TMPDIR/busybox:$PATH
|
|
||||||
|
|
||||||
# Find the boot image
|
# Find the boot image
|
||||||
find_boot_image
|
find_boot_image
|
||||||
|
BIN
zip_static/chromeos/futility
Normal file
BIN
zip_static/chromeos/futility
Normal file
Binary file not shown.
BIN
zip_static/chromeos/kernel.keyblock
Normal file
BIN
zip_static/chromeos/kernel.keyblock
Normal file
Binary file not shown.
BIN
zip_static/chromeos/kernel_data_key.vbprivk
Normal file
BIN
zip_static/chromeos/kernel_data_key.vbprivk
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user