diff --git a/update_nextcloud.sh b/update_nextcloud.sh index 641d600..4d16ef3 100755 --- a/update_nextcloud.sh +++ b/update_nextcloud.sh @@ -759,17 +759,22 @@ sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $l if [[ $? -eq 0 ]]; then echo_ok else - echo_failed - error "$(cat $log_file)" + if grep -q -E "${_app}\s+already\s+installed" $log_file ; then + echo_skipped + warn "$(cat $log_file)" + else + echo_failed + error "$(cat $log_file)" - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " + echononl "continue anyway [yes/no]: " read OK - done - [[ $OK = "yes" ]] || fatal "Interrupted ny user." + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." + fi fi echononl "Eanable nextcloud app '$_app'.." @@ -803,17 +808,22 @@ sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $l if [[ $? -eq 0 ]]; then echo_ok else - echo_failed - error "$(cat $log_file)" + if grep -q -E "${_app}\s+already\s+installed" $log_file ; then + echo_skipped + warn "$(cat $log_file)" + else + echo_failed + error "$(cat $log_file)" - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " + echononl "continue anyway [yes/no]: " read OK - done - [[ $OK = "yes" ]] || fatal "Interrupted ny user." + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." + fi fi echononl "Eanable nextcloud app '$_app'.." @@ -847,17 +857,22 @@ sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $l if [[ $? -eq 0 ]]; then echo_ok else - echo_failed - error "$(cat $log_file)" + if grep -q -E "${_app}\s+already\s+installed" $log_file ; then + echo_skipped + warn "$(cat $log_file)" + else + echo_failed + error "$(cat $log_file)" - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " + echononl "continue anyway [yes/no]: " read OK - done - [[ $OK = "yes" ]] || fatal "Interrupted ny user." + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." + fi fi echononl "Eanable nextcloud app '$_app'.." @@ -892,17 +907,22 @@ sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $l if [[ $? -eq 0 ]]; then echo_ok else - echo_failed - error "$(cat $log_file)" + if grep -q -E "${_app}\s+already\s+installed" $log_file ; then + echo_skipped + warn "$(cat $log_file)" + else + echo_failed + error "$(cat $log_file)" - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " + echononl "continue anyway [yes/no]: " read OK - done - [[ $OK = "yes" ]] || fatal "Interrupted ny user." + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." + fi fi echononl "Eanable nextcloud app '$_app'.." @@ -936,17 +956,22 @@ sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $l if [[ $? -eq 0 ]]; then echo_ok else - echo_failed - error "$(cat $log_file)" + if grep -q -E "${_app}\s+already\s+installed" $log_file ; then + echo_skipped + warn "$(cat $log_file)" + else + echo_failed + error "$(cat $log_file)" - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " + echononl "continue anyway [yes/no]: " read OK - done - [[ $OK = "yes" ]] || fatal "Interrupted ny user." + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." + fi fi echononl "Eanable nextcloud app '$_app'.." @@ -1004,17 +1029,22 @@ sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $l if [[ $? -eq 0 ]]; then echo_ok else - echo_failed - error "$(cat $log_file)" + if grep -q -E "${_app}\s+already\s+installed" $log_file ; then + echo_skipped + warn "$(cat $log_file)" + else + echo_failed + error "$(cat $log_file)" - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " + echononl "continue anyway [yes/no]: " read OK - done - [[ $OK = "yes" ]] || fatal "Interrupted ny user." + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." + fi fi echononl "Eanable nextcloud app '$_app'.." @@ -1046,17 +1076,22 @@ sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $l if [[ $? -eq 0 ]]; then echo_ok else - echo_failed - error "$(cat $log_file)" + if grep -q -E "${_app}\s+already\s+installed" $log_file ; then + echo_skipped + warn "$(cat $log_file)" + else + echo_failed + error "$(cat $log_file)" - echononl "continue anyway [yes/no]: " - read OK - OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" - while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do - echononl "Wrong entry! - repeat [yes/no]: " + echononl "continue anyway [yes/no]: " read OK - done - [[ $OK = "yes" ]] || fatal "Interrupted ny user." + OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')" + while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do + echononl "Wrong entry! - repeat [yes/no]: " + read OK + done + [[ $OK = "yes" ]] || fatal "Interrupted ny user." + fi fi echononl "Eanable nextcloud app '$_app'.."