diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-08-21 15:15:39 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-08-22 15:49:27 -0700 |
commit | 472e13164a150af1a010179fc94558c6305836d3 (patch) | |
tree | 51e32941c420a808788dee4242cde8f701a1460f /src/connection.lisp | |
parent | 034c65c8063f6e9ca05f73ae854bf567eaada6ae (diff) | |
download | consfigurator-472e13164a150af1a010179fc94558c6305836d3.tar.gz |
MOUNT:UNMOUNTED-BELOW-AND-REMOVED: don't unmount DIR itself
If DIR is itself a mount point then previously we would never delete its
contents because the unmounting is done first. This meant that when
MOUNT:UNMOUNTED-BELOW-AND-REMOVED was used to remove the root filesystem of a
container or virtual machine, for example, then whether the contents of the
root filesystem was actually deleted depended upon whether DIR happened to be
a mount point. This change ensures that the deletion is always done.
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/connection.lisp')
-rw-r--r-- | src/connection.lisp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/connection.lisp b/src/connection.lisp index 9159a02..782160a 100644 --- a/src/connection.lisp +++ b/src/connection.lisp @@ -481,6 +481,11 @@ subclass to the :HOSTATTRS subroutine of properties calling this." "Recursively delete each of PATHS." (mrun "rm" "-rf" paths)) +(defun empty-remote-directory (directory) + "Recursively delete the contents of DIRECTORY, but not DIRECTORY itself." + (let ((d (escape-sh-token (drop-trailing-slash (unix-namestring directory))))) + (mrun (format nil "rm -rf -- ~A/* ~A/.[!.]* ~A/..?*" d d d)))) + (defun remote-exists-p (&rest paths) "Does each of PATHS exists? PATH may be any kind of file, including directories." |