From 36f35146d49e4e98de93d64dcb55935aab8e681e Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 13 Dec 2023 09:09:07 +0200 Subject: [PATCH] storage: Export mount points when in Anaconda mode --- pkg/storaged/client.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/storaged/client.js b/pkg/storaged/client.js index 25be444eed8d..ae2d17b6b0ef 100644 --- a/pkg/storaged/client.js +++ b/pkg/storaged/client.js @@ -609,6 +609,7 @@ client.update = (first_time) => { client.ready = true; if (client.ready) { update_indices(); + client.export_mount_point_mapping(); reset_pages(); make_overview_page(); client.dispatchEvent("changed"); @@ -1529,4 +1530,20 @@ client.should_ignore_block = (block) => { return client.should_ignore_device(utils.decode_filename(block.PreferredDevice)); }; +client.export_mount_point_mapping = () => { + const mpm = { }; + for (const p in client.blocks) { + const b = client.blocks[p]; + for (const c of b.Configuration) { + if (c[0] == "fstab") { + const dir = client.strip_mount_point_prefix(utils.decode_filename(c[1].dir.v)); + if (dir) + mpm[dir] = utils.decode_filename(b.PreferredDevice); + } + } + } + + window.localStorage.setItem("cockpit_mount_points", JSON.stringify(mpm)); +}; + export default client;