aboutsummaryrefslogtreecommitdiff
path: root/src/property
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-03-09 16:32:17 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-03-09 16:34:33 -0700
commit6d1d7ea0bbd0ef970e22f4c87775f95fb3b8452b (patch)
tree5c93462a94a019b5f8f3a55299d3f04fe6b2aedd /src/property
parent7cc46462f5ca23723317c2b4b6099ac7daaf7258 (diff)
downloadconsfigurator-6d1d7ea0bbd0ef970e22f4c87775f95fb3b8452b.tar.gz
add "local" and "remote" to the names of some exported symbols
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property')
-rw-r--r--src/property/chroot.lisp4
-rw-r--r--src/property/disk.lisp2
-rw-r--r--src/property/file.lisp30
-rw-r--r--src/property/installer.lisp8
-rw-r--r--src/property/locale.lisp2
-rw-r--r--src/property/lxc.lisp2
-rw-r--r--src/property/mount.lisp6
-rw-r--r--src/property/ssh.lisp2
8 files changed, 28 insertions, 28 deletions
diff --git a/src/property/chroot.lisp b/src/property/chroot.lisp
index bf4b942..5b1c9b1 100644
--- a/src/property/chroot.lisp
+++ b/src/property/chroot.lisp
@@ -23,8 +23,8 @@
(:check
(declare (ignore options host))
;; check whether a previous debootstrap failed partway through
- (if (test "-d" (merge-pathnames "debootstrap/"
- (ensure-directory-pathname root)))
+ (if (remote-test "-d" (merge-pathnames "debootstrap/"
+ (ensure-directory-pathname root)))
(progn (delete-remote-trees root) nil)
(remote-exists-p (chroot-pathname "/usr/lib/os-release" root))))
(:apply
diff --git a/src/property/disk.lisp b/src/property/disk.lisp
index 9466b5d..3054441 100644
--- a/src/property/disk.lisp
+++ b/src/property/disk.lisp
@@ -283,7 +283,7 @@ directly writing out with dd(1)."))
(defmethod create-volume ((volume raw-disk-image) (file null))
"Ensure that a raw disk image exists. Will overwrite only regular files."
(let ((file (image-file volume)))
- (when (test "-L" file "-o" "-e" file "-a" "!" "-f" file)
+ (when (remote-test "-L" file "-o" "-e" file "-a" "!" "-f" file)
(failed-change "~A already exists and is not a regular file." file))
;; Here, following Propellor, we want to ensure that the disk image size
;; is a multiple of 4096 bytes, so that the size is aligned to the common
diff --git a/src/property/file.lisp b/src/property/file.lisp
index bd940f3..26ce4a1 100644
--- a/src/property/file.lisp
+++ b/src/property/file.lisp
@@ -18,7 +18,7 @@
(in-package :consfigurator.property.file)
(named-readtables:in-readtable :consfigurator)
-(defun map-file-lines (file function)
+(defun map-remote-file-lines (file function)
"Apply FUNCTION to the lines of FILE. Safe to use in a :POSIX property.
For efficiency, a :LISP property might want to use streams, but there's no
@@ -76,7 +76,7 @@ replacing the contents of existing files, prefer FILE:HAS-CONTENT."
(defprop lacks-lines :posix (path &rest lines)
"If there is a file at PATH, ensure it does not contain any of LINES."
(:apply
- (map-file-lines
+ (map-remote-file-lines
path
(curry #'remove-if (lambda (l) (member l lines :test #'string=))))))
@@ -85,7 +85,7 @@ replacing the contents of existing files, prefer FILE:HAS-CONTENT."
any of the regular expressions PATTERNS."
(:apply
(let ((scanners (mapcar #'re:create-scanner patterns)))
- (map-file-lines
+ (map-remote-file-lines
path (lambda (lines)
(loop for line in lines
unless (loop for s in scanners thereis (re:scan s line))
@@ -176,7 +176,7 @@ any of the regular expressions PATTERNS."
"Like s/REGEX/REPLACE/ on the lines of FILE.
Uses CL-PPCRE:REGEX-REPLACE, which see for the syntax of REPLACE."
(:apply
- (map-file-lines
+ (map-remote-file-lines
file
(lambda (lines)
(mapcar (lambda (line) (re:regex-replace regex line replace)) lines)))))
@@ -226,7 +226,7 @@ error if FROM is another kind of file, except when unapplying."
"FILE:SYMLINKED: need both :FROM and :TO arguments."))
(when (pathnamep to)
(setq to (unix-namestring to)))
- (let* ((link (test "-L" from))
+ (let* ((link (remote-test "-L" from))
(exists (remote-exists-p from)))
(when (and exists (not link))
(failed-change "~A exists but is not a symbolic link." from))
@@ -236,7 +236,7 @@ error if FROM is another kind of file, except when unapplying."
(containing-directory-exists from) (mrun "ln" "-sf" to from)))))
(:unapply
(declare (ignore to))
- (if (test "-L" from)
+ (if (remote-test "-L" from)
(mrun "rm" from)
:no-change)))
@@ -245,7 +245,7 @@ error if FROM is another kind of file, except when unapplying."
symbolic link, in which case the target of the link will be copied."
(:desc #?"${dest} is copy of ${source}")
(:check
- (and (test "-f" dest)
+ (and (remote-test "-f" dest)
(zerop (mrun :for-exit "cmp" "-s" dest source))))
(:apply
(with-remote-temporary-file
@@ -264,11 +264,11 @@ symbolic link, in which case the target of the link will be copied."
(&key (parse-comment "#") (new-comment "# ")
(parse-section (constantly nil)) (new-section #'identity)
parse-kv new-kv map)
- "Return a function suitable for passing to FILE:MAP-FILE-LINES, to modify
-the lines of a config file using MAP. MAP is a function from a list of config
-file lines to a list of config file lines, except that lines which set values
-in the original file will be replaced by lists of the form (COMMENTED SECTION
-KEY VALUE), where
+ "Return a function suitable for passing to FILE:MAP-REMOTE-FILE-LINES, to
+modify the lines of a config file using MAP. MAP is a function from a list of
+config file lines to a list of config file lines, except that lines which set
+values in the original file will be replaced by lists of the form (COMMENTED
+SECTION KEY VALUE), where
- COMMENTED is a boolean indicating whether the line was commented
- SECTION is the section of the config file in which the line appears
@@ -365,7 +365,7 @@ Other arguments:
"Values passed are not all strings, or list is not even")
do (setf (gethash k keys) v))
(containing-directory-exists file)
- (map-file-lines
+ (map-remote-file-lines
file (apply
#'config-file-map
:map
@@ -456,7 +456,7 @@ removed, and semicolon comment chars will be replaced with '#'."
(keys (make-hash-table :test #'equal)))
(loop for (s k v) in triples
do (setf (gethash (cons s k) keys) v))
- (map-file-lines
+ (map-remote-file-lines
file
(config-file-map
:parse-comment "[#;]"
@@ -525,7 +525,7 @@ an attempt is made to activate the swap, set up the bind mount, etc."
(dolist (entry entries)
(setf (gethash (nth target (words entry)) pending) entry))
(containing-directory-exists file)
- (map-file-lines
+ (map-remote-file-lines
file
(lambda (lines)
(stable-sort
diff --git a/src/property/installer.lisp b/src/property/installer.lisp
index 43c6c9d..63d8c63 100644
--- a/src/property/installer.lisp
+++ b/src/property/installer.lisp
@@ -189,7 +189,7 @@ using a combinator like ON-CHANGE, or applied manually with DEPLOY-THESE."
(flet ((preservedp (pathname)
(member pathname preserved-directories :test #'pathname-equal)))
(mount:assert-devtmpfs-udev-/dev)
- (unless (mountpointp "/run")
+ (unless (remote-mount-point-p "/run")
(failed-change "/run is not a mount point; don't know what to do."))
;; If there's an EFI system partition, we need to store knowledge of
@@ -198,7 +198,7 @@ using a combinator like ON-CHANGE, or applied manually with DEPLOY-THESE."
;; is responsible for adding an entry for the EFI system partition to
;; the new system's fstab, but we are responsible for restoring
;; knowledge of the partition to the kernel's mount table.
- (when (mountpointp "/boot/efi")
+ (when (remote-mount-point-p "/boot/efi")
(destructuring-bind (type source options)
(words (stripln (run "findmnt" "-nro" "FSTYPE,SOURCE,OPTIONS"
"/boot/efi")))
@@ -237,12 +237,12 @@ using a combinator like ON-CHANGE, or applied manually with DEPLOY-THESE."
(let (done)
(handler-case
(flet ((rename (s d) (rename-file s d) (push (cons s d) done)))
- (dolist (file (directory-contents #P"/"))
+ (dolist (file (local-directory-contents #P"/"))
(unless (or (preservedp file)
(pathname-equal file new-os)
(pathname-equal file old-os))
(rename file (chroot-pathname file old-os))))
- (dolist (file (directory-contents new-os))
+ (dolist (file (local-directory-contents new-os))
(let ((dest (in-chroot-pathname file new-os)))
(unless (preservedp dest)
(when (or (file-exists-p dest) (directory-exists-p dest))
diff --git a/src/property/locale.lisp b/src/property/locale.lisp
index 524a0dc..eafde35 100644
--- a/src/property/locale.lisp
+++ b/src/property/locale.lisp
@@ -22,7 +22,7 @@
(:desc (declare (ignore locale)) "/etc/locale.gen updated")
(:apply
(assert-euid-root)
- (file:map-file-lines
+ (file:map-remote-file-lines
"/etc/locale.gen"
(lambda (lines)
(loop with found
diff --git a/src/property/lxc.lisp b/src/property/lxc.lisp
index b32f091..05aafc8 100644
--- a/src/property/lxc.lisp
+++ b/src/property/lxc.lisp
@@ -100,7 +100,7 @@ As a special case, INTERFACE may also be \"none\", which gives USER permission
to create veth pairs where the peer outside the container is not attached to
any bridge."
(:desc #?"${user} may attach LXC veth devices to ${interface}")
- (:apply (file:map-file-lines
+ (:apply (file:map-remote-file-lines
"/etc/lxc/lxc-usernet"
(lambda (lines)
(loop with done
diff --git a/src/property/mount.lisp b/src/property/mount.lisp
index f4a06ed..dc6a559 100644
--- a/src/property/mount.lisp
+++ b/src/property/mount.lisp
@@ -82,10 +82,10 @@ and unless DIR is itself a mount point, also remove DIR."
(:desc #?"${dir} unmounted below and emptied/removed")
(:hostattrs (os:required 'os:linux))
(:check (or (not (remote-exists-p dir))
- (and (mountpointp dir)
+ (and (remote-mount-point-p dir)
(null (runlines "find" dir "-not" "-path" dir)))))
(:apply (ignoring-hostattrs (unmounted-below dir :and-at nil))
- (if (mountpointp dir)
+ (if (remote-mount-point-p dir)
(empty-remote-directory dir)
(delete-remote-trees dir))))
@@ -119,7 +119,7 @@ After mounting /sys, mount this when /sys/firmware/efi/efivars exists.")
(defun assert-devtmpfs-udev-/dev ()
"On a system with the Linux kernel, assert that /dev has fstype devtmpfs."
- (unless (and (mountpointp "/dev")
+ (unless (and (remote-mount-point-p "/dev")
(string= "devtmpfs udev"
(stripln (run "findmnt" "-nro" "fstype,source" "/dev"))))
(failed-change
diff --git a/src/property/ssh.lisp b/src/property/ssh.lisp
index de1f153..3f98d2a 100644
--- a/src/property/ssh.lisp
+++ b/src/property/ssh.lisp
@@ -45,7 +45,7 @@
(defprop %update-known-hosts :posix
(file host &key short-hostname (aliases t) (ips t) additional-names)
(:apply
- (file:map-file-lines
+ (file:map-remote-file-lines
file
(lambda (lines)
(loop with host = (preprocess-host host)