From fdffd7fb08549d21d7d6b94aa9b7573712d3aad1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 22:38:38 +0100 Subject: [PATCH] fs_make_btrfs --- bash/fs.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/bash/fs.sh b/bash/fs.sh index 1b2e72b..e13a498 100644 --- a/bash/fs.sh +++ b/bash/fs.sh @@ -1,3 +1,23 @@ +fs_make_btrfs() { + local device="${1}" + local label="${2}" + local uuid="${3}" + if [ -b "${device}" ]; then + set -- \ + --force \ + --checksum "sha256" + if [ -n "${label}" ]; then + set -- "${@}" \ + --label "${label}" + fi + if [ -n "${uuid}" ]; then + set -- "${@}" \ + --uuid "${uuid}" + fi + mkfs.btrfs "${@}" "${device}" + fi +} + fs_make_fat() { local device="${1}" local name="${2}"