From 4590c5cda6eb08d7eada76162a13b4eb3faa61e8 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 22:52:21 +0100 Subject: [PATCH] fs_make_btrfs_swap --- bash/fs.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bash/fs.sh b/bash/fs.sh index e13a498..71db3a7 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -18,6 +18,24 @@ fs_make_btrfs() { fi } +fs_make_btrfs_swap() { + local path="${1}" + local size="${2}" + local uuid="${3}" + if [ -n "${path}" ]; then + set filesystem mkswapfile + if [ -n "${size}" ]; then + set -- "${@}" \ + --size "${size}" + fi + if [ -n "${uuid}" ]; then + set -- "${@}" \ + --uuid "${uuid}" + fi + btrfs "${@}" "${path}" + fi +} + fs_make_fat() { local device="${1}" local name="${2}"