Showing 1 changed files with 34 additions and 0 deletions
+34
.fgfs/fgfs_function
... ...
@@ -353,6 +353,40 @@ function fgfs () {
353 353
                     rm $mplist
354 354
                     return
355 355
                     ;;
356
+                --install)
357
+                    local PS3='which aircraft ? (Ctrl-D to quit) '
358
+                    local IFS=$'\n'
359
+                    select ac in $(sqlite3 $FGADDON/fgaddon.db <<< "select distinct printf('%s [%s, %s]',
360
+                                                                   aircrafts.name,
361
+                                                                   hangars.name,
362
+                                                                   date(aircrafts.date, 'unixepoch'))
363
+                                                     from aircrafts
364
+                                                     inner join setxml, hangars
365
+                                                     where
366
+                                                       aircrafts.hangar = hangars.id
367
+                                                     and
368
+                                                       setxml.variantof = aircrafts.id
369
+                                                     and (
370
+                                                         setxml.file like '%$2%'
371
+                                                       or
372
+                                                         aircrafts.name like '%$2%'
373
+                                                     )
374
+                                                     order by aircrafts.date desc"); do
375
+                        test -z "$ac" && continue
376
+                    done
377
+                    test -z "$ac" && return
378
+                    declare -A hangar
379
+                    eval $(sqlite3 $FGADDON/fgaddon.db <<< "select printf('hangar[type]=%s;hangar[url]=%s;', type, url)
380
+                                                            from hangars where name = '${${(@s/ /)ac}[2]:1:-1}'")
381
+                    case ${hangar[type]} in
382
+                        git)
383
+                            git -C $FGADDON/Aircraft clone ${hangar[url]}/${${(@s/ /)ac}[1]}.git;;
384
+                        svn)
385
+                            svn checkout ${hangar[url]}/${${(@s/ /)ac}[1]} $FGADDON/Aircraft/${${(@s/ /)ac}[1]};;
386
+                    esac
387
+                    unset hangar
388
+                    return
389
+                    ;;
356 390
                 --fgcom)
357 391
                     if test \
358 392
                         -r $FGROOT/Protocol/fgcom-mumble.xml \