maybe
This commit is contained in:
parent
594fb6816a
commit
f62370c5f9
|
|
@ -1,3 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
bun ./scripts/generate-hosts.ts > /etc/avahi/hosts
|
||||
sudo systemctl restart avahi-daemon
|
||||
|
|
@ -1,9 +1,22 @@
|
|||
import { $ } from "bun"
|
||||
import { apps } from "../src/webapp"
|
||||
|
||||
const { stdout: ip } = await $`hostname -I | awk '{print $1}'`.quiet()
|
||||
const { stdout: host } = await $`hostname`.quiet()
|
||||
const { stdout: ipRaw } = await $`hostname -I | awk '{print $1}'`.quiet()
|
||||
const { stdout: hostRaw } = await $`hostname`.quiet()
|
||||
|
||||
const hosts = apps().map(app => `${ip.toString().trim()} ${app}.${host.toString().trim()}.local`)
|
||||
const ip = ipRaw.toString().trim()
|
||||
const host = hostRaw.toString().trim()
|
||||
|
||||
console.log(hosts.join("\n"))
|
||||
// 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(() => { })
|
||||
Loading…
Reference in New Issue
Block a user