rwx/sh/util.sh
2024-11-29 19:18:30 +01:00

37 lines
565 B
Bash

rwx_list_block_devices() {
lsblk \
--noempty \
--output "NAME,SIZE,TYPE,FSTYPE,LABEL,MOUNTPOINTS"
}
rwx_not() {
case "${1}" in
"false") echo "true" ;;
"true") echo "false" ;;
*) ;;
esac
}
rwx_read_passphrase() {
rwx_read_secret "PassPhrase: "
}
rwx_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
}
rwx_warn_wipe() {
local tmp
rwx_list_block_devices
printf "%s" "WIPE ${*} /?\\ OR CANCEL /!\\"
read -r tmp
rwx_log_trace "${tmp}"
}