@aepyornis/fastboot.ts 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -7
- package/mise.toml +2 -0
- package/package.json +2 -3
- package/src/flasher.ts +15 -0
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# fastboot.ts
|
|
2
2
|
|
|
3
3
|
```sh
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
npm install
|
|
5
|
+
npm run build
|
|
6
6
|
```
|
|
7
7
|
|
|
8
8
|
src/device.ts handles interfacing with WebUSB and implements fastboot protocol
|
|
@@ -10,11 +10,6 @@ pnpm run build
|
|
|
10
10
|
src/flasher.ts flashes zip image from a list of instructions
|
|
11
11
|
src/sparse.ts sparse image utilities Copyright (c) 2021 Danny Lin <danny@kdrag0n.dev>
|
|
12
12
|
|
|
13
|
-
TODO
|
|
14
|
-
|
|
15
|
-
--apply-vbmeta
|
|
16
|
-
repack_ramdisk ?
|
|
17
|
-
|
|
18
13
|
```js
|
|
19
14
|
import { FastbootClient, FashbootFlasher } from "@aepyornis/fastboot.ts"
|
|
20
15
|
|
package/mise.toml
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aepyornis/fastboot.ts",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "Fastboot using WebUSB",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"keywords": [],
|
|
11
11
|
"author": "Ziggy, Calyx Institute",
|
|
12
12
|
"license": "MIT",
|
|
13
|
-
"packageManager": "pnpm@10.8.0",
|
|
14
13
|
"devDependencies": {
|
|
15
14
|
"@eslint/js": "^9.24.0",
|
|
16
15
|
"@types/w3c-web-usb": "^1.0.10",
|
package/src/flasher.ts
CHANGED
|
@@ -101,6 +101,21 @@ export class FastbootFlasher {
|
|
|
101
101
|
this.reader = new ZipReader(new BlobReader(blob))
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
// parses and runs flash-all.sh. it ignores all shell commands
|
|
105
|
+
// except fastboot or sleep
|
|
106
|
+
async runFlashAll() {
|
|
107
|
+
const entries: Entry[] = await this.reader.getEntries()
|
|
108
|
+
const flashAllSh = await getEntry(entries, "flash-all.sh").getData(new TextWriter())
|
|
109
|
+
|
|
110
|
+
const instructions = flashAllSh
|
|
111
|
+
.split("\n")
|
|
112
|
+
.map((x) => x.trim())
|
|
113
|
+
.filter(x => (x.slice(0,9) === "fastboot " || x.slice(0,5) === "sleep"))
|
|
114
|
+
.join("\n")
|
|
115
|
+
|
|
116
|
+
return this.run(instructions)
|
|
117
|
+
}
|
|
118
|
+
|
|
104
119
|
async run(instructions: text) {
|
|
105
120
|
const entries: Entry[] = await this.reader.getEntries() // io with factory.zip
|
|
106
121
|
const commands: Instruction[] = parseInstructions(instructions)
|