Skip to content

Commit

Permalink
FF
Browse files Browse the repository at this point in the history
  • Loading branch information
aethernet committed May 22, 2023
1 parent 380e7c2 commit c257dbd
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 529 deletions.
197 changes: 0 additions & 197 deletions .versionbot/CHANGELOG.yml
Original file line number Diff line number Diff line change
@@ -1,200 +1,3 @@
- commits:
- subject: Establish contract for diskpart functions
hash: 159ced7b74fa2dad776d34d573a19ccfcdd69278
body: |
All new functions must throw an error on non-Windows platforms.
Only clean() is a no-op for historical reasons.
footer:
Change-type: patch
change-type: patch
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
version: 8.6.1
title: ""
date: 2023-05-19T15:51:22.661Z
- commits:
- subject: "Migrator: setup task sequence"
hash: f215585ae84f7455aef2f283be155186d0e62436
body: ""
footer:
Change-type: minor
change-type: minor
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
version: 8.6.0
title: ""
date: 2023-05-19T14:06:16.055Z
- commits:
- subject: stop diskpart.clean() from breaking CLI flash cmd
hash: 1d0dad1e62f2c723f706482b2b87ec7835d578fe
body: ""
footer:
Change-type: patch
change-type: patch
Signed-off-by: Ryan Cooke <[email protected]>
signed-off-by: Ryan Cooke <[email protected]>
author: rcooke-warwick
nested: []
version: 8.5.4
title: ""
date: 2023-05-18T15:25:29.172Z
- commits:
- subject: Convert migrator partition size calculations to use bytes
hash: 4ab3e128ae1d1c0386fa5aa9b71c59f1db872efe
body: |
Was using MB due to tool limitations. diskpart module for
Windows still requires sizes in MB.
footer:
Change-type: patch
change-type: patch
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
- subject: Determine required free space from image file partitions
hash: adf82434bc6f0c970e93cde2667923dda9c45a4c
body: ""
footer:
Change-type: patch
change-type: patch
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
- subject: Add function to calculate required partition size from an image file
hash: 3df7e4a182b521eb8b0c288d381488485416dc2f
body: ""
footer:
Change-type: patch
change-type: patch
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
- subject: Verify image file exists before begin migration
hash: e6262aa2a6cf7eddcc076806040e9a5efef02771
body: ""
footer:
Change-type: patch
change-type: patch
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
version: 8.5.3
title: ""
date: 2023-04-14T11:05:38.294Z
- commits:
- subject: Minor formatting updates for migrator script
hash: 9f64f01a3d8d5723e4b0c01d58a979a49f09743e
body: ""
footer:
Change-type: patch
change-type: patch
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
- subject: Integrate check for unallocated space into migrator
hash: 093f4deb56d4e28c08b1c003fd5c2f1277558ee5
body: ""
footer:
Change-type: patch
change-type: patch
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
- subject: Add function to provide unallocated space on disk
hash: ce9f2b36c458f213cab23a634d49b46a1477c15c
body: |
Also modify function that runs diskpart utility to return stdout output,
to support this new function.
footer:
Change-type: patch
change-type: patch
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
version: 8.5.2
title: ""
date: 2023-04-10T11:17:12.576Z
- commits:
- subject: Add README for new migrator feature
hash: 8c974e45e7d1a923be1a7954ae3d5c77943b390c
body: ""
footer:
Change-type: patch
change-type: patch
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
version: 8.5.1
title: ""
date: 2023-03-16T18:30:49.517Z
- commits:
- subject: Add feature to migrate this computer to run balenaOS
hash: e5f95590317d4aad800a89521c0e62ce4835e201
body: |
Adds balena boot and rootA partitions, copies bootloader, and reboots.
Presently only supports migration from a UEFI based Windows system.
footer:
Change-type: minor
change-type: minor
Co-Authored-By: Peter Makra <[email protected]>
co-authored-by: Peter Makra <[email protected]>
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
- subject: Add parameter for starting offset for write
hash: 735491aeab9a390415f6c15375acb98e313d290d
body: |
Historically, always started write at offset 0.
footer:
Change-type: patch
change-type: patch
Co-Authored-By: Peter Makra <[email protected]>
co-authored-by: Peter Makra <[email protected]>
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
- subject: Add parameter to clear partition table when open device
hash: 08337a249d2ee1a9f975f7d399772687092838c4
body: |
Historically, always cleared partition table.
footer:
Change-type: patch
change-type: patch
Co-Authored-By: Peter Makra <[email protected]>
co-authored-by: Peter Makra <[email protected]>
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
- subject: Add shrink and create partition functions
hash: 7b23adba4d647195264a348947b6c8c6c394a907
body: |
Also collect command text output on error.
footer:
Change-type: minor
change-type: minor
Co-Authored-By: Peter Makra <[email protected]>
co-authored-by: Peter Makra <[email protected]>
Signed-off-by: Ken Bannister <[email protected]>
signed-off-by: Ken Bannister <[email protected]>
author: Ken Bannister
nested: []
version: 8.5.0
title: ""
date: 2023-03-16T17:13:21.748Z
- commits:
- subject: "patch: revert unbzip2-stream to
#4a54f56a25b58950f9e4277c56db2912d62242e7"
Expand Down
36 changes: 0 additions & 36 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,6 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).

