Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion debian/DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Depends: os-prober,
libqt5xml5 (>= 5.0.2),
libstdc++6 (>= 9),
libyaml-cpp0.7 (>= 0.7.0),
efibootmgr (>=17-2)
efibootmgr (>=17-2),
qml-module-qtquick2,
qml-module-qtquick-controls
Maintainer: Savoir-faire Linux
Description: A UI installer to install SEAPATH distribution, based on the Calamares installer framework
44 changes: 41 additions & 3 deletions src/modules/rawimage/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import subprocess
import re
import gettext
import time
import os
import libcalamares

# Prefer the Calamares process helpers over subprocess for progress updates
Expand Down Expand Up @@ -76,6 +78,37 @@ def fix_disk(target_device):
libcalamares.utils.error(f"Failed to fix disk GPT on: {target_device}")
raise


def wait_for_device(target_device, data_partition):
"""
Wait for the kernel to update the target device with the new partitions.
"""
TIMEOUT=60
try:
subprocess.run(
["/usr/sbin/partprobe", target_device]
)
except subprocess.CalledProcessError:
libcalamares.utils.error(f"Fail to inform kernel of partition table changes")
raise

try:
subprocess.run(
["/usr/bin/udevadm", "settle"]
)
except subprocess.CalledProcessError:
libcalamares.utils.error(f"Fail to wait for pending udev events")
raise

start = time.time()
while True:
if os.path.exists(data_partition):
break
if time.time() - start > TIMEOUT:
raise libcalamares.utils.error(f"Partition node {data_partition} did not appear within {TIMEOUT}s")
time.sleep(0.5)


def extend_persistent_partition(target_device):
"""
Extend the persistent partition to use all available space on the target device.
Expand All @@ -98,6 +131,9 @@ def extend_persistent_partition(target_device):
else:
persistent_partition_name = f"{target_device}6"


wait_for_device(target_device, persistent_partition_name)

try:
subprocess.run(
["/usr/sbin/resize2fs", persistent_partition_name],
Expand Down Expand Up @@ -132,17 +168,19 @@ def remove_volume_group(mount_point):

try:
vg = subprocess.run(
["/usr/sbin/vgdisplay"], check=True, capture_output=True, text=True
["vgs", "--noheadings", "-o", "vg_name"], check=True, capture_output=True, text=True
)
except subprocess.CalledProcessError:
# Volume group does not exist; nothing to do
libcalamares.utils.error(f"Failed to list volume group on: {mount_point}")
raise

if(vg.stdout != ""):
vg_name = vg.stdout.strip()

if vg_name != "":
try:
subprocess.run(
["/usr/sbin/vgremove", "-y", "vg2"], check=True
["/usr/sbin/vgremove", "-y", vg_name], check=True
)
except subprocess.CalledProcessError:
libcalamares.utils.warning(f"Failed to disable volume group on: {mount_point}")
Expand Down