From 80a15bebc0eee11a33ab899acb659a59b218ddfc Mon Sep 17 00:00:00 2001 From: Joakim Roubert Date: Fri, 30 Jul 2021 15:41:47 +0200 Subject: [PATCH] install.sh: Use built-in shell functionality instead of awk If install.sh relies on awk, install.sh malfunctions when run on a device with a limited environment where awk is not available. This patch replaces the use of awk with built-in shell script functionality. Fixes: #3737 Signed-off-by: Joakim Roubert --- install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 9909c07119..6ec1cd2cab 100755 --- a/install.sh +++ b/install.sh @@ -617,7 +617,11 @@ getshims() { killtree $({ set +x; } 2>/dev/null; getshims; set -x) do_unmount_and_remove() { - awk -v path="$1" '$2 ~ ("^" path) { print $2 }' /proc/self/mounts | sort -r | xargs -r -t -n 1 sh -c 'umount "$0" && rm -rf "$0"' + set +x + while read -r _ path _; do + case "$path" in $1*) echo "$path" ;; esac + done < /proc/self/mounts | sort -r | xargs -r -t -n 1 sh -c 'umount "$0" && rm -rf "$0"' + set -x } do_unmount_and_remove '/run/k3s'