From 3c6f8fdfd09bdc0f8433176d9b94eaef5275d8fd Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 19 Feb 2022 09:49:27 +0200 Subject: debootstrap: allow user to say target need not be empty Sponsored-by: author --- vmdb/plugins/debootstrap_plugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vmdb/plugins/debootstrap_plugin.py b/vmdb/plugins/debootstrap_plugin.py index f7404c1..a28bf94 100644 --- a/vmdb/plugins/debootstrap_plugin.py +++ b/vmdb/plugins/debootstrap_plugin.py @@ -39,6 +39,7 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): "variant": "-", "components": ["main"], "include": [], + "require_empty_target": True, } def run(self, values, settings, state): @@ -49,6 +50,7 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): keyring = values["keyring"] or None install_keyring = values["install_keyring"] include = values["include"] + require_empty = values["require_empty_target"] arch = ( values["arch"] or subprocess.check_output(["dpkg", "--print-architecture"]).strip() @@ -59,7 +61,7 @@ class DebootstrapStepRunner(vmdb.StepRunnerInterface): if not (suite and tag and target and mirror): raise Exception("missing arg for debootstrap step") - if os.path.exists(target): + if os.path.exists(target) and require_empty: allowed_names = ["lost+found"] names = [n for n in os.listdir(target) if n not in allowed_names] if len(names) > 0: -- cgit v1.2.1