mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-26 01:46:18 -05:00
Disks: allow persisting the primary mount from the UI; clean NTFS before mounting.
The Disks page treated /media/wrolpi as fully protected, so a manually-mounted primary drive could not be persisted from the UI — and the Persist toggle would have been wrong anyway: it wrote fstab.yaml, which the wrolpi-mounts reconciler refuses to apply for the primary mount (RESERVED_MOUNT_POINTS). Route Persist for the primary mount to the host's /etc/fstab (as onboarding does), report its entry in the fstab list endpoint, and enable the toggle in both UIs while keeping Unmount blocked. Mounts outside /media (e.g. /boot/efi, which showed an Unmount button) are now entirely untouchable System mounts. Also: - Run `ntfsfix -d` before mounting ntfs/ntfs3 volumes so the Windows dirty flag (Fast Startup, unclean unplug) cannot block mounting; non-fatal and a no-op on clean volumes. - Add uid/gid fstab options for ntfs/ntfs3, matching mount_drive(). - Log reconcile diagnostics (desired/already-mounted/skipped with reasons) so an idle wrolpi-mounts run explains itself in the journal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
85bd5619fa
commit
c25902b92a
11 changed files with 251 additions and 18 deletions
|
|
@ -218,6 +218,30 @@ UUID=5678 /media/64GB exfat defaults,nofail,x-systemd.device-timeout=10s 0 2
|
|||
assert "uid=" not in written_str
|
||||
assert "gid=" not in written_str
|
||||
|
||||
def test_ntfs_fstab_entry_includes_uid_gid(self):
|
||||
"""Should add uid/gid options when adding ntfs fstab entry (no POSIX permissions)."""
|
||||
fstab_content = "# empty\n"
|
||||
written_content = []
|
||||
|
||||
def mock_write(content):
|
||||
written_content.append(content)
|
||||
|
||||
mock_file = mock.mock_open(read_data=fstab_content)
|
||||
mock_file().write = mock_write
|
||||
|
||||
with mock.patch("controller.lib.fstab.require_normal_mode"):
|
||||
with mock.patch("controller.lib.fstab.get_uuid", return_value="1234-5678"):
|
||||
with mock.patch("controller.lib.fstab.backup_fstab"):
|
||||
with mock.patch("controller.lib.fstab.get_wrolpi_uid_gid", return_value=(1001, 1001)):
|
||||
with mock.patch("builtins.open", mock_file):
|
||||
with mock.patch("subprocess.run"):
|
||||
result = add_fstab_entry("/dev/sdb2", "/media/wrolpi", "ntfs")
|
||||
assert result["success"] is True
|
||||
written_str = "".join(written_content)
|
||||
# Should have uid/gid options
|
||||
assert "uid=1001" in written_str
|
||||
assert "gid=1001" in written_str
|
||||
|
||||
def test_vfat_fstab_entry_includes_uid_gid(self):
|
||||
"""Should add uid/gid options when adding vfat (FAT32) fstab entry."""
|
||||
fstab_content = "# empty\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue