mirror of
https://github.com/jamesstringer90/appsandbox.git
synced 2026-10-22 11:03:15 -05:00
iso-patch.exe gains a new --ubuntu-to-vhdx mode that produces a fully
installed, bootable Ubuntu VHDX in one shot:
- vendored xz-embedded + custom ext4 writer + squashfs reader
- mounts the ISO, partitions GPT (ESP + Linux root), streams
casper/minimal.squashfs into a freshly-built ext4 rootfs through
a producer/N-decompress-worker/single-writer pipeline
- installs signed shim + grub from the ISO's pool .debs onto ESP,
writes a redirect grub.cfg pointing at the rootfs by UUID
- plants a defensive one-shot first-boot systemd unit that runs
grub-install + update-grub + AppSandbox guest setup (agent ELFs,
kernel modules, systemd units, wsl-mesa, wsl-deps, ldconfig,
no-sleep dconf, etc.) and reboots
linux_create_thread now spawns iso-patch with --ubuntu-to-vhdx
and a --stage manifest covering the full extras tree (reuses
stage_linux_agent_and_extras to populate a staging dir then walks
it). image_path is cleared post-build so the ISO isn't re-attached
to the runtime VM. ComPorts/com1 named pipe and the do_connect_rdp
window path are dropped (IDD is the only live display path now).
VideoMonitor stays unconditional (vmwp.exe crashes 0xC0000005
without it) — but with no ConnectionOptions/named pipe, matching
master.
JS frontend: "Installing Linux" branch added so the spinner label
no longer says "Installing Windows" for Linux VMs. Progress %
now tracks ingest fraction (n_processed / total_inodes) mapped
into 10..75%, with post-ingest phases at 82..99%.
60 lines
2.1 KiB
C
60 lines
2.1 KiB
C
/* log.h - timestamped, two-sink (stdout + file) logger.
|
|
*
|
|
* Every log call emits a line of the form:
|
|
*
|
|
* [HH:MM:SS.mmm] [PHASE] [LEVEL] message
|
|
*
|
|
* to BOTH stdout (so you see it live) AND the log file (so you can paste
|
|
* it back). The point of this POC is to make failures debuggable from
|
|
* the log alone - so log liberally, log every Win32 call's parameters
|
|
* AND return value, log every computed offset/size/UUID.
|
|
*
|
|
* LOG_HEX dumps a buffer as hex+ASCII (16 bytes per line) - useful for
|
|
* eyeballing partition headers, superblocks, etc.
|
|
*
|
|
* LOG_WIN32_FAIL pulls FormatMessage on GetLastError and includes it.
|
|
*/
|
|
#ifndef POC_LOG_H
|
|
#define POC_LOG_H
|
|
|
|
#include <windows.h>
|
|
#include <stdio.h>
|
|
|
|
typedef enum {
|
|
LOG_DEBUG = 0,
|
|
LOG_INFO = 1,
|
|
LOG_WARN = 2,
|
|
LOG_ERROR = 3
|
|
} log_level_t;
|
|
|
|
/* Open the log file. path may be NULL -> auto-name out\pocbuild-<ts>.log.
|
|
* Sets the current phase to "INIT". Returns 0 on success. */
|
|
int log_open(const char *path);
|
|
void log_close(void);
|
|
|
|
/* Tag emitted in [PHASE] for subsequent log lines. Pushed/popped at
|
|
* phase boundaries (Phase 0, Phase 1, ...). Max 8 stack depth. */
|
|
void log_phase_push(const char *phase);
|
|
void log_phase_pop(void);
|
|
|
|
/* Core log. Use the LOG_* macros below for source-line context. */
|
|
void log_emit(log_level_t lvl, const char *file, int line,
|
|
const char *fmt, ...);
|
|
|
|
/* Hex dump - prints up to `len` bytes from `buf` in 16-byte rows. */
|
|
void log_hex(log_level_t lvl, const char *label, const void *buf, size_t len);
|
|
|
|
/* Convenience for failed Win32 calls. Logs the call name, the error
|
|
* code, and FormatMessage's English text. */
|
|
void log_win32_fail(const char *file, int line, const char *call,
|
|
DWORD err);
|
|
|
|
#define LOG_D(...) log_emit(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__)
|
|
#define LOG_I(...) log_emit(LOG_INFO, __FILE__, __LINE__, __VA_ARGS__)
|
|
#define LOG_W(...) log_emit(LOG_WARN, __FILE__, __LINE__, __VA_ARGS__)
|
|
#define LOG_E(...) log_emit(LOG_ERROR, __FILE__, __LINE__, __VA_ARGS__)
|
|
#define LOG_HEX(lvl, label, buf, len) log_hex((lvl), (label), (buf), (len))
|
|
#define LOG_WIN32(call, err) log_win32_fail(__FILE__, __LINE__, (call), (err))
|
|
|
|
#endif
|