40 lines
653 B
Bash
40 lines
653 B
Bash
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
|
|
}
|
|
|
|
fs_wipe() {
|
|
local device="${1}"
|
|
local buffer="${2}"
|
|
local count="${3}"
|
|
if [ -b "${device}" ]; then
|
|
set -- \
|
|
status="progress" \
|
|
if="/dev/zero" \
|
|
of="${device}"
|
|
if [ -n "${buffer}" ]; then
|
|
set -- "${@}" \
|
|
bs="${buffer}"
|
|
fi
|
|
if [ -n "${count}" ]; then
|
|
set -- "${@}" \
|
|
count=${count}
|
|
fi
|
|
dd "${@}"
|
|
fi
|
|
}
|