From dfe3be4f1cf521d24f49713c2196af66bbad2078 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 20:03:47 +0100 Subject: [PATCH] fat --- bash/fs.sh | 19 +++++++++++++++++++ bash/rescue-hetzner.sh | 7 +------ bash/rescue-ovh.sh | 7 +------ 3 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 bash/fs.sh diff --git a/bash/fs.sh b/bash/fs.sh new file mode 100644 index 0000000..df0980e --- /dev/null +++ b/bash/fs.sh @@ -0,0 +1,19 @@ +fs_make_fat() { + local device="${1}" + local name="${2}" + local volid="${3}" + if [ -b "${device}" ]; then + set -- \ + -F 32 \ + -S 4096 + if [ -n "${name}" ]; then + set -- "${@}" \ + -n "${name}" + fi + if [ -n "${volid}" ]; then + set -- "${@}" \ + -i "${volid}" + fi + mkfs.fat "${@}" "${device}" + fi +} diff --git a/bash/rescue-hetzner.sh b/bash/rescue-hetzner.sh index 4536e47..3ca0f3b 100644 --- a/bash/rescue-hetzner.sh +++ b/bash/rescue-hetzner.sh @@ -49,12 +49,7 @@ rescue_wipe_0_init_hetzner_8_8() { # format esp dd \ if="/dev/zero" of="${device}3" bs="1M" - mkfs.vfat \ - -F 32 \ - -S 4096 \ - -i "0000000${number}" \ - -n "esp-${number}" \ - "${device}3" + fs_make_fat "${device}3" "esp-${number}" "0000000${number}" # mount esp mkdir --parents "/media/esp/${number}" mount "${device}3" "/media/esp/${number}" diff --git a/bash/rescue-ovh.sh b/bash/rescue-ovh.sh index c267929..63c5192 100644 --- a/bash/rescue-ovh.sh +++ b/bash/rescue-ovh.sh @@ -22,12 +22,7 @@ rescue_wipe_0_init_ovh_vle2() { # esp / wipe dd if="/dev/zero" of="${device}3" bs="1M" # esp / format - mkfs.vfat \ - -F 32 \ - -S 4096 \ - -i "00000001" \ - -n "esp" \ - "${device}3" + fs_make_fat "${device}3" "esp" "00000001" # esp / mount mkdir --parents "/media/esp" mount "${device}3" "/media/esp"