From efd64f77149ad5a8053ab9d8385a396ca05b20ec Mon Sep 17 00:00:00 2001 From: Henrik Grimler Date: Mon, 14 Sep 2020 19:01:19 +0200 Subject: [PATCH] Check if workpath/ is empty and in that case create workpath/version (MR 1975) Fixes https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1965 --- pmb/config/init.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pmb/config/init.py b/pmb/config/init.py index e689e4fd..915bc3fe 100644 --- a/pmb/config/init.py +++ b/pmb/config/init.py @@ -60,6 +60,10 @@ def ask_for_work_path(args): # Create the folder with a version file if not exists: os.makedirs(work, 0o700, True) + + if not os.listdir(work): + # Directory is empty, either because we just created it or + # because user created it before running pmbootstrap init with open(work + "/version", "w") as handle: handle.write(str(pmb.config.work_version) + "\n")