Bob Mottram 6 år sedan
förälder
incheckning
d59aa5dac9
1 ändrade filer med 17 tillägg och 20 borttagningar
  1. 17
    20
      src/freedombone-utils-android

+ 17
- 20
src/freedombone-utils-android Visa fil

@@ -51,10 +51,10 @@ function android_update_apps {
51 51
             app_filename="/usr/share/${PROJECT_NAME}/apps/${PROJECT_NAME}-app-${app_name}"
52 52
             if [ -f "$app_filename" ]; then
53 53
                 app_name_upper=$(echo "$app_name" | awk '{print toupper($0)}')
54
-                "${app_name_upper}_SHORT_DESCRIPTION"=
55
-                "${app_name_upper}_DESCRIPTION"=
56
-                "${app_name_upper}_ICON_URL"=
57
-                "${app_name_upper}_MOBILE_APP_URL"=
54
+                SHORT_DESCRIPTION=
55
+                DESCRIPTION=
56
+                ICON_URL=
57
+                MOBILE_APP_URL=
58 58
 
59 59
                 if ! grep -q "${app_name_upper}_SHORT_DESCRIPTION=" "$app_filename"; then
60 60
                     continue
@@ -62,20 +62,16 @@ function android_update_apps {
62 62
                 if grep -q "#${app_name_upper}_SHORT_DESCRIPTION=" "$app_filename"; then
63 63
                     continue
64 64
                 fi
65
-                # shellcheck disable=SC2140
66
-                "${app_name_upper}_SHORT_DESCRIPTION"="$(grep "${app_name_upper}_SHORT_DESCRIPTION=" "$app_filename" | head -n 1 | awk -F '=' '{print $2}')"
65
+                SHORT_DESCRIPTION=$(grep "${app_name_upper}_SHORT_DESCRIPTION=" "$app_filename" | head -n 1 | sed 's|\$||g' | awk -F '=' '{print $2}')
67 66
 
68 67
                 if grep -q "${app_name_upper}_DESCRIPTION=" "$app_filename"; then
69
-                    # shellcheck disable=SC2140
70
-                    "${app_name_upper}_DESCRIPTION"="$(grep "${app_name_upper}_DESCRIPTION=" "$app_filename" | head -n 1 | awk -F '=' '{print $2}')"
68
+                    DESCRIPTION="$(grep "${app_name_upper}_DESCRIPTION=" "$app_filename" | head -n 1 | sed 's|\$||g' | sed 's|\$||g' | awk -F '=' '{print $2}')"
71 69
                 fi
72 70
                 if grep -q "${app_name_upper}_ICON_URL=" "$app_filename"; then
73
-                    # shellcheck disable=SC2140
74
-                    "${app_name_upper}_ICON_URL"="$(grep "${app_name_upper}_ICON_URL=" "$app_filename" | head -n 1 | awk -F '=' '{print $2}')"
71
+                    ICON_URL="$(grep "${app_name_upper}_ICON_URL=" "$app_filename" | head -n 1 | sed 's|\$||g' | sed 's|\$||g' | awk -F '=' '{print $2}')"
75 72
                 fi
76 73
                 if grep -q "${app_name_upper}_MOBILE_APP_URL=" "$app_filename"; then
77
-                    # shellcheck disable=SC2140
78
-                    "${app_name_upper}_MOBILE_APP_URL"="$(grep "${app_name_upper}_MOBILE_APP_URL=" "$app_filename" | head -n 1 | awk -F '=' '{print $2}')"
74
+                    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}')"
79 75
                 fi
80 76
 
81 77
                 if [ $android_ctr -gt 0 ]; then
@@ -84,25 +80,26 @@ function android_update_apps {
84 80
 
85 81
                 { echo '    {';
86 82
                   echo "      \"name\": \"${app_name}\",";
87
-                  echo "      \"short_description\": \""$((${app_name_upper}_SHORT_DESCRIPTION))"\",";
88
-                  echo "      \"description\": \""$((${app_name_upper}_DESCRIPTION))"\",";
89
-                  echo "      \"icon_url\": \""$((${app_name_upper}_ICON_URL))"\",";
83
+                  echo "      \"short_description\": \"$SHORT_DESCRIPTION\",";
84
+                  echo "      \"description\": \"$DESCRIPTION))\",";
85
+                  echo "      \"icon_url\": \"$ICON_URL\",";
90 86
                   echo "      \"clients\": ["; } >> "$plinth_api"
91 87
 
92
-                if [[ $(("${app_name_upper}_DOMAIN_NAME")) && "$app_name" != 'matrix' ]]; then
88
+                domain_name=$(("${app_name_upper}_DOMAIN_NAME"))
89
+                if [[ "$domain_name" && "$app_name" != 'matrix' ]]; then
93 90
                     { echo '        {';
94 91
                       echo "          \"name\": \"${app_name}\",";
95 92
                       echo "          \"platforms\": [";
96 93
                       echo '            {';
97 94
                       echo '              "type": "web",';
98
-                      echo "              \"url\": \""$((${app_name_upper}_DOMAIN_NAME))"\"";
95
+                      echo "              \"url\": \"$domain_name\"";
99 96
                       echo '            }';
100 97
                       echo '          ]';
101 98
                       echo -n '        }'; } >> "$plinth_api"
102 99
                 fi
103 100
 
104
-                if [ $(("${app_name_upper}_MOBILE_APP_URL")) ]; then
105
-                    if [[ $(("${app_name_upper}_DOMAIN_NAME")) && "$app_name" != 'matrix' ]]; then
101
+                if [ "$MOBILE_APP_URL" ]; then
102
+                    if [[ "$domain_name" && "$app_name" != 'matrix' ]]; then
106 103
                         echo ',' >> "$plinth_api"
107 104
                     fi
108 105
                     { echo '        {';
@@ -112,7 +109,7 @@ function android_update_apps {
112 109
                       echo '              "type": "store",';
113 110
                       echo '              "os": "android",';
114 111
                       echo '              "store_name": "f-droid",';
115
-                      echo "              \"url\": \""$((${app_name_upper}_MOBILE_APP_URL))"\"";
112
+                      echo "              \"url\": \"$MOBILE_APP_URL\"";
116 113
                       echo '            }';
117 114
                       echo '          ]';
118 115
                       echo -n '        }'; } >> "$plinth_api"