35 lines
953 B
TypeScript
Executable File
35 lines
953 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 INSTALL_DIR = process.argv[2] || "/home/corey/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!
|
|
`)
|