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}"