This commit is contained in:
Bob Mottram 2018-05-25 18:45:09 +01:00
parent 26c6a36b72
commit d59aa5dac9
1 changed files with 17 additions and 20 deletions

View File

@ -51,10 +51,10 @@ function android_update_apps {
app_filename="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${app_name}"
if [ -f "$app_filename" ]; then
app_name_upper=$(echo "$app_name" | awk '{print toupper($0)}')
"${app_name_upper}_SHORT_DESCRIPTION"=
"${app_name_upper}_DESCRIPTION"=
"${app_name_upper}_ICON_URL"=
"${app_name_upper}_MOBILE_APP_URL"=
SHORT_DESCRIPTION=
DESCRIPTION=
ICON_URL=
MOBILE_APP_URL=
if ! grep -q "${app_name_upper}_SHORT_DESCRIPTION=" "$app_filename"; then
continue
@ -62,20 +62,16 @@ function android_update_apps {
if grep -q "#${app_name_upper}_SHORT_DESCRIPTION=" "$app_filename"; then
continue
fi
# shellcheck disable=SC2140
"${app_name_upper}_SHORT_DESCRIPTION"="$(grep "${app_name_upper}_SHORT_DESCRIPTION=" "$app_filename" | head -n 1 | awk -F '=' '{print $2}')"
SHORT_DESCRIPTION=$(grep "${app_name_upper}_SHORT_DESCRIPTION=" "$app_filename" | head -n 1 | sed 's|\$||g' | awk -F '=' '{print $2}')
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}')"
DESCRIPTION="$(grep "${app_name_upper}_DESCRIPTION=" "$app_filename" | head -n 1 | sed 's|\$||g' | sed 's|\$||g' | awk -F '=' '{print $2}')"
fi
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}')"
ICON_URL="$(grep "${app_name_upper}_ICON_URL=" "$app_filename" | head -n 1 | sed 's|\$||g' | sed 's|\$||g' | awk -F '=' '{print $2}')"
fi
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}')"
MOBILE_APP_URL="$(grep "${app_name_upper}_MOBILE_APP_URL=" "$app_filename" | head -n 1 | sed 's|\$||g' | sed 's|\$||g' | awk -F '=' '{print $2}')"
fi
if [ $android_ctr -gt 0 ]; then
@ -84,25 +80,26 @@ function android_update_apps {
{ 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 " \"short_description\": \"$SHORT_DESCRIPTION\",";
echo " \"description\": \"$DESCRIPTION))\",";
echo " \"icon_url\": \"$ICON_URL\",";
echo " \"clients\": ["; } >> "$plinth_api"
if [[ $(("${app_name_upper}_DOMAIN_NAME")) && "$app_name" != 'matrix' ]]; then
domain_name=$(("${app_name_upper}_DOMAIN_NAME"))
if [[ "$domain_name" && "$app_name" != 'matrix' ]]; then
{ echo ' {';
echo " \"name\": \"${app_name}\",";
echo " \"platforms\": [";
echo ' {';
echo ' "type": "web",';
echo " \"url\": \""$((${app_name_upper}_DOMAIN_NAME))"\"";
echo " \"url\": \"$domain_name\"";
echo ' }';
echo ' ]';
echo -n ' }'; } >> "$plinth_api"
fi
if [ $(("${app_name_upper}_MOBILE_APP_URL")) ]; then
if [[ $(("${app_name_upper}_DOMAIN_NAME")) && "$app_name" != 'matrix' ]]; then
if [ "$MOBILE_APP_URL" ]; then
if [[ "$domain_name" && "$app_name" != 'matrix' ]]; then
echo ',' >> "$plinth_api"
fi
{ echo ' {';
@ -112,7 +109,7 @@ function android_update_apps {
echo ' "type": "store",';
echo ' "os": "android",';
echo ' "store_name": "f-droid",';
echo " \"url\": \""$((${app_name_upper}_MOBILE_APP_URL))"\"";
echo " \"url\": \"$MOBILE_APP_URL\"";
echo ' }';
echo ' ]';
echo -n ' }'; } >> "$plinth_api"