A simple, zero-configuration script to quickly boot FreeBSD ISO images using QEMU
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add generateRandomMacAddress function and use it in runQemu for MAC address assignment

+18 -1
+16
network.ts
··· 102 102 103 103 await setupQemuBridge(bridgeName); 104 104 } 105 + 106 + export function generateRandomMacAddress(): string { 107 + const hexDigits = "0123456789ABCDEF"; 108 + let macAddress = "52:54:00"; 109 + 110 + for (let i = 0; i < 3; i++) { 111 + macAddress += ":"; 112 + for (let j = 0; j < 2; j++) { 113 + macAddress += hexDigits.charAt( 114 + Math.floor(Math.random() * hexDigits.length), 115 + ); 116 + } 117 + } 118 + 119 + return macAddress; 120 + }
+2 -1
utils.ts
··· 1 1 import chalk from "chalk"; 2 2 import _ from "lodash"; 3 + import { generateRandomMacAddress } from "./network.ts"; 3 4 4 5 const DEFAULT_VERSION = "14.3-RELEASE"; 5 6 ··· 107 108 ? `bridge,id=net0,br=${options.bridge}` 108 109 : "user,id=net0,hostfwd=tcp::2222-:22", 109 110 "-device", 110 - "e1000,netdev=net0", 111 + `e1000,netdev=net0,mac=${generateRandomMacAddress()}`, 111 112 "-nographic", 112 113 "-monitor", 113 114 "none",