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