+2
-42
@@ -1,8 +1,5 @@
|
||||
/**
|
||||
* bare-os-booter entry for Bare standalone binaries (and `bare bin/…` dev).
|
||||
*
|
||||
* OTA metadata comes from bin/meta/booter.mjs (JS — packable). Do not require
|
||||
* package.json here; bare-pack does not embed JSON via createRequire.
|
||||
* bare-os-booter Bare standalone entry (peardock-style: runtime globals, then app).
|
||||
*/
|
||||
const isBare = typeof globalThis.Bare !== 'undefined'
|
||||
|
||||
@@ -10,41 +7,4 @@ if (isBare) {
|
||||
await import('bare-node-runtime/global')
|
||||
}
|
||||
|
||||
function pathBasename(p) {
|
||||
const s = String(p || '')
|
||||
const i = Math.max(s.lastIndexOf('/'), s.lastIndexOf('\\'))
|
||||
return i >= 0 ? s.slice(i + 1) : s
|
||||
}
|
||||
|
||||
const meta = await import('./meta/booter.mjs')
|
||||
const { startPearOta, parseOtaFlags } = await import('../lib/bare-os-ota.mjs')
|
||||
|
||||
const argv = isBare
|
||||
? globalThis.Bare.argv.slice(pathBasename(globalThis.Bare.argv[0]) === 'bare' ? 2 : 1)
|
||||
: process.argv.slice(2)
|
||||
|
||||
const { updates, storage } = parseOtaFlags(argv)
|
||||
|
||||
const ota = await startPearOta({
|
||||
upgrade: meta.upgrade,
|
||||
version: meta.version,
|
||||
name: meta.name || 'bare-os-booter',
|
||||
updates,
|
||||
storage,
|
||||
})
|
||||
|
||||
const onExit = async (code = 0) => {
|
||||
await ota.close()
|
||||
if (typeof globalThis.Bare !== 'undefined') globalThis.Bare.exit(code)
|
||||
else process.exit(code)
|
||||
}
|
||||
|
||||
if (typeof process !== 'undefined' && process.on) {
|
||||
for (const sig of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
|
||||
process.on(sig, () => {
|
||||
onExit(sig === 'SIGINT' ? 130 : 143).catch(() => {})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
await import('../packages/bare-os-booter/index.js')
|
||||
await import('../packages/bare-os-booter/standalone.mjs')
|
||||
|
||||
+3
-42
@@ -1,8 +1,6 @@
|
||||
/**
|
||||
* bare-os-seeder entry for Bare standalone binaries (and `bare bin/…` dev).
|
||||
*
|
||||
* OTA metadata comes from bin/meta/seeder.mjs (JS — packable). Do not require
|
||||
* package.json here; bare-pack does not embed JSON via createRequire.
|
||||
* bare-os-seeder Bare standalone entry (peardock-style: runtime globals, then app).
|
||||
* App + OTA live in packages/bare-os-seeder/standalone.mjs so bare-pack follows one import.
|
||||
*/
|
||||
const isBare = typeof globalThis.Bare !== 'undefined'
|
||||
|
||||
@@ -10,41 +8,4 @@ if (isBare) {
|
||||
await import('bare-node-runtime/global')
|
||||
}
|
||||
|
||||
function pathBasename(p) {
|
||||
const s = String(p || '')
|
||||
const i = Math.max(s.lastIndexOf('/'), s.lastIndexOf('\\'))
|
||||
return i >= 0 ? s.slice(i + 1) : s
|
||||
}
|
||||
|
||||
const meta = await import('./meta/seeder.mjs')
|
||||
const { startPearOta, parseOtaFlags } = await import('../lib/bare-os-ota.mjs')
|
||||
|
||||
const argv = isBare
|
||||
? globalThis.Bare.argv.slice(pathBasename(globalThis.Bare.argv[0]) === 'bare' ? 2 : 1)
|
||||
: process.argv.slice(2)
|
||||
|
||||
const { updates, storage } = parseOtaFlags(argv)
|
||||
|
||||
const ota = await startPearOta({
|
||||
upgrade: meta.upgrade,
|
||||
version: meta.version,
|
||||
name: meta.name || 'bare-os-seeder',
|
||||
updates,
|
||||
storage,
|
||||
})
|
||||
|
||||
const onExit = async (code = 0) => {
|
||||
await ota.close()
|
||||
if (typeof globalThis.Bare !== 'undefined') globalThis.Bare.exit(code)
|
||||
else process.exit(code)
|
||||
}
|
||||
|
||||
if (typeof process !== 'undefined' && process.on) {
|
||||
for (const sig of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
|
||||
process.on(sig, () => {
|
||||
onExit(sig === 'SIGINT' ? 130 : 143).catch(() => {})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
await import('../packages/bare-os-seeder/index.js')
|
||||
await import('../packages/bare-os-seeder/standalone.mjs')
|
||||
|
||||
Reference in New Issue
Block a user