Verified Commit e099ccbd authored by boklm's avatar boklm
Browse files

Bug 40090: Remove containers using `rm -Rf` instead of pathrmdir

Remove the `container remove` command (based on `pathrmdir` from
File::Copy::Recursive) and instead use `container run -- rm -Rf`, which
was noticed by PieroV to be much faster.
parent 8c5f3899
Loading
Loading
Loading
Loading
+1 −14
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ use English;
use Getopt::Long;
use Path::Tiny;
use File::Path qw(make_path);
use File::Copy::Recursive qw(pathrmdir rcopy fcopy);
use File::Copy::Recursive qw(rcopy fcopy);
require "syscall.ph";

*CLONE_NEWNS   = \0x20000;
@@ -208,19 +208,6 @@ my %actions = (
            );
        },
    },
    remove => {
        descr => "Remove a container directory",
        usage => "$0 remove <container-dir>",
        run   => sub {
            usageexit($ARGV[0]) unless @ARGV == 2;
            exit_error "$ARGV[1] is not a directory" unless -d $ARGV[1];
            unshare_run(
                sub {
                    return pathrmdir($ARGV[1]);
                }
            );
        },
    },
    put => {
        descr => "Copy a file or directory to the container directory",
        usage => "$0 put <container-dir> <src> <dst> <owner>",
+1 −1
Original line number Diff line number Diff line
@@ -530,7 +530,7 @@ OPT_END
        remote_finish => <<OPT_END,
#!/bin/sh
set -e
[% c("rbmdir") %]/container remove '[% c("container/dir") %]'
[% c("rbmdir") %]/container run -- rm -Rf -- '[% c("container/dir") %]'
OPT_END
####
####