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
|
# 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:
|
if key in kwargs:
|
||||||
cmd_kwargs[key] = kwargs[key]
|
cmd_kwargs[key] = kwargs[key]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -701,10 +701,20 @@ class State():
|
||||||
with open(script_path, 'w') as _f:
|
with open(script_path, 'w') as _f:
|
||||||
_f.write('\n'.join(sfdisk_script))
|
_f.write('\n'.join(sfdisk_script))
|
||||||
|
|
||||||
|
# Skip real format for dry runs
|
||||||
|
if dry_run:
|
||||||
|
return
|
||||||
|
|
||||||
# Format disk
|
# Format disk
|
||||||
if not dry_run:
|
with open(script_path, 'r') as _f:
|
||||||
# TODO
|
proc = exe.run_program(
|
||||||
pass
|
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
|
# Update settings
|
||||||
settings['Needs Format'] = not dry_run
|
settings['Needs Format'] = not dry_run
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue