Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

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

fix: direct-boot nix usb EFI

+88 -2
+2
fedac/native/ac-os
··· 926 926 "${IMAGE_PATH}" \ 927 927 "${CONFIG_FILE}" \ 928 928 "$(ac_media_nixos_data_size_mib)" 929 + ac_media_customize_nixos_efi_boot "${IMAGE_PATH}" 929 930 930 931 USB_DEV="$(find_usb_dev)" || { err "No USB device found"; exit 1; } 931 932 log "Flashing ${IMAGE_PATH} to ${USB_DEV}..." ··· 1597 1598 "${NIX_UPLOAD_IMAGE}" \ 1598 1599 "${NIX_UPLOAD_CONFIG}" \ 1599 1600 "$(ac_media_nixos_data_size_mib)" 1601 + ac_media_customize_nixos_efi_boot "${NIX_UPLOAD_IMAGE}" 1600 1602 OTA_CHANNEL=nix bash "${SCRIPT_DIR}/scripts/upload-release.sh" --iso "${NIX_UPLOAD_IMAGE}" 1601 1603 rm -rf "${NIX_UPLOAD_DIR}" 1602 1604 ;;
+85 -2
fedac/native/scripts/media-layout.sh
··· 179 179 ac_media_create_fat_image "$@" 180 180 } 181 181 182 - ac_media_nixos_data_partition_start_sector() { 182 + ac_media_partition_start_sector() { 183 183 local image_path="$1" 184 - local partition_name="${image_path}3" 184 + local partition_number="$2" 185 + local partition_name="${image_path}${partition_number}" 185 186 186 187 sfdisk -d "${image_path}" 2>/dev/null | 187 188 awk -v partition_name="${partition_name}" ' ··· 206 207 } 207 208 END { exit found ? 0 : 1 } 208 209 ' 210 + } 211 + 212 + ac_media_nixos_data_partition_start_sector() { 213 + ac_media_partition_start_sector "$1" 3 214 + } 215 + 216 + ac_media_customize_nixos_efi_boot() { 217 + local image_path="$1" 218 + local efi_start 219 + local efi_offset 220 + local tmpdir 221 + local orig_cfg 222 + local menu_cfg 223 + local direct_cfg 224 + local linux_line 225 + local initrd_line 226 + 227 + if [ ! -f "${image_path}" ]; then 228 + echo "Missing NixOS image: ${image_path}" >&2 229 + return 1 230 + fi 231 + 232 + if ! efi_start="$(ac_media_partition_start_sector "${image_path}" 2)"; then 233 + echo "No EFI boot partition found in ${image_path}" >&2 234 + return 1 235 + fi 236 + 237 + efi_offset=$(( efi_start * 512 )) 238 + tmpdir="$(mktemp -d /tmp/ac-nixos-efi.XXXXXX)" 239 + orig_cfg="${tmpdir}/grub.cfg.orig" 240 + menu_cfg="${tmpdir}/grub-menu.cfg" 241 + direct_cfg="${tmpdir}/grub.cfg" 242 + 243 + export MTOOLS_SKIP_CHECK=1 244 + if ! mcopy -o -i "${image_path}@@${efi_offset}" ::EFI/BOOT/grub.cfg "${orig_cfg}" >/dev/null 2>&1; then 245 + rm -rf "${tmpdir}" 246 + echo "Failed to read EFI grub.cfg from ${image_path}" >&2 247 + return 1 248 + fi 249 + 250 + linux_line="$(grep -m1 '^[[:space:]]*linux ' "${orig_cfg}" | sed -E 's/^[[:space:]]+//; s/[[:space:]]+\$\{isoboot\}([[:space:]]|$)/ /g; s/[[:space:]]+$//')" 251 + initrd_line="$(grep -m1 '^[[:space:]]*initrd ' "${orig_cfg}" | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//')" 252 + 253 + if [ -z "${linux_line}" ] || [ -z "${initrd_line}" ]; then 254 + rm -rf "${tmpdir}" 255 + echo "Failed to extract kernel/initrd lines from EFI grub.cfg" >&2 256 + return 1 257 + fi 258 + 259 + cp "${orig_cfg}" "${menu_cfg}" 260 + cat > "${direct_cfg}" <<EOF 261 + set timeout=0 262 + set default=0 263 + set efi_root=\$root 264 + terminal_output console 265 + terminal_input console 266 + insmod part_msdos 267 + insmod fat 268 + insmod iso9660 269 + insmod search_fs_file 270 + 271 + search --no-floppy --set=root --file /EFI/nixos-installer-image 272 + 273 + echo "Booting AC Native..." 274 + ${linux_line} 275 + ${initrd_line} 276 + boot 277 + 278 + echo "AC Native boot failed." 279 + if [ -f (\$efi_root)/EFI/BOOT/grub-menu.cfg ]; then 280 + configfile (\$efi_root)/EFI/BOOT/grub-menu.cfg 281 + fi 282 + EOF 283 + 284 + if ! mcopy -o -i "${image_path}@@${efi_offset}" "${menu_cfg}" ::EFI/BOOT/grub-menu.cfg >/dev/null 2>&1 || 285 + ! mcopy -o -i "${image_path}@@${efi_offset}" "${direct_cfg}" ::EFI/BOOT/grub.cfg >/dev/null 2>&1; then 286 + rm -rf "${tmpdir}" 287 + echo "Failed to update EFI grub.cfg in ${image_path}" >&2 288 + return 1 289 + fi 290 + 291 + rm -rf "${tmpdir}" 209 292 } 210 293 211 294 ac_media_ensure_nixos_data_partition() {
+1
oven/native-builder.mjs
··· 654 654 "set -euo pipefail", 655 655 `. "${path.join(NATIVE_DIR, "scripts/media-layout.sh")}"`, 656 656 `ac_media_ensure_nixos_data_partition "$1" "$2" "${NIX_DATA_PARTITION_MIB}"`, 657 + 'ac_media_customize_nixos_efi_boot "$1"', 657 658 'sfdisk -d "$1"', 658 659 ].join("\n"), 659 660 "_",