Commit d3317001 authored by Tails developers's avatar Tails developers
Browse files

Add upper bound counters on the unmount/kill loops.

parent 1c9a2caf
...@@ -11,15 +11,22 @@ TOR_DESCRIPTORS=${TOR_DIR}/cached-descriptors ...@@ -11,15 +11,22 @@ TOR_DESCRIPTORS=${TOR_DIR}/cached-descriptors
cleanup () { cleanup () {
# Break down the chroot # Break down the chroot and kill all of its processes
while pgrep -u ${CLEARNET_USER} &>/dev/null; do local counter=0
local ret=0
while [ "${counter}" -le 10 ] && pgrep -u ${CLEARNET_USER} &>/dev/null; do
pkill -u ${CLEARNET_USER} &>/dev/null pkill -u ${CLEARNET_USER} &>/dev/null
sleep 1 sleep 1
done done
[ ${ret} -eq 0 ] || pkill -9 -u ${CLEARNET_USER} &>/dev/null
for mnt in ${CHROOT}{/dev,/proc,} ${COW} ${ROFS}; do for mnt in ${CHROOT}{/dev,/proc,} ${COW} ${ROFS}; do
while mountpoint ${mnt} &>/dev/null; do counter=0
while [ "${counter}" -le 10 ] && mountpoint ${mnt} &>/dev/null; do
umount ${mnt} &>/dev/null umount ${mnt} &>/dev/null
sleep 1 sleep 1
done done
done done
rmdir ${ROFS} ${COW} ${CHROOT} &>/dev/null rmdir ${ROFS} ${COW} ${CHROOT} &>/dev/null
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment