Only add web client if a corresponding domain variable exists

This commit is contained in:
Bob Mottram 2018-05-25 15:34:09 +01:00
parent 287ad1b2d4
commit 95b0f1cbee
1 changed files with 26 additions and 21 deletions

View File

@ -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"