From c2e6980876d8bcb476589419b37bb0cf04c01321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Drahn=C3=ADk?= Date: Mon, 25 Sep 2023 16:40:48 +0200 Subject: [PATCH] Repo root config can be changed (during testingfor example), do not consider that one as is filled with default values all time --- install.sh | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/install.sh b/install.sh index 6693a27..e73d87e 100755 --- a/install.sh +++ b/install.sh @@ -260,28 +260,21 @@ udevadm control --reload-rules echo "i2c-dev" | tee /etc/modules-load.d/i2c-dev.conf >/dev/null -CONFIG_FILE_DIFF="" -if test -f "$CONF_FILE"; then - if test -f "$CONFIG_FILE_NAME"; then - CONFIG_FILE_DIFF=$(diff <(grep -v '^#' $CONFIG_FILE_NAME) <(grep -v '^#' $CONF_FILE)) - fi -fi - -if [[ "$CONFIG_FILE_DIFF" != "" ]] || [[ -f "$CONF_FILE" ]]; then +if [[ -f "$CONF_FILE" ]]; then read -r -p "In system remains config file from previous installation. Do you want replace this with default config file [y/N]" response case "$response" in [yY][eE][sS]|[yY]) # default will be autocreated, so that is why remove - rm -f $CONF_FILE - if [[ $? != 0 ]]; then - echo "$CONF_FILE cannot be removed correctly..." - exit 1 - fi + rm -f $CONF_FILE + if [[ $? != 0 ]]; then + echo "$CONF_FILE cannot be removed correctly..." + exit 1 + fi ;; *) ;; esac else - echo "Installed default config which can be futher modified here:" + echo "Installed default config which can be futher modified here:" echo "$CONF_FILE" fi