[Feature request] handling tty requests for user input
Hi guys, I was thinking that it would be nice to have an option to add an ability to handle user input when it is necessary, for instance, I have luks-tpm2
hook which initiates a setting of temporary luks passphrase when updating kernel / bootloader / initramfs using /dev/tty
:
if cryptsetup luksAddKey --key-slot $RESET_KEY_SLOT --key-file "$KEYFILE" $ROOT_DEVICE < /dev/tty; then
echo "After booting into the current kernel, run"
echo " luks-tpm2 $(echo $ORIGINAL_ARGS | sed 's/temp$/reset/')"
echo "to generate a new LUKS key and remove this temporary key"
else
echo "A temporary passphrase was not set" >&2
RETURN_CODE=5
fi
}
It is a part of /usr/bin/luks-tpm2
script, temp
command.
It works flawlessly when updating via pacman in tty or terminal:
...
Unsealing keyfile...
Preparing to set a temporary LUKS passphrase for /dev/nvme0n1p6...
Enter new passphrase for key slot:
Verify passphrase:
After booting into the current kernel, run
luks-tpm2 reset
to generate a new LUKS key and remove this temporary key
...
Pamac does not support this so one has to run sudo luks-tpm2 temp
command manually:
...
Adding temporary LUKS TPM key...
Unsealing keyfile...
Preparing to set a temporary LUKS passphrase for /dev/nvme0n1p6...
/usr/bin/luks-tpm2: line 99: /dev/tty: No such device or address
A temporary passphrase was not set
Error: command failed to execute correctly
...
I think implementing this would be great for all packages that require post-install configuration and have some built-in means for such purpose. This is not a dig deal (for me at least) but being on par with pacman is a good thing I guess.