Bash scripts were untestable and duplicated device/LUKS/mount logic; the lim/ package centralizes it behind one subprocess wrapper and a YAML image catalog (single point of truth). BREAKING CHANGE: scripts/*.sh removed. Use `lim --type <cmd>`; new types mount/umount/single-boot/raid1-boot/lock/unlock/import/export replace direct script calls. --extra is deprecated and ignored. - distributions.yml + lim/catalog.py hold the image catalog (PyYAML) - pytest suite: 102 tests with mocked subprocess (tests/unit) and a 250-line max file-length guard (tests/lint) - ruff strict (select ALL), GitHub Actions CI, Dependabot; Travis gone - Makefile: install (symlink ~/.local/bin/lim) and test targets - fixes over bash: SUDO_USER-aware chown, mmcblk/nvme partition paths, sha512 checksum support, whole-pipeline failure detection, blkid UUID fallback for pre-mounted images, conditional fstab seeding for PARTUUID/LABEL images, clean errors for missing binaries
32 lines
908 B
Python
32 lines
908 B
Python
"""The image setup plan collected from the user's answers."""
|
|
|
|
from dataclasses import dataclass, field
|
|
from pathlib import Path
|
|
|
|
DEFAULT_BOOT_SIZE = "+500M"
|
|
|
|
|
|
@dataclass
|
|
class ImagePlan:
|
|
operation_system: str = "linux"
|
|
distribution: str | None = None
|
|
base_download_url: str | None = None
|
|
image_name: str | None = None
|
|
image_checksum: str | None = None
|
|
boot_size: str = ""
|
|
luks_memory_cost: str | None = None
|
|
raspberry_pi_version: str | None = None
|
|
encrypt_system: bool = False
|
|
root_filesystem: str = ""
|
|
image_folder: Path = field(default_factory=Path)
|
|
|
|
@property
|
|
def download_url(self) -> str | None:
|
|
if self.base_download_url is None or self.image_name is None:
|
|
return None
|
|
return f"{self.base_download_url}{self.image_name}"
|
|
|
|
@property
|
|
def image_path(self) -> Path:
|
|
return self.image_folder / self.image_name
|