-
Notifications
You must be signed in to change notification settings - Fork 19
/
install.py
executable file
·35 lines (25 loc) · 1.15 KB
/
install.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#! /usr/bin/python
import os, sys, traceback, subprocess
DIR=os.path.abspath(os.path.dirname(__file__))
ADB=os.getenv('ADB', 'adb')
APE_ROOT='/data/local/tmp/'
def run_cmd(*args):
print('Run cmd: ' + (' '.join(*args)))
subprocess.check_call(*args)
if __name__ == '__main__':
try:
SERIAL=os.getenv('SERIAL')
if SERIAL:
run_cmd([ADB, '-s', SERIAL, 'push', os.path.join(DIR, 'ape.jar'), APE_ROOT])
run_cmd([ADB, '-s', SERIAL, 'push', os.path.join(DIR, 'ape'), APE_ROOT])
run_cmd([ADB, '-s', SERIAL, 'shell', 'chmod', '777', APE_ROOT + '/ape'])
elif len(sys.argv) > 1 and sys.argv[1] == '-d':
run_cmd([ADB, '-d', 'push', os.path.join(DIR, 'ape.jar'), APE_ROOT])
run_cmd([ADB, '-d', 'push', os.path.join(DIR, 'ape'), APE_ROOT])
run_cmd([ADB, '-d', 'shell', 'chmod', '777', APE_ROOT + '/ape'])
else:
run_cmd([ADB, 'push', os.path.join(DIR, 'ape.jar'), APE_ROOT])
run_cmd([ADB, 'push', os.path.join(DIR, 'ape'), APE_ROOT])
run_cmd([ADB, 'shell', 'chmod', '777', APE_ROOT + '/ape'])
except:
traceback.print_exc()