summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-02-19 09:49:27 +0200
committerLars Wirzenius <liw@liw.fi>2022-02-19 09:49:27 +0200
commit3c6f8fdfd09bdc0f8433176d9b94eaef5275d8fd (patch)
treee5ff3737e72ae0d25e95a6fabf314423f92edca7
parent132e1f6ffb696085c395cda40c5a079101c92f9a (diff)
downloadvmdb2-3c6f8fdfd09bdc0f8433176d9b94eaef5275d8fd.tar.gz
debootstrap: allow user to say target need not be empty
Sponsored-by: author
-rw-r--r--vmdb/plugins/debootstrap_plugin.py4
1 files changed, 3 insertions, 1 deletions
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: