forked from indyblue/android_remote_control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminitether.js
32 lines (28 loc) · 942 Bytes
/
minitether.js
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
'option strict';
const { exec, execSync, fetchFile, fetchVersion } = require('./mini0'),
name = 'gnirehtet',
v = 'v2.2.1',
baseUrl = 'https://github.com/Genymobile/gnirehtet/releases',
vUrl = `${baseUrl}/latest`,
url = v => `${baseUrl}/download/${v}/gnirehtet-rust-linux64-${v}.zip`,
exp = module.exports = {};
async function main() {
//var cv = await fetchVersion(vUrl, defv);
var zipname = `${name}-${v}.zip`;
var file = await fetchFile(url(v), zipname);
execSync(`unzip -ojd ${name} ${zipname}`);
exp.onExit = () => {
try {
console.log('stopping reverse tether:');
execSync(`./${name} stop`, `./${name}/`);
execSync(`killall -qs SIGKILL gnirehtet`);
if (process.argv.indexOf('-u') > 0)
execSync(`./${name} uninstall`, `./${name}/`);
} catch (e) { }
};
exp.onExit();
exp.proc = exec(`./${name} run`, name, `./${name}/`, true);
}
main();
function fnServiceStuff() {
};