From efc977f7b437d11011de640659b42e4bb78e9708 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 19 Jun 2018 08:56:37 -0400 Subject: [PATCH] [localecfg] Fix mismatch between filenames Testing for existence of a file in the live system, and then copying it in the target system, is not a recipe for success. - Fix the restore-from-backup part. - Document that your live and target system must both have /etc/locale.gen if you want this to work at all. --- src/modules/localecfg/main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/localecfg/main.py b/src/modules/localecfg/main.py index a192fa902..4b12b9311 100644 --- a/src/modules/localecfg/main.py +++ b/src/modules/localecfg/main.py @@ -54,11 +54,12 @@ def run(): target_etc_default_path = "{!s}/etc/default".format(install_path) # restore backup if available - if os.path.exists('/etc/locale.gen.bak'): - shutil.copy2(target_locale_gen_bak, - target_locale_gen) + if os.path.exists(target_locale_gen_bak): + shutil.copy2(target_locale_gen_bak, target_locale_gen) - # run locale-gen if detected + # run locale-gen if detected; this *will* cause an exception + # if the live system has locale.gen, but the target does not: + # in that case, fix your installation filesystem. if os.path.exists('/etc/locale.gen'): text = []