@dotrino/vaultd 0.131.2 → 0.131.3
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/package.json +1 -1
- package/src/update.js +20 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotrino/vaultd",
|
|
3
|
-
"version": "0.131.
|
|
3
|
+
"version": "0.131.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Certificador personal de Dotrino: daemon headless que custodia la clave maestra y delega capacidades a tus dispositivos por el proxy. Tu CA propia.",
|
|
6
6
|
"bin": {
|
package/src/update.js
CHANGED
|
@@ -75,11 +75,28 @@ export function isUserInstall (execPath = process.execPath, home = os.homedir())
|
|
|
75
75
|
export async function installUserRelease (release, { binDir = userBinDir(), log = () => {}, fetchVerifiedImpl = fetchVerified } = {}) {
|
|
76
76
|
const pick = pickAsset(release.assets, [{ kind: 'tar', re: /-linux-x64\.tar\.gz$/ }])
|
|
77
77
|
if (!pick.ok) return pick
|
|
78
|
-
|
|
78
|
+
// SE TRABAJA EN DISCO, al lado de los binarios, y no en /tmp: en un VPS /tmp es un tmpfs
|
|
79
|
+
// (memoria) de unos cientos de MB, y el tarball (41 MB) más el binario (125 MB) no cabían
|
|
80
|
+
// — tar falló con «Disk quota exceeded» en la bóveda de Dotrino (2026-09-24). Además es la
|
|
81
|
+
// única carpeta que la unidad deja escribir. La carpeta se borra al acabar, salga como salga.
|
|
82
|
+
const work = path.join(path.dirname(binDir), 'update')
|
|
83
|
+
fs.rmSync(work, { recursive: true, force: true })
|
|
84
|
+
fs.mkdirSync(work, { recursive: true, mode: 0o700 })
|
|
85
|
+
try {
|
|
86
|
+
return await instalarDesde(work, pick, release, { binDir, log, fetchVerifiedImpl })
|
|
87
|
+
} finally {
|
|
88
|
+
try { fs.rmSync(work, { recursive: true, force: true }) } catch (_) {}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function instalarDesde (work, pick, release, { binDir, log, fetchVerifiedImpl }) {
|
|
93
|
+
const got = await fetchVerifiedImpl(pick.asset, { repo: REPO, product: 'dotrino-vault', version: VERSION, dir: work })
|
|
79
94
|
if (!got.ok) return got
|
|
80
95
|
log(`[vault] update: ${pick.asset.name} verified against its attestation`)
|
|
81
|
-
|
|
82
|
-
|
|
96
|
+
try { execFileSync('tar', ['xzf', got.file, '-C', work], { stdio: ['ignore', 'ignore', 'pipe'] }) } catch (e) {
|
|
97
|
+
// El motivo de tar es lo que sirve («Disk quota exceeded», …): se dice, no solo «falló».
|
|
98
|
+
return { ok: false, code: 'UNPACK_FAILED', reason: `could not unpack the release: ${String(e.stderr || e.message).trim().split('\n').slice(-2).join(' · ')}` }
|
|
99
|
+
}
|
|
83
100
|
const src = fs.readdirSync(work).map((d) => path.join(work, d)).find((d) => fs.existsSync(path.join(d, 'dotrino-vaultd')))
|
|
84
101
|
if (!src) return { ok: false, code: 'BAD_TARBALL', reason: 'the tarball has no dotrino-vaultd inside' }
|
|
85
102
|
fs.mkdirSync(binDir, { recursive: true })
|
|
@@ -90,6 +107,5 @@ export async function installUserRelease (release, { binDir = userBinDir(), log
|
|
|
90
107
|
fs.chmodSync(tmp, 0o755)
|
|
91
108
|
fs.renameSync(tmp, path.join(binDir, name))
|
|
92
109
|
}
|
|
93
|
-
try { fs.rmSync(work, { recursive: true, force: true }) } catch (_) {}
|
|
94
110
|
return { ok: true, version: release.version }
|
|
95
111
|
}
|