...
|
...
|
@@ -358,6 +358,12 @@ elif test -n "$1"; then
|
358
|
358
|
exit
|
359
|
359
|
fi
|
360
|
360
|
update_database
|
|
361
|
+########################################
|
|
362
|
+# TO KEEP SETXML uncomment below lines:
|
|
363
|
+########################################
|
|
364
|
+# mkdir -p /dev/shm/aircrafts/${1%/*}
|
|
365
|
+# ln -f $setxml /dev/shm/aircrafts/$1
|
|
366
|
+########################################
|
361
|
367
|
exit
|
362
|
368
|
fi
|
363
|
369
|
|
...
|
...
|
@@ -429,3 +435,73 @@ while xmlgetnext; do
|
429
|
435
|
;;
|
430
|
436
|
esac
|
431
|
437
|
done < $aircrafts
|
|
438
|
+
|
|
439
|
+########################################################################
|
|
440
|
+# some aircrafts (mostly from the helijah's files architecture template)
|
|
441
|
+# break because of infinite loop in middle of file
|
|
442
|
+# I can't find the reason of this infinite loop
|
|
443
|
+# these are the steps (some may be scripted)
|
|
444
|
+# sorry about inconvenience...
|
|
445
|
+# STEPS TO FOLLOW
|
|
446
|
+# 1 - the following lines may be copied in a separate file (e.g /dev/shm/foo)
|
|
447
|
+# 2 - uncomment by removing the FIRST column only and save the file
|
|
448
|
+# 3 - uncomment the lines dedicated to save the setxml content in this script
|
|
449
|
+# 4 - find the empty /sim/model/path:
|
|
450
|
+# sqlite3 /your/database <<< 'select printf("%s/%s", aircrafts.name, setxml.file)
|
|
451
|
+# from aircrafts inner join setxml
|
|
452
|
+# where aircrafts.id = setxml.variantof and setxml.`/sim/model/path` = ""'
|
|
453
|
+# 5 - play $ DB=/your/database ./fgaddon aicrafts_name/setxml_file
|
|
454
|
+# 6 - play $ /dev/shm/foo aicrafts_name/setxml_file
|
|
455
|
+# 7 - play $ sqlite3 /your/database <<< "update setxml set `/sim/model/path` = '<the path found>' where file = 'setxml_file'"
|
|
456
|
+#
|
|
457
|
+# exemple of one-line CLI:
|
|
458
|
+# for i in $(sqlite3 .fgfs/flightgear-fgaddon/fgaddon.db <<< 'select printf("%s/%s", aircrafts.name, setxml.file) from aircrafts inner join setxml where aircrafts.id = setxml.variantof and setxml.`/sim/model/path` = ""'); do DB=.fgfs/flightgear-fgaddon/fgaddon.db .fgfs/fgaddon $i; sim_model_path=$(/dev/shm/foo $i | awk '/^\/sim\/model\/path/{print $NF}'); test -n "$sim_model_path" && sqlite3 .fgfs/flightgear-fgaddon/fgaddon.db <<< "update setxml set \`/sim/model/path\` = '$sim_model_path' where file = '${i#*/}'"; done
|
|
459
|
+
|
|
460
|
+##!/bin/bash
|
|
461
|
+#
|
|
462
|
+#declare -A data=(
|
|
463
|
+# [/sim/model/path]=text
|
|
464
|
+#)
|
|
465
|
+#data_pattern=$(printf "%s|" ${!data[@]})
|
|
466
|
+#data_pattern=${data_pattern:0:-1}
|
|
467
|
+#for col in ${!data[@]}; do
|
|
468
|
+# data[$col]=
|
|
469
|
+#done
|
|
470
|
+#
|
|
471
|
+#function xmlgetnext () {
|
|
472
|
+# local IFS='>'
|
|
473
|
+# read -d '<' TAG VALUE
|
|
474
|
+# # by design, the first TAG/VALUE pair is empty
|
|
475
|
+# # to avoid infinite loops at end of file parsing we return an error
|
|
476
|
+# # the next time we find an empty TAG
|
|
477
|
+# if test -z "$TAG"; then
|
|
478
|
+# test ${xmlgetnext_empty_tag:-0} -gt 0 && return 1
|
|
479
|
+# xmlgetnext_empty_tag=$(( xmlgetnext_empty_tag + 1 ))
|
|
480
|
+# fi
|
|
481
|
+# # process $TAG only if necessary
|
|
482
|
+# local _TAG=$(printf '%q' $TAG)
|
|
483
|
+# if test ${_TAG:0:1} = '$'; then
|
|
484
|
+# TAG=$(tr '\n' ' ' <<< $TAG | sed 's/ */ /g; s/ *$//')
|
|
485
|
+# fi
|
|
486
|
+#}
|
|
487
|
+#
|
|
488
|
+#while xmlgetnext; do
|
|
489
|
+# case "${TAG:0:1}" in
|
|
490
|
+# ''|'?'|'!')
|
|
491
|
+# continue;;
|
|
492
|
+# /)
|
|
493
|
+# property=${property%/*};;
|
|
494
|
+# *)
|
|
495
|
+# if test "${TAG: -1}" != '/'; then
|
|
496
|
+# property+=/${TAG%% *}
|
|
497
|
+# fi;;
|
|
498
|
+# esac
|
|
499
|
+#
|
|
500
|
+# if [[ "$property" = /PropertyList@($data_pattern) ]]; then
|
|
501
|
+# if test -z "${data[${property/\/PropertyList}]}"; then
|
|
502
|
+# eval "data[${property/\/PropertyList}]=\"${VALUE//\"/\\\"}\""
|
|
503
|
+# data[${property/\/PropertyList}]=$(tr '\n' ' ' <<< ${data[${property/\/PropertyList}]} | sed -r 's/^\s*//;s/\s+/ /g;s/\s*$//')
|
|
504
|
+# echo "${property/\/PropertyList} : ${data[${property/\/PropertyList}]}"
|
|
505
|
+# fi
|
|
506
|
+# fi
|
|
507
|
+#done < /dev/shm/aircrafts/$1
|