Merge pull request #1 from gobborg/fix-shellscript-delconfig

Print abort() echo 'Installation aborted' to stdout. Allow \n (ENTER)…
This commit is contained in:
gobborg 2023-08-03 11:11:25 +00:00 committed by GitHub
commit 33e2911655
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,7 +34,7 @@ comfortable-swipe stop > /dev/null 2>&1 || true
# shorthand to abort the installation # shorthand to abort the installation
function abort { function abort {
echo "Installation aborted" echo "Installation aborted" >&2
exit 1 exit 1
} }
@ -67,10 +67,12 @@ 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,,}" =~ ^(yes|y)$ ]]; then if ! [[ "${response,,}" =~ ^(no|n)$ ]] || [[ "$response" == "" ]]; then
continue
else
# 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,,}" =~ ^(yes|y)$ ]]; then if ! [[ "${response,,}" =~ ^(no|n)$ ]] || [[ "$response" == "" ]]; then
# They agreed... replace configuration # They agreed... replace configuration
cat "$CONF_SOURCE" > "$CONF_TARGET" cat "$CONF_SOURCE" > "$CONF_TARGET"
else else