balena-image-fs 7.5.0-build-add-find-partition-util-1371b9e1c72cba6acdb0d675593aaf02172d5d93-1 → 7.5.0-build-add-find-partition-util-f660bf87639aecd7fd665903a7ad84e97825293c-1
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/CHANGELOG.md +1 -1
- package/build/utils.d.ts +2 -2
- package/build/utils.js +8 -6
- package/build/utils.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file
|
|
|
4
4
|
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
|
|
5
5
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
-
## 7.5.0 - 2025-03-
|
|
7
|
+
## 7.5.0 - 2025-03-24
|
|
8
8
|
|
|
9
9
|
* Add function to find a partition by name/label [Ken Bannister]
|
|
10
10
|
|
package/build/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { FileDisk } from 'file-disk';
|
|
2
2
|
import type { GetPartitionsResult } from 'partitioninfo';
|
|
3
3
|
/**
|
|
4
4
|
* Summarizes the partition found by findPartition().
|
|
@@ -18,4 +18,4 @@ export type FindPartitionResult = {
|
|
|
18
18
|
* @returns A FindPartitionResult with the found index and name/label, or index
|
|
19
19
|
* of -1 if not found.
|
|
20
20
|
*/
|
|
21
|
-
export declare function findPartition(fileDisk:
|
|
21
|
+
export declare function findPartition(fileDisk: FileDisk, partitionInfo: GetPartitionsResult, names: string[]): Promise<FindPartitionResult | undefined>;
|
package/build/utils.js
CHANGED
|
@@ -15,12 +15,13 @@ const fsLabel_1 = require("./fsLabel");
|
|
|
15
15
|
async function findPartition(fileDisk, partitionInfo, names) {
|
|
16
16
|
const { partitions } = partitionInfo;
|
|
17
17
|
const isGPT = (partsInfo, _parts) => partsInfo.type === 'gpt';
|
|
18
|
-
const result = { index: -1, name: '' };
|
|
19
18
|
if (isGPT(partitionInfo, partitions)) {
|
|
20
19
|
const partition = partitions.find((gptPartInfo) => names.includes(gptPartInfo.name));
|
|
21
20
|
if (partition && typeof partition.index === 'number') {
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
return {
|
|
22
|
+
index: partition.index,
|
|
23
|
+
name: partition.name,
|
|
24
|
+
};
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
else {
|
|
@@ -29,8 +30,10 @@ async function findPartition(fileDisk, partitionInfo, names) {
|
|
|
29
30
|
try {
|
|
30
31
|
const label = await (0, fsLabel_1.getFsLabel)(fileDisk, partition);
|
|
31
32
|
if (names.includes(label) && typeof partition.index === 'number') {
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
return {
|
|
34
|
+
index: partition.index,
|
|
35
|
+
name: label,
|
|
36
|
+
};
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
catch (e) {
|
|
@@ -41,7 +44,6 @@ async function findPartition(fileDisk, partitionInfo, names) {
|
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
}
|
|
44
|
-
return result;
|
|
45
47
|
}
|
|
46
48
|
exports.findPartition = findPartition;
|
|
47
49
|
//# sourceMappingURL=utils.js.map
|
package/build/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../lib/utils.ts"],"names":[],"mappings":";;;AAMA,uCAAsD;AAWtD;;;;;;;;;GASG;AACI,KAAK,UAAU,aAAa,CAClC,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../lib/utils.ts"],"names":[],"mappings":";;;AAMA,uCAAsD;AAWtD;;;;;;;;;GASG;AACI,KAAK,UAAU,aAAa,CAClC,QAAkB,EAClB,aAAkC,EAClC,KAAe;IAEf,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC;IACrC,MAAM,KAAK,GAAG,CACb,SAA8B,EAC9B,MAA0C,EACf,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC;IAExD,IAAI,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,EAAE;QACrC,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,WAAyB,EAAE,EAAE,CAC/D,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAChC,CAAC;QACF,IAAI,SAAS,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,EAAE;YACrD,OAAO;gBACN,KAAK,EAAE,SAAS,CAAC,KAAK;gBACtB,IAAI,EAAE,SAAS,CAAC,IAAI;aACpB,CAAC;SACF;KACD;SAAM;QACN,MAAM;QACN,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YACnC,IAAI;gBACH,MAAM,KAAK,GAAG,MAAM,IAAA,oBAAU,EAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;gBACpD,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,EAAE;oBACjE,OAAO;wBACN,KAAK,EAAE,SAAS,CAAC,KAAK;wBACtB,IAAI,EAAE,KAAK;qBACX,CAAC;iBACF;aACD;YAAC,OAAO,CAAC,EAAE;gBACX,2CAA2C;gBAC3C,IAAI,CAAC,CAAC,CAAC,YAAY,uBAAa,CAAC,EAAE;oBAClC,MAAM,CAAC,CAAC;iBACR;aACD;SACD;KACD;AACF,CAAC;AAxCD,sCAwCC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "balena-image-fs",
|
|
3
|
-
"version": "7.5.0-build-add-find-partition-util-
|
|
3
|
+
"version": "7.5.0-build-add-find-partition-util-f660bf87639aecd7fd665903a7ad84e97825293c-1",
|
|
4
4
|
"description": "Image filesystem manipulation utilities",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"homepage": "https://github.com/balena-io-modules/balena-image-fs",
|
|
@@ -59,6 +59,6 @@
|
|
|
59
59
|
"node": ">=16"
|
|
60
60
|
},
|
|
61
61
|
"versionist": {
|
|
62
|
-
"publishedAt": "2025-03-
|
|
62
|
+
"publishedAt": "2025-03-24T10:29:32.479Z"
|
|
63
63
|
}
|
|
64
64
|
}
|