## 8.6.1 - 2023-05-19

* Establish contract for diskpart functions [Ken Bannister]

## 8.6.0 - 2023-05-19

* Migrator: setup task sequence [Ken Bannister]

## 8.5.4 - 2023-05-18

* stop diskpart.clean() from breaking CLI flash cmd [rcooke-warwick]

## 8.5.3 - 2023-04-14

* Convert migrator partition size calculations to use bytes [Ken Bannister]
* Determine required free space from image file partitions [Ken Bannister]
* Add function to calculate required partition size from an image file [Ken Bannister]
* Verify image file exists before begin migration [Ken Bannister]

## 8.5.2 - 2023-04-10

* Minor formatting updates for migrator script [Ken Bannister]
* Integrate check for unallocated space into migrator [Ken Bannister]
* Add function to provide unallocated space on disk [Ken Bannister]

## 8.5.1 - 2023-03-16

* Add README for new migrator feature [Ken Bannister]

## 8.5.0 - 2023-03-16

* Add feature to migrate this computer to run balenaOS [Ken Bannister]
* Add parameter for starting offset for write [Ken Bannister]
* Add parameter to clear partition table when open device [Ken Bannister]
* Add shrink and create partition functions [Ken Bannister]

## 8.4.1 - 2023-03-09

* patch: revert unbzip2-stream to #4a54f56a25b58950f9e4277c56db2912d62242e7 [Edwin Joassart]
Expand Down
6 changes: 1 addition & 5 deletions lib/block-write-stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,29 @@ export class BlockWriteStream extends Writable {
private maxRetries: number;
public bytesWritten = 0;
private position = 0;
private startOffset = 0;
private firstBuffer?: Buffer;

constructor({
destination,
highWaterMark,
delayFirstBuffer = false,
maxRetries = 5,
startOffset = 0,
}: {
destination: BlockDevice;
highWaterMark?: number;
delayFirstBuffer?: boolean;
maxRetries?: number;
startOffset?: number
}) {
super({ objectMode: true, highWaterMark });
this.destination = destination;
this.delayFirstBuffer = delayFirstBuffer;
this.maxRetries = maxRetries;
this.startOffset = startOffset;
}

private async writeBuffer(buffer: Buffer, position: number): Promise<void> {
await retryOnTransientError(
async () => {
await this.destination.write(buffer, 0, buffer.length, position + this.startOffset);
await this.destination.write(buffer, 0, buffer.length, position);
},
this.maxRetries,
RETRY_BASE_TIMEOUT,
Expand Down
Loading

0 comments on commit c257dbd

Please sign in to comment.