From 064fff0c12067a370fbbcc64c6d1c0efb0ba4df0 Mon Sep 17 00:00:00 2001
From: Adriaan de Groot <groot@kde.org>
Date: Fri, 7 Aug 2020 12:05:46 +0200
Subject: [PATCH] [grubcfg] Drop default_dir

- the default_dir was only stored in modify_grub_default() to
  create the directory if needed; move that functionality to
  the get_grub_config_paths() function (and drop the "s",
  since it now returns just one).
---
 src/modules/grubcfg/main.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/modules/grubcfg/main.py b/src/modules/grubcfg/main.py
index bf1ec4b9f..3c3f3d447 100644
--- a/src/modules/grubcfg/main.py
+++ b/src/modules/grubcfg/main.py
@@ -37,18 +37,21 @@ def pretty_name():
     return _("Configure GRUB.")
 
 
-def get_grub_config_paths(root_mount_point):
+def get_grub_config_path(root_mount_point):
     """
     Figures out where to put the grub config files. Returns
-    a directory path and the full path of a file inside that
-    directory, as "the grub-directory" and "the config file".
+    a the full path of a file inside that
+    directory, as "the config file".
 
     Returns a path into @p root_mount_point.
     """
     default_dir = os.path.join(root_mount_point, "etc/default")
     default_grub = os.path.join(default_dir, "grub")
 
-    return (default_dir, default_grub)
+    if not os.path.exists(default_dir):
+        os.mkdir(default_dir)
+
+    return default_grub
 
 def modify_grub_default(partitions, root_mount_point, distributor):
     """
@@ -67,7 +70,7 @@ def modify_grub_default(partitions, root_mount_point, distributor):
         is always updated to set this value.
     :return:
     """
-    default_dir, default_grub = get_grub_config_paths(root_mount_point)
+    default_grub = get_grub_config_path(root_mount_point)
     distributor_replace = distributor.replace("'", "'\\''")
     dracut_bin = libcalamares.utils.target_env_call(
         ["sh", "-c", "which dracut"]
@@ -154,9 +157,6 @@ def modify_grub_default(partitions, root_mount_point, distributor):
 
     distributor_line = "GRUB_DISTRIBUTOR='{!s}'".format(distributor_replace)
 
-    if not os.path.exists(default_dir):
-        os.mkdir(default_dir)
-
     have_kernel_cmd = False
     have_distributor_line = False