vmsan 0.1.0-alpha.26 → 0.1.0-alpha.27

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.
@@ -1774,18 +1774,11 @@ function buildImageRootfs(imageRef, cacheDir, minimal = false) {
1774
1774
  const tarSizeOutput = execSync(`stat -c %s "${tmpTar}"`, { encoding: "utf-8" }).trim();
1775
1775
  const tarMb = Number(tarSizeOutput) / 1024 / 1024;
1776
1776
  const imageSizeMb = Math.max(1024, Math.ceil(tarMb + 512));
1777
- execSync(`dd if=/dev/zero of="${ext4Path}" bs=1M count=${imageSizeMb} 2>/dev/null`, { stdio: "pipe" });
1778
- execSync(`mkfs.ext4 -q "${ext4Path}"`, { stdio: "pipe" });
1777
+ const tmpExtract = join(cacheDir, "rootfs-extracted");
1778
+ mkdirSync(tmpExtract, { recursive: true });
1779
+ execSync(`tar -xf "${tmpTar}" -C "${tmpExtract}"`, { stdio: "pipe" });
1780
+ execSync(`mkfs.ext4 -q -d "${tmpExtract}" "${ext4Path}" "${imageSizeMb}M"`, { stdio: "pipe" });
1779
1781
  execSync(`tune2fs -m 0 "${ext4Path}"`, { stdio: "pipe" });
1780
- const tmpMount = join(cacheDir, "mnt");
1781
- mkdirSync(tmpMount, { recursive: true });
1782
- execSync(`mount -o loop "${ext4Path}" "${tmpMount}"`, { stdio: "pipe" });
1783
- try {
1784
- execSync(`tar -xf "${tmpTar}" -C "${tmpMount}"`, { stdio: "pipe" });
1785
- } finally {
1786
- execSync(`umount "${tmpMount}"`, { stdio: "pipe" });
1787
- execSync(`rm -rf "${tmpMount}"`, { stdio: "pipe" });
1788
- }
1789
1782
  writeFileSync(join(cacheDir, "metadata.json"), JSON.stringify({
1790
1783
  image: imageRef.full,
1791
1784
  builtAt: (/* @__PURE__ */ new Date()).toISOString()
@@ -1795,10 +1788,19 @@ function buildImageRootfs(imageRef, cacheDir, minimal = false) {
1795
1788
  } finally {
1796
1789
  try {
1797
1790
  execSync(`docker rm -f "${containerName}" 2>/dev/null`, { stdio: "pipe" });
1798
- } catch {}
1791
+ } catch (err) {
1792
+ consola.debug(`Failed to remove docker container ${containerName}: ${toError(err).message}`);
1793
+ }
1799
1794
  try {
1800
1795
  execSync(`rm -f "${tmpTar}"`, { stdio: "pipe" });
1801
- } catch {}
1796
+ } catch (err) {
1797
+ consola.debug(`Failed to remove temp tar ${tmpTar}: ${toError(err).message}`);
1798
+ }
1799
+ try {
1800
+ execSync(`rm -rf "${join(cacheDir, "rootfs-extracted")}"`, { stdio: "pipe" });
1801
+ } catch (err) {
1802
+ consola.debug(`Failed to remove extraction dir: ${toError(err).message}`);
1803
+ }
1802
1804
  }
1803
1805
  }
1804
1806
  function resolveImageRootfs(imageRef, registryDir, minimal = false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vmsan",
3
- "version": "0.1.0-alpha.26",
3
+ "version": "0.1.0-alpha.27",
4
4
  "description": "Firecracker microVM sandbox toolkit",
5
5
  "homepage": "https://github.com/angelorc/vmsan",
6
6
  "bugs": "https://github.com/angelorc/vmsan/issues",