diff --git a/src/freedombone-utils-android b/src/freedombone-utils-android index 78b9ff57..f12d6b30 100755 --- a/src/freedombone-utils-android +++ b/src/freedombone-utils-android @@ -58,49 +58,54 @@ function android_update_apps { "${app_name_upper}_DESCRIPTION"= "${app_name_upper}_ICON_URL"= "${app_name_upper}_MOBILE_APP_URL"= - if ! grep "${app_name_upper}_SHORT_DESCRIPTION=" "$app_filename"; then + if grep -q "${app_name_upper}_SHORT_DESCRIPTION=" "$app_filename"; then # shellcheck disable=SC2140 "${app_name_upper}_SHORT_DESCRIPTION"="$(grep "${app_name_upper}_SHORT_DESCRIPTION=" "$app_filename" | head -n 1 | awk -F '=' '{print $2}')" fi - if ! grep "${app_name_upper}_DESCRIPTION=" "$app_filename"; then + if grep -q "${app_name_upper}_DESCRIPTION=" "$app_filename"; then # shellcheck disable=SC2140 "${app_name_upper}_DESCRIPTION"="$(grep "${app_name_upper}_DESCRIPTION=" "$app_filename" | head -n 1 | awk -F '=' '{print $2}')" fi - if ! grep "${app_name_upper}_ICON_URL=" "$app_filename"; then + if grep -q "${app_name_upper}_ICON_URL=" "$app_filename"; then # shellcheck disable=SC2140 "${app_name_upper}_ICON_URL"="$(grep "${app_name_upper}_ICON_URL=" "$app_filename" | head -n 1 | awk -F '=' '{print $2}')" fi - if ! grep "${app_name_upper}_MOBILE_APP_URL=" "$app_filename"; then + if grep -q "${app_name_upper}_MOBILE_APP_URL=" "$app_filename"; then # shellcheck disable=SC2140 "${app_name_upper}_MOBILE_APP_URL"="$(grep "${app_name_upper}_MOBILE_APP_URL=" "$app_filename" | head -n 1 | awk -F '=' '{print $2}')" fi { echo ' {'; echo " \"name\": \"${app_name}\","; - echo " \"short_description\": \"${app_name_upper}_SHORT_DESCRIPTION\","; - echo " \"description\": \"${app_name_upper}_DESCRIPTION\","; - echo " \"icon_url\": \"${app_name_upper}_ICON_URL\","; - echo " \"clients\": ["; - echo ' {'; - echo " \"name\": \"${app_name}\","; - echo " \"platforms\": ["; - echo ' {'; - echo ' "type": "web",'; - echo " \"url\": \"${app_name_upper}_DOMAIN_NAME\""; - echo ' }'; - echo ' ]'; - echo -n ' }'; } >> "$plinth_api" + echo " \"short_description\": \"$((${app_name_upper}_SHORT_DESCRIPTION))\","; + echo " \"description\": \"$((${app_name_upper}_DESCRIPTION))\","; + echo " \"icon_url\": \"$((${app_name_upper}_ICON_URL))\","; + echo " \"clients\": ["; } >> "$plinth_api" - if [[ $(("${app_name_upper}_MOBILE_APP_URL")) ]]; then - { echo ','; - echo ' {'; + if [ $(("${app_name_upper}_DOMAIN_NAME")) ]; then + { echo ' {'; + echo " \"name\": \"${app_name}\","; + echo " \"platforms\": ["; + echo ' {'; + echo ' "type": "web",'; + echo " \"url\": \"$((${app_name_upper}_DOMAIN_NAME))\""; + echo ' }'; + echo ' ]'; + echo -n ' }'; } >> "$plinth_api" + fi + + if [ $(("${app_name_upper}_MOBILE_APP_URL")) ]; then + if [ $(("${app_name_upper}_DOMAIN_NAME")) ]; then + echo ',' >> "$plinth_api" + fi + { echo ' {'; echo " \"name\": \"${app_name}\","; echo " \"platforms\": ["; echo ' {'; echo ' "type": "store",'; echo ' "os": "android",'; echo ' "store_name": "f-droid",'; - echo " \"url\": \"${app_name_upper}_MOBILE_APP_URL\""; + echo " \"url\": \"$((${app_name_upper}_MOBILE_APP_URL))\""; echo ' }'; echo ' ]'; echo -n ' }'; } >> "$plinth_api"