@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Booter host entry for standalone binaries: optional pear-runtime OTA, then booter main.
|
||||
*/
|
||||
import { name, version, upgrade } from '../../bin/meta/booter.mjs'
|
||||
import { startPearOta, parseOtaFlags } from '../../lib/bare-os-ota.mjs'
|
||||
|
||||
function pathBasename(p) {
|
||||
const s = String(p || '')
|
||||
const i = Math.max(s.lastIndexOf('/'), s.lastIndexOf('\\'))
|
||||
return i >= 0 ? s.slice(i + 1) : s
|
||||
}
|
||||
|
||||
const isBare = typeof globalThis.Bare !== 'undefined'
|
||||
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,
|
||||
version,
|
||||
name: 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('./index.js')
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Seeder host entry for standalone binaries: optional pear-runtime OTA, then seeder main.
|
||||
* Kept next to the app so bare-pack traces `./index.js` reliably.
|
||||
*/
|
||||
import { name, version, upgrade } from '../../bin/meta/seeder.mjs'
|
||||
import { startPearOta, parseOtaFlags } from '../../lib/bare-os-ota.mjs'
|
||||
|
||||
function pathBasename(p) {
|
||||
const s = String(p || '')
|
||||
const i = Math.max(s.lastIndexOf('/'), s.lastIndexOf('\\'))
|
||||
return i >= 0 ? s.slice(i + 1) : s
|
||||
}
|
||||
|
||||
const isBare = typeof globalThis.Bare !== 'undefined'
|
||||
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,
|
||||
version,
|
||||
name: 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('./index.js')
|
||||
Reference in New Issue
Block a user