mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
disks: Workaround issue in parted during resize
Currently, if parted is given --script option it still asks for confirmation during resize when the partition is mounted. Implement a workaround to the problem by first trying the proper way and then trying a workaround described in https://bugs.launchpad.net/ubuntu/+source/parted/+bug/1270203 Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
eed31ae7f5
commit
c46cba8134
@ -72,11 +72,20 @@ def _resize_partition(device, requested_partition, free_space):
|
|||||||
command = ['parted', '--align=optimal', '--script', device, 'unit', 'B',
|
command = ['parted', '--align=optimal', '--script', device, 'unit', 'B',
|
||||||
'resizepart', requested_partition['number'],
|
'resizepart', requested_partition['number'],
|
||||||
str(free_space['end'])]
|
str(free_space['end'])]
|
||||||
|
# XXX: Remove workaround after bug in parted is fixed:
|
||||||
|
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24215
|
||||||
|
fallback_command = ['parted', '--align=optimal', device,
|
||||||
|
'---pretend-input-tty', 'unit', 'B', 'resizepart',
|
||||||
|
requested_partition['number'], 'yes',
|
||||||
|
str(free_space['end'])]
|
||||||
try:
|
try:
|
||||||
subprocess.run(command, check=True)
|
subprocess.run(command, check=True)
|
||||||
except subprocess.CalledProcessError as exception:
|
except subprocess.CalledProcessError as exception:
|
||||||
print('Error expanding partition:', exception, file=sys.stderr)
|
try:
|
||||||
sys.exit(5)
|
subprocess.run(fallback_command, check=True)
|
||||||
|
except subprocess.CalledProcessError as exception:
|
||||||
|
print('Error expanding partition:', exception, file=sys.stderr)
|
||||||
|
sys.exit(5)
|
||||||
|
|
||||||
|
|
||||||
def _resize_file_system(device, requested_partition, free_space):
|
def _resize_file_system(device, requested_partition, free_space):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user