sh/shell/util.sh
2024-11-16 13:25:02 +01:00

37 lines
533 B
Bash

list_block_devices() {
lsblk \
--noempty \
--output "NAME,SIZE,TYPE,FSTYPE,LABEL,MOUNTPOINTS"
}
not() {
case "${1}" in
"false") echo "true" ;;
"true") echo "false" ;;
*) ;;
esac
}
read_passphrase() {
read_secret "PassPhrase: "
}
read_secret() {
local prompt="${1}"
local secret
printf "%s" "${prompt}" 1>&2
stty -echo
read -r secret
stty echo
echo >&2
echo "${secret}"
unset secret
}
warn_wipe() {
local tmp
list_block_devices
printf "%s" "WIPE ${*} /?\\ OR CANCEL /!\\"
read -r tmp
log_trace "${tmp}"
}