Showing 1 changed files with 11 additions and 6 deletions
+11 -6
flightgear/fgaddon
... ...
@@ -376,12 +376,17 @@ data_test_null=$(printf '${data[%s]}' ${!datatypes[@]})
376 376
 if test -e $database; then
377 377
     cp $database $in_ram_database
378 378
 
379
-    sql_cols=$(sqlite_request "pragma table_info(setxml)" | awk -F'|' '{printf("%s %s ", $2, $3)}')
380
-    script_cols="file text variantof integer "
381
-    for col in ${!datatypes[@]}; do
382
-        script_cols+="$col ${datatypes["$col"]%% *} "
383
-    done
384
-    script_cols+="installed integer " # last space is important
379
+    sql_cols=$(sqlite_request "pragma table_info(setxml)" \
380
+             | cut --delimiter="|" --fields=2,3 --output-delimiter=" " \
381
+             | sort \
382
+             | md5sum)
383
+    datatypes[file]=text
384
+    datatypes[variantof]=integer
385
+    datatypes[installed]=integer
386
+    script_cols=$(for col in ${!datatypes[@]}; do echo "$col ${datatypes["$col"]%% *}"; done \
387
+                | sort \
388
+                | md5sum)
389
+    unset datatypes[file] datatypes[variantof] datatypes[installed]
385 390
     if test "$sql_cols" != "$script_cols"; then
386 391
         echo "ALERT: datbase version mismatch !"
387 392
         exit 1