#!/bin/bash

set -e

# Takes two arguments, a variable name and a path to use as the wait file. If
# the variable is "true", then the wait file will be created and the script will
# wait for as long as it exists.

if [ "$(eval echo \"\$$1\")" != "true" ]; then
    exit 0
fi

touch "$2"
echo "$1 == true. Waiting indefinitely until $2 is removed."
while [ -f "$2" ]; do
    sleep 10
done

#!/bin/bash

set -e

# Takes two arguments, a variable name and a path to use as the wait file. If
# the variable is "true", then the wait file will be created and the script will
# wait for as long as it exists.

if [ "$(eval echo \"\$$1\")" = "true" ]; then
    touch "$2"
fi

while [ -f "$2" ]; do
    echo "Waiting indefinitely until $2 is removed."
    sleep 10
done

Make it possible to wait in a stage by manual intervention on the host.
Make it possible to wait in a stage by manual intervention on the host.

This is handy if you're trying to debug a stage which you are
retrying. It's impossible to change the environment, but you can log
into the host and create the WAIT file.

Signed-off-by: Kristian Amlie <505e66ae45028a0596c853559221f0b72c1cee21@northern.tech>
