-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This simply dd's the resulting image to a block device. (Doesn't actually dd though, uses systemd-repart --copy-from) i.e. run "mkosi -f burn /dev/sda"
- Loading branch information
1 parent
2342a74
commit 397ca3c
Showing
4 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# SPDX-License-Identifier: LGPL-2.1+ | ||
|
||
import os | ||
import sys | ||
|
||
from mkosi.config import MkosiArgs, MkosiConfig, OutputFormat | ||
from mkosi.log import complete_step, die | ||
from mkosi.run import run | ||
|
||
|
||
def run_burn(args: MkosiArgs, config: MkosiConfig) -> None: | ||
if config.output_format not in (OutputFormat.disk, OutputFormat.esp): | ||
die(f"{config.output_format} images cannot be burned to disk") | ||
|
||
fname = config.output_dir_or_cwd() / config.output | ||
|
||
if len(args.cmdline) != 1: | ||
die("Expected device argument."); | ||
|
||
device = args.cmdline[0] | ||
|
||
cmd = [ | ||
"systemd-repart", | ||
"--no-pager", | ||
"--pretty=no", | ||
"--offline=yes", | ||
"--empty=force", | ||
"--dry-run=no", | ||
f"--copy-from={fname}", | ||
device, | ||
] | ||
|
||
with complete_step("Burning 🔥🔥🔥 to medium…", "Burnt. 🔥🔥🔥"): | ||
run( | ||
cmd, | ||
stdin=sys.stdin, | ||
stdout=sys.stdout, | ||
env=os.environ, | ||
log=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters