Update scripts

This commit is contained in:
topjohnwu 2017-04-22 07:05:10 +08:00
parent 4c96d23f48
commit 623a879797
18 changed files with 21 additions and 74 deletions

3
.gitattributes vendored
View File

@ -10,7 +10,8 @@
*.cmd text eol=crlf
# Denote all files that are truly binary and should not be modified.
binaries/** binary
zip_static/chromeos/** binary
uninstaller/chromeos/** binary
*.jar binary
*.exe binary
*.apk binary

2
.gitignore vendored
View File

@ -7,12 +7,10 @@ zip_static/arm/*
zip_static/arm64/*
zip_static/x86/*
zip_static/x64/*
zip_static/chromeos/*
uninstaller/arm/*
uninstaller/arm64/*
uninstaller/x86/*
uninstaller/x64/*
uninstaller/chromeos/*
ziptools/zipadjust
# Generated scripts

View File

@ -1,6 +1,4 @@
# Magisk
### Static binaries included:
* Busybox: http://forum.xda-developers.com/android/software-hacking/tool-busybox-flashable-archs-t3348543
### How to build Magisk
1. Download and install NDK

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -95,7 +95,6 @@ EXIT /B %ERRORLEVEL%
2>NUL RMDIR /S /Q zip_static\arm64
2>NUL RMDIR /S /Q zip_static\x86
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\common\*.sh
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\x86
2>NUL RMDIR /S /Q uninstaller\x64
2>NUL RMDIR /S /Q uninstaller\chromeos
EXIT /B 0
:zip
@ -119,18 +117,13 @@ EXIT /B %ERRORLEVEL%
ECHO ************************
ECHO * Adding version info
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\magic_mask.sh) -replace 'MAGISK_VERSION_STUB', 'setprop magisk.version \"%~1\"' | sc zip_static\common\magic_mask.sh"
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"
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 * Copying Files
ECHO ************************
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 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 * Zipping Magisk v%~1
ECHO ************************
@ -149,11 +142,6 @@ EXIT /B %ERRORLEVEL%
ECHO * Copying Files
ECHO ************************
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 * Zipping uninstaller
ECHO ************************

View File

@ -26,7 +26,6 @@ cleanup() {
rm -rfv zip_static/arm64
rm -rfv zip_static/x86
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/common/*.sh
rm -rfv zip_static/common/*.rc
@ -35,7 +34,6 @@ cleanup() {
rm -rfv uninstaller/arm64
rm -rfv uninstaller/x86
rm -rfv uninstaller/x64
rm -rfv uninstaller/chromeos
}
mkcp() {
@ -76,22 +74,17 @@ build_bin() {
zip_package() {
[ -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 "* Adding version info"
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/setprop magisk.version \"$1\"/g" scripts/magic_mask.sh > zip_static/common/magic_mask.sh
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
echo "************************"
echo "* Copying files"
echo "************************"
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 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 "* Zipping Magisk v$1"
echo "************************"
@ -110,15 +103,9 @@ zip_uninstaller() {
echo "* Copying files"
echo "************************"
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 "* Zipping uninstaller"
echo "************************"
mkcp scripts/magisk_uninstaller.sh uninstaller/common
cd uninstaller
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
@ -155,7 +142,6 @@ sign_zip() {
}
DIR="$(cd "$(dirname "$0")"; pwd)"
cd "$DIR"
DEBUG=
CPUNUM=`getconf _NPROCESSORS_ONLN`
ME=$0

View File

@ -47,11 +47,10 @@ cpio_add 750 init.rc init.rc
# sepolicy patches
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
# Add new items
cpio_mkdir 755 magisk
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

View File

@ -190,9 +190,9 @@ cpio_mkdir() {
# Detection
##########################################################################################
ui_print "*****************************"
ui_print "MAGISK_VERSION_STUB"
ui_print "*****************************"
ui_print "************************"
ui_print "* MAGISK_VERSION_STUB"
ui_print "************************"
if [ ! -d "$COMMONDIR" ]; then
ui_print "! Failed: Unable to extract zip file!"
@ -256,36 +256,22 @@ fi
# 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
# rm -rf $MAGISKBIN 2>/dev/null
# 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
chmod -R 755 $MAGISKBIN
chcon -h u:object_r:system_file:s0 $MAGISKBIN $MAGISKBIN/*
##########################################################################################
# Magisk Image
##########################################################################################
# TODO: Magisk Image
# Fix SuperSU.....
$BOOTMODE && $BINDIR/magiskpolicy --live "allow fsck * * *"
@ -311,7 +297,7 @@ fi
MAGISKLOOP=$LOOPDEVICE
# 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
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
# Add new items
cpio_mkdir 755 magisk
[ ! -z $SHA1 ] && echo "# STOCKSHA1=$SHA1" >> $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
# Create ramdisk backups

View File

@ -44,11 +44,6 @@ find_boot_image() {
# Environments
# Set permissions
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_boot_image

Binary file not shown.

Binary file not shown.

Binary file not shown.