Added real disk format section
* --dry-run=True safety wheels still engaged
This commit is contained in:
parent
ac04a3ddc5
commit
9ae8810282
2 changed files with 14 additions and 4 deletions
|
|
@ -78,7 +78,7 @@ def build_cmd_kwargs(cmd, minimized=False, pipe=True, shell=False, **kwargs):
|
|||
}
|
||||
|
||||
# Add additional kwargs if applicable
|
||||
for key in ('check', 'cwd', 'encoding', 'errors', 'stderr', 'stdout'):
|
||||
for key in 'check cwd encoding errors stderr stdin stdout'.split():
|
||||
if key in kwargs:
|
||||
cmd_kwargs[key] = kwargs[key]
|
||||
|
||||
|
|
|
|||
|
|
@ -701,10 +701,20 @@ class State():
|
|||
with open(script_path, 'w') as _f:
|
||||
_f.write('\n'.join(sfdisk_script))
|
||||
|
||||
# Skip real format for dry runs
|
||||
if dry_run:
|
||||
return
|
||||
|
||||
# Format disk
|
||||
if not dry_run:
|
||||
# TODO
|
||||
pass
|
||||
with open(script_path, 'r') as _f:
|
||||
proc = exe.run_program(
|
||||
cmd=['sudo', 'sfdisk', self.destination.path],
|
||||
stdin=_f,
|
||||
check=False,
|
||||
)
|
||||
if proc.returncode != 0:
|
||||
std.print_error('Error(s) encoundtered while formatting destination')
|
||||
raise std.GenericAbort()
|
||||
|
||||
# Update settings
|
||||
settings['Needs Format'] = not dry_run
|
||||
|
|
|
|||
Loading…
Reference in a new issue