Actually handling the null response instead of galaxy brained putting a 'continue' as a placeholder in a conditional tree.
This commit is contained in:
parent
33e2911655
commit
be69840182
19
install
19
install
@ -67,16 +67,23 @@ function install_configuration_file {
|
|||||||
# ask user if we overwrite configuration
|
# ask user if we overwrite configuration
|
||||||
echo "Old conf file found in $CONF_TARGET" >&2
|
echo "Old conf file found in $CONF_TARGET" >&2
|
||||||
read -r -p "Keep the old conf file? (default: yes) [Y/n] " response >&2
|
read -r -p "Keep the old conf file? (default: yes) [Y/n] " response >&2
|
||||||
if ! [[ "${response,,}" =~ ^(no|n)$ ]] || [[ "$response" == "" ]]; then
|
|
||||||
continue
|
# If response is empty, consider it as 'yes' (default)
|
||||||
else
|
if [[ -z "$response" ]]; then
|
||||||
|
response="y"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${response,,}" =~ ^(no|n)$ ]]; then
|
||||||
# MAKE SURE they really want to overwrite
|
# MAKE SURE they really want to overwrite
|
||||||
read -r -p "Conf file will be overwritten! Are you sure? [Y/n] " response >&2
|
read -r -p "Conf file will be overwritten! Are you sure? [Y/n] " response >&2
|
||||||
if ! [[ "${response,,}" =~ ^(no|n)$ ]] || [[ "$response" == "" ]]; then
|
if [[ -z "$response" ]]; then
|
||||||
|
response="y"
|
||||||
|
fi
|
||||||
|
if [[ "${response,,}" =~ ^(no|n)$ ]]; then
|
||||||
|
abort
|
||||||
|
else
|
||||||
# They agreed... replace configuration
|
# They agreed... replace configuration
|
||||||
cat "$CONF_SOURCE" > "$CONF_TARGET"
|
cat "$CONF_SOURCE" > "$CONF_TARGET"
|
||||||
else
|
|
||||||
abort
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user