mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 16:07:39 +00:00
Provide external files to Magisk Manager with build script
This commit is contained in:
parent
24164c8580
commit
edaf8787d1
@ -68,11 +68,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
**SELinux** (`jni/selinux`)
|
**SELinux** (`jni/selinux`)
|
||||||
* Makefile for NDK: Copyright 2016-2017, John Wu (@topjohnwu)
|
* Makefile for NDK: Copyright 2016-2017, John Wu (@topjohnwu)
|
||||||
* It is maintained by many developers in SELinux project, copyright belongs to them
|
* Maintained by many developers in SELinux project
|
||||||
|
|
||||||
**ndk-compression** (`jni/ndk-compression`)
|
**ndk-compression** (`jni/ndk-compression`)
|
||||||
* Makefile for NDK: Copyright 2017, John Wu (@topjohnwu)
|
* Makefile for NDK: Copyright 2017, John Wu (@topjohnwu)
|
||||||
* Each library has its own copyright message in each directories
|
* Each library has its own copyright message in corresponding directories
|
||||||
|
|
||||||
|
**ndk-busybox** (`jni/busybox`)
|
||||||
|
* Makefile for NDK, generated by [ndk-busybox-kitchen](https://github.com/topjohnwu/ndk-busybox-kitchen): Copyright 2017, John Wu (@topjohnwu)
|
||||||
|
* Patches for NDK: Many contributors along the way, all placed in [osm0sis/android-busybox-ndk](https://github.com/osm0sis/android-busybox-ndk)
|
||||||
|
* The copyright message for busybox should be included in its own directory
|
||||||
|
|
||||||
**Others Not Mentioned**
|
**Others Not Mentioned**
|
||||||
* Copyright 2016-2017, John Wu (@topjohnwu)
|
* Copyright 2016-2017, John Wu (@topjohnwu)
|
||||||
|
39
build.py
39
build.py
@ -34,6 +34,7 @@ import multiprocessing
|
|||||||
import zipfile
|
import zipfile
|
||||||
import datetime
|
import datetime
|
||||||
import errno
|
import errno
|
||||||
|
import shutil
|
||||||
|
|
||||||
def silentremove(file):
|
def silentremove(file):
|
||||||
try:
|
try:
|
||||||
@ -45,7 +46,7 @@ def silentremove(file):
|
|||||||
def zip_with_msg(zipfile, source, target):
|
def zip_with_msg(zipfile, source, target):
|
||||||
if not os.path.exists(source):
|
if not os.path.exists(source):
|
||||||
error('{} does not exist! Try build \'binary\' and \'apk\' before zipping!'.format(source))
|
error('{} does not exist! Try build \'binary\' and \'apk\' before zipping!'.format(source))
|
||||||
print('zip: ' + source + ' -> ' + target)
|
print('zip: {} -> {}'.format(source, target))
|
||||||
zipfile.write(source, target)
|
zipfile.write(source, target)
|
||||||
|
|
||||||
def build_all(args):
|
def build_all(args):
|
||||||
@ -67,6 +68,34 @@ def build_binary(args):
|
|||||||
def build_apk(args):
|
def build_apk(args):
|
||||||
header('* Building Magisk Manager')
|
header('* Building Magisk Manager')
|
||||||
|
|
||||||
|
for arch in ['armeabi-v7a', 'x86']:
|
||||||
|
source = os.path.join('libs', arch, 'busybox')
|
||||||
|
target = os.path.join('MagiskManager', 'app', 'src', 'main', 'jniLibs', arch)
|
||||||
|
if not os.path.exists(source):
|
||||||
|
error('{} does not exist! Please build \'binary\' before building apk'.format(source))
|
||||||
|
if not os.path.exists(target):
|
||||||
|
os.makedirs(target)
|
||||||
|
target = os.path.join(target, 'libbusybox.so')
|
||||||
|
print('cp: {} -> {}'.format(source, target))
|
||||||
|
shutil.copyfile(source, target)
|
||||||
|
|
||||||
|
for key in ['public.certificate.x509.pem', 'private.key.pk8']:
|
||||||
|
source = os.path.join('ziptools', key)
|
||||||
|
target = os.path.join('MagiskManager', 'app', 'src', 'main', 'assets', key)
|
||||||
|
print('cp: {} -> {}'.format(source, target))
|
||||||
|
shutil.copyfile(source, target)
|
||||||
|
|
||||||
|
for script in ['magisk_uninstaller.sh', 'util_functions.sh']:
|
||||||
|
source = os.path.join('scripts', script)
|
||||||
|
target = os.path.join('MagiskManager', 'app', 'src', 'main', 'assets', script)
|
||||||
|
print('cp: {} -> {}'.format(source, target))
|
||||||
|
with open(source, 'r') as file:
|
||||||
|
script_cont = file.read().replace('MAGISK_VERSION_STUB', '')
|
||||||
|
with open(target, 'w') as file:
|
||||||
|
file.write(script_cont)
|
||||||
|
|
||||||
|
print('')
|
||||||
|
|
||||||
os.chdir('MagiskManager')
|
os.chdir('MagiskManager')
|
||||||
if args.release:
|
if args.release:
|
||||||
if not os.path.exists(os.path.join('..', 'release_signature.jks')):
|
if not os.path.exists(os.path.join('..', 'release_signature.jks')):
|
||||||
@ -114,8 +143,8 @@ def sign_adjust_zip(unsigned, output):
|
|||||||
|
|
||||||
# Unsigned->signed
|
# Unsigned->signed
|
||||||
proc = subprocess.run(['java', '-jar', os.path.join('ziptools', 'signapk.jar'),
|
proc = subprocess.run(['java', '-jar', os.path.join('ziptools', 'signapk.jar'),
|
||||||
os.path.join('ziptools', 'test.certificate.x509.pem'),
|
os.path.join('ziptools', 'public.certificate.x509.pem'),
|
||||||
os.path.join('ziptools', 'test.key.pk8'), unsigned, 'tmp_signed.zip'])
|
os.path.join('ziptools', 'private.key.pk8'), unsigned, 'tmp_signed.zip'])
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
error('First sign flashable zip failed!')
|
error('First sign flashable zip failed!')
|
||||||
|
|
||||||
@ -132,8 +161,8 @@ def sign_adjust_zip(unsigned, output):
|
|||||||
|
|
||||||
# Adjusted -> output
|
# Adjusted -> output
|
||||||
proc = subprocess.run(['java', '-jar', os.path.join('ziptools', 'minsignapk.jar'),
|
proc = subprocess.run(['java', '-jar', os.path.join('ziptools', 'minsignapk.jar'),
|
||||||
os.path.join('ziptools', 'test.certificate.x509.pem'),
|
os.path.join('ziptools', 'public.certificate.x509.pem'),
|
||||||
os.path.join('ziptools', 'test.key.pk8'), 'tmp_adjusted.zip', output])
|
os.path.join('ziptools', 'private.key.pk8'), 'tmp_adjusted.zip', output])
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
error('Second sign flashable zip failed!')
|
error('Second sign flashable zip failed!')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user