Browse Source

Replace unmount read loop with awk

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/2210/head
Brad Davidson 4 years ago committed by Brad Davidson
parent
commit
5ad76043ac
  1. 13
      install.sh
  2. 13
      package/rpm/install.sh

13
install.sh

@ -546,18 +546,7 @@ getshims() {
killtree $({ set +x; } 2>/dev/null; getshims; set -x)
do_unmount() {
{ set +x; } 2>/dev/null
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
awk -v path="$1" '$2 ~ ("^" path) { print $2 }' /proc/self/mounts | sort -r | xargs -r -t -n 1 umount
}
do_unmount '/run/k3s'

13
package/rpm/install.sh

@ -546,18 +546,7 @@ getshims() {
killtree $({ set +x; } 2>/dev/null; getshims; set -x)
do_unmount() {
{ set +x; } 2>/dev/null
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
awk -v path="$1" '$2 ~ ("^" path) { print $2 }' /proc/self/mounts | sort -r | xargs -r -t -n 1 umount
}
do_unmount '/run/k3s'

Loading…
Cancel
Save