mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-25 12:16:37 +00:00
fix(GUI): check drive size against uncompressed image size (#582)
We were currently checking if a drive was large enough for an image by checking the image file size, completely ignoring compression. This results on a small chance of the uncompressed image not actually fitting in the drive, and throwing more weird errors later on. In order to mitigate this, we use the new `.getEstimatedFinalSize()` function from `etcher-image-stream`, which returns the uncompressed size in the case of compressed images. We needed to update the build script for OS X to configure NPM correctly, otherwise `lzma-native` throws some errors due to an ABI V8 incompatibility issue. Fixes: #571 See: https://github.com/addaleax/lzma-native/issues/25 Change-Type: patch Changelog-Entry: Check if drive is large enough using the final uncompressed size of the image. Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This commit is contained in:
parent
ef96ae86a0
commit
1762ea629f
@ -17,7 +17,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const fs = require('fs');
|
const imageStream = require('etcher-image-stream');
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
|
|
||||||
module.exports = function($q, SupportedFormatsModel) {
|
module.exports = function($q, SupportedFormatsModel) {
|
||||||
@ -71,17 +71,12 @@ module.exports = function($q, SupportedFormatsModel) {
|
|||||||
return resolve();
|
return resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.stat(imagePath, (error, stats) => {
|
imageStream.getEstimatedFinalSize(imagePath).then((estimatedSize) => {
|
||||||
|
|
||||||
if (error) {
|
|
||||||
return reject(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return resolve({
|
return resolve({
|
||||||
path: imagePath,
|
path: imagePath,
|
||||||
size: stats.size
|
size: estimatedSize
|
||||||
});
|
});
|
||||||
});
|
}).catch(reject);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
1497
npm-shrinkwrap.json
generated
1497
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -64,7 +64,7 @@
|
|||||||
"chalk": "^1.1.3",
|
"chalk": "^1.1.3",
|
||||||
"drivelist": "^3.2.2",
|
"drivelist": "^3.2.2",
|
||||||
"electron-is-running-in-asar": "^1.0.0",
|
"electron-is-running-in-asar": "^1.0.0",
|
||||||
"etcher-image-stream": "^2.3.0",
|
"etcher-image-stream": "^2.5.2",
|
||||||
"etcher-image-write": "^5.0.3",
|
"etcher-image-write": "^5.0.3",
|
||||||
"etcher-latest-version": "^1.0.0",
|
"etcher-latest-version": "^1.0.0",
|
||||||
"file-tail": "^0.3.0",
|
"file-tail": "^0.3.0",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user