Skip to content

Commit

Permalink
storage: Allow formatting as swap in Anaconda mode
Browse files Browse the repository at this point in the history
But there is no support for managing a entry for a new swap device in
fstab.
  • Loading branch information
mvollmer committed Jan 15, 2024
1 parent e0e3274 commit 1143d40
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/storaged/block/format-dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function format_dialog_internal(client, path, start, size, enable_dos_extended,
title = cockpit.format(_("Format $0"), block_name(block));

function is_filesystem(vals) {
return vals.type != "empty" && vals.type != "dos-extended" && vals.type != "biosboot";
return vals.type != "empty" && vals.type != "dos-extended" && vals.type != "biosboot" && vals.type != "swap";
}

function add_fsys(storaged_name, entry) {
Expand All @@ -187,6 +187,7 @@ function format_dialog_internal(client, path, start, size, enable_dos_extended,
add_fsys("vfat", { value: "vfat", title: "VFAT" });
add_fsys("ntfs", { value: "ntfs", title: "NTFS" });
if (client.in_anaconda_mode()) {
add_fsys("swap", { value: "swap", title: "Swap" });
if (block_ptable && block_ptable.Type == "gpt" && !client.anaconda.efi)
add_fsys(true, { value: "biosboot", title: "BIOS boot partition" });
if (block_ptable && client.anaconda.efi)
Expand Down Expand Up @@ -408,7 +409,7 @@ function format_dialog_internal(client, path, start, size, enable_dos_extended,
if (trigger == "at_boot")
dlg.set_options("at_boot", { explanation: mount_explanation[vals.at_boot] });
else if (trigger == "type") {
if (dlg.get_value("type") == "empty") {
if (dlg.get_value("type") == "empty" || dlg.get_value("type") == "swap") {
dlg.update_actions({ Variants: null, Title: _("Format") });
} else {
dlg.update_actions({ Variants: [action_variant], Title: action_title });
Expand Down

0 comments on commit 1143d40

Please sign in to comment.