mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
Replace unmount read loop with awk
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
This commit is contained in:
parent
041f18f6da
commit
5ad76043ac
13
install.sh
13
install.sh
@ -546,18 +546,7 @@ getshims() {
|
|||||||
killtree $({ set +x; } 2>/dev/null; getshims; set -x)
|
killtree $({ set +x; } 2>/dev/null; getshims; set -x)
|
||||||
|
|
||||||
do_unmount() {
|
do_unmount() {
|
||||||
{ set +x; } 2>/dev/null
|
awk -v path="$1" '$2 ~ ("^" path) { print $2 }' /proc/self/mounts | sort -r | xargs -r -t -n 1 umount
|
||||||
MOUNTS=
|
|
||||||
while read ignore mount ignore; do
|
|
||||||
MOUNTS="$mount\n$MOUNTS"
|
|
||||||
done </proc/self/mounts
|
|
||||||
MOUNTS=$(printf $MOUNTS | grep "^$1" | sort -r)
|
|
||||||
if [ -n "${MOUNTS}" ]; then
|
|
||||||
set -x
|
|
||||||
xargs -n 1 umount <<< ${MOUNTS}
|
|
||||||
else
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_unmount '/run/k3s'
|
do_unmount '/run/k3s'
|
||||||
|
@ -546,18 +546,7 @@ getshims() {
|
|||||||
killtree $({ set +x; } 2>/dev/null; getshims; set -x)
|
killtree $({ set +x; } 2>/dev/null; getshims; set -x)
|
||||||
|
|
||||||
do_unmount() {
|
do_unmount() {
|
||||||
{ set +x; } 2>/dev/null
|
awk -v path="$1" '$2 ~ ("^" path) { print $2 }' /proc/self/mounts | sort -r | xargs -r -t -n 1 umount
|
||||||
MOUNTS=
|
|
||||||
while read ignore mount ignore; do
|
|
||||||
MOUNTS="$mount\n$MOUNTS"
|
|
||||||
done </proc/self/mounts
|
|
||||||
MOUNTS=$(printf $MOUNTS | grep "^$1" | sort -r)
|
|
||||||
if [ -n "${MOUNTS}" ]; then
|
|
||||||
set -x
|
|
||||||
xargs -n 1 umount <<< ${MOUNTS}
|
|
||||||
else
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_unmount '/run/k3s'
|
do_unmount '/run/k3s'
|
||||||
|
Loading…
Reference in New Issue
Block a user