aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorRichard Laager <[email protected]>2020-05-10 14:26:08 -0500
committerGitHub <[email protected]>2020-05-10 12:26:08 -0700
commit7fcf82451c4b75afe327c77683f66bf0c6396a48 (patch)
tree5ad1e9b5a2bcc6f753fd0f8c06a93e4591e38a4e /contrib
parentfc551d7efbbf26cc1671ddb51f2f0df57ec53ee7 (diff)
Change zfsunlock for better busybox compatibility
It turns out that there are two versions of Busybox, at least on Ubuntu 18.04. If you have the busybox-static package installed, you get a busybox that supports `ps a` and `head`. If you only have busybox-initramfs, you don't. Either way, you have `awk`. This change should also make this compatible with GNU ps, if you somehow end up with that in the initramfs environment. Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Andrey Prokopenko <[email protected]> Signed-off-by: Richard Laager <[email protected]> Closes #10307
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/initramfs/zfsunlock2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/initramfs/zfsunlock b/contrib/initramfs/zfsunlock
index 1202a144d..f6b6b9dbe 100755
--- a/contrib/initramfs/zfsunlock
+++ b/contrib/initramfs/zfsunlock
@@ -25,7 +25,7 @@ while [ ! -e /run/zfs_unlock_complete ]; do
/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 a -o pid= -o args | grep -v grep | grep "$zfs_console_askpwd_cmd" | cut -d ' ' -f3 | sort -n | head -n1)
+ 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