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 <joakim.roubert@axis.com>
This commit is contained in:
Joakim Roubert 2021-07-30 15:41:47 +02:00 committed by Brad Davidson
parent dfd4e42e57
commit 80a15bebc0

View File

@ -617,7 +617,11 @@ getshims() {
killtree $({ set +x; } 2>/dev/null; getshims; set -x) killtree $({ set +x; } 2>/dev/null; getshims; set -x)
do_unmount_and_remove() { 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' do_unmount_and_remove '/run/k3s'