Skip to content

Commit

Permalink
revert a3ba884
Browse files Browse the repository at this point in the history
use old spawn method
  • Loading branch information
ChiChou committed Jun 18, 2024
1 parent 193e262 commit de39929
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 214 deletions.
146 changes: 0 additions & 146 deletions agent/SpringBoard.js

This file was deleted.

29 changes: 0 additions & 29 deletions agent/pkd.js

This file was deleted.

45 changes: 6 additions & 39 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,6 @@ export class BagBak extends EventEmitter {
if (!await directoryExists(parent))
throw new Error('Output directory does not exist');

const SpringBoardSession = await this.#device.attach('SpringBoard');
const SpringBoardScript = await SpringBoardSession.createScript(
await readFromPackage('agent', 'SpringBoard.js'));
await SpringBoardScript.load();

const pkdSession = await this.#device.attach('pkd');
const pkdScript = await pkdSession.createScript(
await readFromPackage('agent', 'pkd.js'));
await pkdScript.load();
await pkdScript.exports.skipPkdValidationFor(SpringBoardSession.pid);

const plugins = await SpringBoardScript.exports.plugins(this.#app.identifier);

// fist, copy directory to local
const remoteRoot = this.remote;
debug('remote root', remoteRoot);
Expand Down Expand Up @@ -200,34 +187,14 @@ export class BagBak extends EventEmitter {
return true;
}

// dump main executable
{
const { identifier } = this.#app;
const info = map.get(identifier);

if (info) {
const { dylibs, executable } = info;
const pid = await this.#device.spawn(identifier);
// await this.#device.resume(pid);
await task(pid, executable, dylibs);
}
}

// dump plugins
for (const pluginId of plugins) {
const info = map.get(pluginId);
if (!info) continue;
const pid = await SpringBoardScript.exports.run(pluginId);
const { dylibs, executable } = info;
await task(pid, executable, dylibs);
for (const { dylibs, executable } of map.values()) {
const mainExecutable = [remoteRoot, executable].join('/');
debug('main executable =>', mainExecutable);
const pid = await this.#device.spawn(mainExecutable);
debug('spawned pid =>', pid);
await task(pid, mainExecutable, dylibs);
}

await SpringBoardScript.unload();
await SpringBoardSession.detach();

await pkdScript.unload();
await pkdSession.detach();

return localRoot;
}

Expand Down

0 comments on commit de39929

Please sign in to comment.