mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 01:51:00 +03:00
64025fa3a1
Commit d2bce6d03
added the 'make checkbashisms' target but did not
resolve all of the bashisms in the scripts. This commit doesn't
resolve them all either but it does fix up a few, and it excludes
the others so 'make checkstyle' no longer prints warnings. It's
a small step in the right direction.
* Dracut is Linux specific and itself depends on bash. Therefore
all dracut support scripts can be bash specific, update their
shebang accordingly.
* zed-functions.sh, zfs-import, zfs-mount, zfs-zed, smart
paxcheck.sh, make_gitrev.sh - these scripts were excuded from
the check until they can be updated and properly tested.
* zfsunlock - only whole values for sleep are allowed.
* vdev_id - removed unneeded locals; use && instead of -a.
* dkms.mkconf, dkms.postbuil - use || instead of -o.
Reviewed-by: InsanePrawn <insane.prawny@gmail.com>
Reviewed-by: Gabriel A. Devenyi <gdevenyi@gmail.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #10755
43 lines
1.3 KiB
Bash
Executable File
43 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -eu
|
|
if [ ! -e /run/zfs_fs_name ]; then
|
|
echo "Wait for the root pool to be imported or press Ctrl-C to exit."
|
|
fi
|
|
while [ ! -e /run/zfs_fs_name ]; do
|
|
if [ -e /run/zfs_unlock_complete ]; then
|
|
exit 0
|
|
fi
|
|
sleep 1
|
|
done
|
|
echo
|
|
echo "Unlocking encrypted ZFS filesystems..."
|
|
echo "Enter the password or press Ctrl-C to exit."
|
|
echo
|
|
zfs_fs_name=""
|
|
if [ ! -e /run/zfs_unlock_complete_notify ]; then
|
|
mkfifo /run/zfs_unlock_complete_notify
|
|
fi
|
|
while [ ! -e /run/zfs_unlock_complete ]; do
|
|
zfs_fs_name=$(cat /run/zfs_fs_name)
|
|
zfs_console_askpwd_cmd=$(cat /run/zfs_console_askpwd_cmd)
|
|
systemd-ask-password "Encrypted ZFS password for ${zfs_fs_name}:" | \
|
|
/sbin/zfs load-key "$zfs_fs_name" || true
|
|
if [ "$(/sbin/zfs get -H -ovalue keystatus "$zfs_fs_name" 2> /dev/null)" = "available" ]; then
|
|
echo "Password for $zfs_fs_name accepted."
|
|
zfs_console_askpwd_pid=$(ps | awk '!'"/awk/ && /$zfs_console_askpwd_cmd/ { print \$1; exit }")
|
|
if [ -n "$zfs_console_askpwd_pid" ]; then
|
|
kill "$zfs_console_askpwd_pid"
|
|
fi
|
|
# Wait for another filesystem to unlock.
|
|
while [ "$(cat /run/zfs_fs_name)" = "$zfs_fs_name" ] && [ ! -e /run/zfs_unlock_complete ]; do
|
|
sleep 1
|
|
done
|
|
else
|
|
echo "Wrong password. Try again."
|
|
fi
|
|
done
|
|
echo "Unlocking complete. Resuming boot sequence..."
|
|
echo "Please reconnect in a while."
|
|
echo "ok" > /run/zfs_unlock_complete_notify
|