From 4e7e497c07d9b8bbb7ba938b2d57137f021f9432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebleu?= Date: Tue, 17 May 2016 13:43:22 +0200 Subject: [PATCH] [fix] Retrieve proper CardDAV app_id and fix unknown continue command --- scripts/_common.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 4a69ba6..8f28b29 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -106,17 +106,18 @@ install_carddav() { # Look for installed and supported CardDAV servers for carddav_app in "owncloud" "baikal"; do - sudo yunohost app list --installed -f "$carddav_app" | grep -q id \ - || continue - - # Retrieve app settings and enable relevant preset - carddav_domain=$(ynh_app_setting_get "$carddav_app" domain) - carddav_path=$(ynh_app_setting_get "$carddav_app" path) - carddav_url="https://${carddav_domain}${carddav_path%/}" - sed -i "s#{${carddav_app}_url}#${carddav_url}#g" "$carddav_tmp_config" - sed -i \ + local app_id=$(sudo yunohost app list --installed --output-as plain \ + -f "$carddav_app" | ynh_get_plain_key '#id' | head -1) + [[ -z "$app_id" ]] || { + # Retrieve app settings and enable relevant preset + carddav_domain=$(ynh_app_setting_get "$app_id" domain) + carddav_path=$(ynh_app_setting_get "$app_id" path) + carddav_url="https://${carddav_domain}${carddav_path%/}" + sed -i "s#{${carddav_app}_url}#${carddav_url}#g" "$carddav_tmp_config" + sed -i \ "/\/\/\/\/ PRESET FOR: ${carddav_app}/\ ,/\/\/\/\/ END: ${carddav_app}/s/^\/\///" "$carddav_tmp_config" + } done # Copy plugin the configuration file