22 lines
618 B
TypeScript
22 lines
618 B
TypeScript
import { $ } from "bun"
|
|
import { apps } from "../src/webapp"
|
|
|
|
const { stdout: ipRaw } = await $`hostname -I | awk '{print $1}'`.quiet()
|
|
const { stdout: hostRaw } = await $`hostname`.quiet()
|
|
|
|
const ip = ipRaw.toString().trim()
|
|
const host = hostRaw.toString().trim()
|
|
|
|
// console.log(apps().map(app => `avahi-publish -a -R ${app}.${host} ${ip} &`).join("\n"))
|
|
|
|
const procs = apps().map(app =>
|
|
Bun.spawn(["avahi-publish", "-a", "-R", `${app}.${host}`, ip])
|
|
)
|
|
|
|
for (const p of procs)
|
|
p.exited.then(code =>
|
|
console.log(`avahi-publish (${p.pid}) exited with code ${code}`)
|
|
)
|
|
|
|
|
|
await new Promise(() => { }) |