diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-04-02 14:06:53 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-04-02 14:08:56 -0700 |
commit | 159ff0bda5c67767599509313468c157118ad70e (patch) | |
tree | c53e8a3cbfbb879afa2f49407d3c8bfdb38d9aac /src/property | |
parent | 8f8c59341e7f420397f79d47af2787ca55fba07b (diff) | |
download | consfigurator-159ff0bda5c67767599509313468c157118ad70e.tar.gz |
rename READFILE, WRITEFILE, corresponding generics and some wrappers
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property')
-rw-r--r-- | src/property/disk.lisp | 4 | ||||
-rw-r--r-- | src/property/file.lisp | 17 | ||||
-rw-r--r-- | src/property/sshd.lisp | 2 | ||||
-rw-r--r-- | src/property/user.lisp | 2 |
4 files changed, 13 insertions, 12 deletions
diff --git a/src/property/disk.lisp b/src/property/disk.lisp index 5616bd9..fd0df1b 100644 --- a/src/property/disk.lisp +++ b/src/property/disk.lisp @@ -948,8 +948,8 @@ filesystems will be incrementally updated when other properties change." (:apply (file:does-not-exist image) (with-remote-temporary-file (excludes) - (writefile excludes - (format nil "~@{~&~A~}" "/boot" "/proc" "/dev" "/sys" "/run")) + (write-remote-file + excludes (format nil "~@{~&~A~}" "/boot" "/proc" "/dev" "/sys" "/run")) (run :inform "nice" "mksquashfs" chroot image "-no-progress" "-comp" compression "-ef" excludes)))) diff --git a/src/property/file.lisp b/src/property/file.lisp index 51f7083..324049b 100644 --- a/src/property/file.lisp +++ b/src/property/file.lisp @@ -22,12 +22,13 @@ "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 -point in doing that here because WRITEFILE is synchronous." - (let* ((orig-lines (and (remote-exists-p file) (lines (readfile file)))) +point in doing that here because WRITE-REMOTE-FILE is synchronous." + (let* ((orig-lines (and (remote-exists-p file) + (lines (read-remote-file file)))) (new-lines (funcall function orig-lines))) (if (equal orig-lines new-lines) :no-change - (writefile file (unlines new-lines))))) + (write-remote-file file (unlines new-lines))))) (defprop has-content :posix (path content &key (mode nil mode-supplied-p)) "Ensure there is a file at PATH whose content is CONTENT. @@ -36,7 +37,7 @@ CONTENT can be a list of lines or a single string." (:desc (declare (ignore content mode mode-supplied-p)) #?"${path} has defined content") (:apply (unless mode-supplied-p (containing-directory-exists path)) - (apply #'maybe-writefile-string + (apply #'maybe-write-remote-file-string path (etypecase content (list @@ -71,11 +72,11 @@ replacing the contents of existing files, prefer FILE:HAS-CONTENT." (containing-directory-exists path) (let ((new-lines (copy-list (ensure-cons lines))) (existing-lines (and (remote-exists-p path) - (lines (readfile path))))) + (lines (read-remote-file path))))) (dolist (existing-line existing-lines) (deletef new-lines existing-line :test #'string=)) (if new-lines - (writefile path (unlines (nconc existing-lines new-lines))) + (write-remote-file path (unlines (nconc existing-lines new-lines))) :no-change)))) (defprop lacks-lines :posix (path &rest lines) @@ -146,7 +147,7 @@ any of the regular expressions PATTERNS." (require-data iden1 iden2)) (:apply (containing-directory-exists destination) - (maybe-writefile-data destination iden1 iden2))) + (maybe-write-remote-file-data destination iden1 iden2))) (defproplist host-data-uploaded :posix (destination @@ -162,7 +163,7 @@ any of the regular expressions PATTERNS." (declare (ignore destination)) (require-data iden1 iden2)) (:apply - (maybe-writefile-data destination iden1 iden2 :mode #o600))) + (maybe-write-remote-file-data destination iden1 iden2 :mode #o600))) (defproplist host-secret-uploaded :posix (destination diff --git a/src/property/sshd.lisp b/src/property/sshd.lisp index e4c1061..ba224e0 100644 --- a/src/property/sshd.lisp +++ b/src/property/sshd.lisp @@ -43,7 +43,7 @@ refuses to proceed if root has no authorized_keys." (:apply (assert-euid-root) (unless (and (remote-exists-p ".ssh/authorized_keys") - (plusp (length (readfile ".ssh/authorized_keys")))) + (plusp (length (read-remote-file ".ssh/authorized_keys")))) (failed-change "root has no authorized_keys")) (configured "PermitRootLogin" "prohibit-password" "PasswordAuthentication" "no"))) diff --git a/src/property/user.lisp b/src/property/user.lisp index 6bc87d8..1a49e5d 100644 --- a/src/property/user.lisp +++ b/src/property/user.lisp @@ -77,7 +77,7 @@ the installation of other software." (:hostattrs (os:required 'os:debianlike)) (:apply (let ((existing-groups - (loop for line in (lines (readfile "/etc/group")) + (loop for line in (lines (read-remote-file "/etc/group")) collect (car (split-string line :separator ":"))))) (apply #'has-groups username (loop for group in *desktop-groups* when (memstr= group existing-groups) |