Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archinstall/lib/disk/btrfs.py4
-rw-r--r--archinstall/lib/disk/filesystem.py1
-rw-r--r--archinstall/lib/disk/user_guides.py25
-rw-r--r--archinstall/lib/installer.py7
4 files changed, 25 insertions, 12 deletions
diff --git a/archinstall/lib/disk/btrfs.py b/archinstall/lib/disk/btrfs.py
index 558a249e..e9ffec66 100644
--- a/archinstall/lib/disk/btrfs.py
+++ b/archinstall/lib/disk/btrfs.py
@@ -23,7 +23,9 @@ def mount_subvolume(installation, location :Union[pathlib.Path, str], force=Fals
raise DiskError(f"Cannot mount subvolume to {installation.target/location} because it contains data (non-empty folder target)")
# Mount the logical volume to the physical structure
- return SysCommand(f"mount {get_mount_info(installation.target/location)['source']} {installation.target}/{str(location)} -o subvol=@/{str(location)}").exit_code == 0
+ mount_location = get_mount_info(installation.target/location)['source']
+ SysCommand(f"umount {mount_location}")
+ return SysCommand(f"mount {mount_location} {installation.target}/{str(location)} -o subvol=@/{str(location)}").exit_code == 0
def create_subvolume(installation, location :Union[pathlib.Path, str]) -> bool:
"""
diff --git a/archinstall/lib/disk/filesystem.py b/archinstall/lib/disk/filesystem.py
index 28846764..0328cd83 100644
--- a/archinstall/lib/disk/filesystem.py
+++ b/archinstall/lib/disk/filesystem.py
@@ -132,6 +132,7 @@ class Filesystem:
def raw_parted(self, string: str):
if (cmd_handle := SysCommand(f'/usr/bin/parted -s {string}')).exit_code != 0:
log(f"Parted ended with a bad exit code: {cmd_handle}", level=logging.ERROR, fg="red")
+ time.sleep(0.5)
return cmd_handle
def parted(self, string: str):
diff --git a/archinstall/lib/disk/user_guides.py b/archinstall/lib/disk/user_guides.py
index 79b9d48f..6f8a1edb 100644
--- a/archinstall/lib/disk/user_guides.py
+++ b/archinstall/lib/disk/user_guides.py
@@ -41,18 +41,21 @@ def suggest_single_disk_layout(block_device, default_filesystem=None):
}
})
- if default_filesystem == 'btrfs' and input('Would you like to use BTRFS subvolumes? (Y/n)').strip().lower() in ('', 'y', 'yes'):
- # https://btrfs.wiki.kernel.org/index.php/FAQ
- # https://unix.stackexchange.com/questions/246976/btrfs-subvolume-uuid-clash
- # https://github.com/classy-giraffe/easy-arch/blob/main/easy-arch.sh
- layout[block_device.path]['partitions'][1]['btrfs'] = {
- "subvolumes" : {
- '@home' : '/home',
- '@log' : '/var/log',
- '@pkgs' : '/var/cache/pacman/pkg',
- '@.snapshots' : '/.snapshots'
+ if default_filesystem == 'btrfs' and input('Would you like to use BTRFS subvolumes? (Y/n): ').strip().lower() in ('', 'y', 'yes'):
+ if input('Do you want to use a recommended structure? (Y/n): ').strip().lower() in ('', 'y', 'yes'):
+ # https://btrfs.wiki.kernel.org/index.php/FAQ
+ # https://unix.stackexchange.com/questions/246976/btrfs-subvolume-uuid-clash
+ # https://github.com/classy-giraffe/easy-arch/blob/main/easy-arch.sh
+ layout[block_device.path]['partitions'][1]['btrfs'] = {
+ "subvolumes" : {
+ '@home' : '/home',
+ '@log' : '/var/log',
+ '@pkgs' : '/var/cache/pacman/pkg',
+ '@.snapshots' : '/.snapshots'
+ }
}
- }
+ else:
+ pass #... implement a guided setup
elif block_device.size >= MIN_SIZE_TO_ALLOW_HOME_PART:
# If we don't want to use subvolumes,
diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py
index 2aac8510..41d918a1 100644
--- a/archinstall/lib/installer.py
+++ b/archinstall/lib/installer.py
@@ -5,6 +5,7 @@ from .mirrors import *
from .plugins import plugins
from .storage import storage
from .user_interaction import *
+from .disk.btrfs import create_subvolume, mount_subvolume
# Any package that the Installer() is responsible for (optional and the default ones)
__packages__ = ["base", "base-devel", "linux-firmware", "linux", "linux-lts", "linux-zen", "linux-hardened"]
@@ -139,9 +140,15 @@ class Installer:
password = mountpoints[mountpoint]['password']
with luks2(mountpoints[mountpoint]['device_instance'], loopdev, password, auto_unmount=False) as unlocked_device:
unlocked_device.mount(f"{self.target}{mountpoint}")
+
else:
mountpoints[mountpoint]['device_instance'].mount(f"{self.target}{mountpoint}")
+ if (subvolumes := mountpoints[mountpoint].get('btrfs', {}).get('subvolumes', {})):
+ for name, location in subvolumes.items():
+ create_subvolume(self, location)
+ mount_subvolume(self, location)
+
def mount(self, partition, mountpoint, create_mountpoint=True):
if create_mountpoint and not os.path.isdir(f'{self.target}{mountpoint}'):
os.makedirs(f'{self.target}{mountpoint}')