phone/scripts/bootstrap.ts
2025-11-21 10:59:40 -08:00

36 lines
1010 B
TypeScript
Executable File

import { $ } from "bun"
console.log(`
==========================================
Phone Setup Bootstrap
==========================================
`)
// Check if running as root
if (process.getuid && process.getuid() !== 0) {
console.error("Please run with sudo: sudo bun bootstrap.ts [install-dir]")
console.error("Or use full path: sudo ~/.bun/bin/bun bootstrap.ts [install-dir]")
process.exit(1)
}
// Get install directory from argument or use default
const defaultUser = process.env.USER || "corey"
const INSTALL_DIR = process.argv[2] || `/home/${defaultUser}/phone`
console.log(`Install directory: ${INSTALL_DIR}`)
console.log("\nEnsuring directory exists...")
await $`mkdir -p ${INSTALL_DIR}`
console.log(`✓ Directory ready: ${INSTALL_DIR}`)
console.log("\nInstalling dependencies...")
await $`cd ${INSTALL_DIR} && bun install`
console.log(`✓ Dependencies installed`)
console.log("\nInstalling Baresip...")
await $`sudo apt install -y baresip`
console.log(`
✅ Bootstrap complete!
`)