From 1eafa3b6486c2abe56e093e14cfdc4941cfbf282 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 1 Apr 2022 17:31:33 -0700 Subject: FSTAB & CRYPTTAB: prepend HAS- to names of exported properties Signed-off-by: Sean Whitton --- src/package.lisp | 8 ++++---- src/property/crypttab.lisp | 6 +++--- src/property/disk.lisp | 5 +++-- src/property/fstab.lisp | 10 +++++----- src/property/installer.lisp | 8 ++++---- src/property/swap.lisp | 2 +- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/package.lisp b/src/package.lisp index 8d2848d..34a2dd3 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -640,9 +640,9 @@ (:local-nicknames (#:os #:consfigurator.property.os) (#:file #:consfigurator.property.file)) (:export #:volume->entry - #:entries - #:entries-for-volumes - #:entries-for-opened-volumes)) + #:has-entries + #:has-entries-for-volumes + #:has-entries-for-opened-volumes)) (package :consfigurator.property.crypttab (:use #:consfigurator.property.disk) @@ -650,7 +650,7 @@ (#:os #:consfigurator.property.os) (#:file #:consfigurator.property.file)) (:export #:volume->entry - #:entries-for-opened-volumes)) + #:has-entries-for-opened-volumes)) (package :consfigurator.property.gnupg (:local-nicknames (#:re #:cl-ppcre)) diff --git a/src/property/crypttab.lisp b/src/property/crypttab.lisp index 28bcaf7..744361b 100644 --- a/src/property/crypttab.lisp +++ b/src/property/crypttab.lisp @@ -62,7 +62,7 @@ ;;;; Properties -(defprop entries :posix (&rest entries) +(defprop has-entries :posix (&rest entries) "Ensure that /etc/crypttab contains each of ENTRIES, using a simple merge procedure: existing lines of the crypttab with the same mapped device name as any of ENTRIES are updated to match the corresponding members of ENTRIES, @@ -74,14 +74,14 @@ existing field value." (format nil "crypttab entr~@P for ~{~A~^, ~}" (length it) it))) (:apply (file:update-unix-table #P"/etc/crypttab" 1 0 entries))) -(defprop entries-for-opened-volumes :posix () +(defprop has-entries-for-opened-volumes :posix () "Add or update entries in /etc/crypttab for currently open volumes. This is used when building disk images and installing operating systems." (:desc "crypttab entries for opened volumes") (:hostattrs (os:required 'os:linux)) (:apply - (apply #'entries + (apply #'has-entries (mapcar #'volume->entry (mapcan (curry #'subvolumes-of-type 'opened-luks-container) (get-connattr :opened-volumes)))))) diff --git a/src/property/disk.lisp b/src/property/disk.lisp index 167f1f2..5616bd9 100644 --- a/src/property/disk.lisp +++ b/src/property/disk.lisp @@ -532,8 +532,9 @@ We do not specify what logical volumes it contains.")) when (slot-boundp volume 'mount-point) collect volume)))) (if to-create - (prog2 (ignoring-hostattrs - (consfigurator.property.fstab:entries-for-volumes to-create)) + (prog2 + (ignoring-hostattrs + (consfigurator.property.fstab:has-entries-for-volumes to-create)) (create-volumes-and-contents to-create) (dolist (volume to-create) (open-volume volume nil)) diff --git a/src/property/fstab.lisp b/src/property/fstab.lisp index 5a8feef..f684316 100644 --- a/src/property/fstab.lisp +++ b/src/property/fstab.lisp @@ -76,7 +76,7 @@ Other properties might fill it in." ;;;; Properties -(defprop entries :posix (&rest entries) +(defprop has-entries :posix (&rest entries) "Ensure that /etc/fstab contains each of ENTRIES, using a simple merge procedure: existing lines of the fstab with the same mount point as any of ENTRIES are updated to match the corresponding members of ENTRIES, except that @@ -89,26 +89,26 @@ partition or filesystem UUID in your consfig." (format nil "fstab entr~@P for ~{~A~^, ~}" (length it) it))) (:apply (file:update-unix-table #P"/etc/fstab" 0 1 entries))) -(defprop entries-for-volumes :posix (&optional volumes) +(defprop has-entries-for-volumes :posix (&optional volumes) "Add or update entries in /etc/fstab for VOLUMES, or the host's volumes, as specified with DISK:HAS-VOLUMES." (:desc (format nil "fstab entries for ~:[~;host's ~]volumes" volumes)) (:hostattrs (os:required 'os:linux)) - (:apply (apply #'entries + (:apply (apply #'has-entries (apply #'mapcar #'volume->entry (multiple-value-list (multiple-value-mapcan (curry #'subvolumes-of-type 'filesystem) (or volumes (get-hostattrs :volumes)))))))) -(defprop entries-for-opened-volumes :posix () +(defprop has-entries-for-opened-volumes :posix () "Add or update entries in /etc/fstab for currently open volumes. This is used when building disk images and installing operating systems." (:desc "fstab entries for opened volumes") (:hostattrs (os:required 'os:linux)) (:apply - (apply #'entries + (apply #'has-entries (apply #'mapcar #'volume->entry (multiple-value-list (multiple-value-mapcan diff --git a/src/property/installer.lisp b/src/property/installer.lisp index 64d76e1..7c0e306 100644 --- a/src/property/installer.lisp +++ b/src/property/installer.lisp @@ -111,8 +111,8 @@ Also update the fstab and crypttab, and try to install bootloader(s)." ;; from the volumes the user has declared for the host, it ;; is unlikely there are other properties setting mount ;; options etc. which are in conflict with VOLUMES. - (fstab:entries-for-opened-volumes) - (crypttab:entries-for-opened-volumes)))) + (fstab:has-entries-for-opened-volumes) + (crypttab:has-entries-for-opened-volumes)))) (%install-bootloaders ,running-on-target ,@(get-propspecs (get-hostattrs :volumes) running-on-target)))))))) @@ -353,7 +353,7 @@ Here are some other propapps you might want to attach to the application of this property with ON-CHANGE: (bootloaders-installed) - (fstab:entries-for-volumes + (fstab:has-entries-for-volumes (disk:volumes (mounted-ext4-filesystem :mount-point #P\"/\") (partition (mounted-fat32-filesystem :mount-point #P\"/boot/efi/\")))) @@ -377,7 +377,7 @@ of properties subsequent to this one. A more complete example: (apt:installed \"linux-image-amd64\") (installer:bootloaders-installed) - (fstab:entries-for-volumes + (fstab:has-entries-for-volumes (disk:volumes (mounted-ext4-filesystem :mount-point #P\"/\") (partition diff --git a/src/property/swap.lisp b/src/property/swap.lisp index b3ab9c9..4c89657 100644 --- a/src/property/swap.lisp +++ b/src/property/swap.lisp @@ -38,5 +38,5 @@ Current implementation assumes a non-CoW filesystem; see NOTES in swapon(8)." (:hostattrs (os:required 'os:linux)) (on-apply-change (%swapfile-exists size location) (cmd:single "swapon" location)) - (fstab:entries + (fstab:has-entries (strcat (unix-namestring location) " swap swap defaults 0 0"))) -- cgit v1.2.3