Skip to content
Snippets Groups Projects
Commit 862ed86a authored by Teo Mrnjavac's avatar Teo Mrnjavac
Browse files

Use root_mount_point.

parent 4c2a327d
No related branches found
No related tags found
No related merge requests found
......@@ -19,9 +19,9 @@
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
import libcalamares
import os.path
def write_openswap_conf(partitions, openswap_conf_path):
def write_openswap_conf(partitions, root_mount_point, openswap_conf_path):
swap_outer_uuid = ""
swap_mapper_name = ""
mountable_keyfile_device = ""
......@@ -40,7 +40,7 @@ def write_openswap_conf(partitions, openswap_conf_path):
swap_device_path = "/dev/disk/by-uuid/{!s}".format(swap_outer_uuid)
lines = []
with open(openswap_conf_path, 'r') as openswap_file:
with open(os.path.join(root_mount_point, openswap_conf_path), 'r') as openswap_file:
lines = [x.strip() for x in openswap_file.readlines()]
for i in range(len(lines)):
......@@ -56,7 +56,7 @@ def write_openswap_conf(partitions, openswap_conf_path):
elif lines[i].startswith("keyfile_filename"):
lines[i] = "keyfile_filename=crypto_keyfile.bin"
with open(openswap_conf_path, 'w') as openswap_file:
with open(os.path.join(root_mount_point, openswap_conf_path), 'w') as openswap_file:
openswap_file.write("\n".join(lines) + "\n")
return None
......@@ -68,6 +68,7 @@ def run():
:return:
"""
root_mount_point = libcalamares.globalstorage.value("rootMountPoint")
openswap_conf_path = libcalamares.job.configuration["configFilePath"]
partitions = libcalamares.globalstorage.value("partitions")
return write_openswap_conf(partitions, openswap_conf_path)
return write_openswap_conf(partitions, root_mount_point, openswap_conf_path)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment