[go: up one dir, main page]

Menu

[26f4b2]: / admin / syncacft  Maximize  Restore  History

Download this file

66 lines (58 with data), 1.7 kB

#!/bin/sh

if [ x$1 = x ]; then
   echo "Usage:"
   echo " $0 [path to the Aircraft directory of the FlightGear base package]"
   exit;
fi
if [ ! -d $1 -o ! -d $1/Generic ]; then
   echo "Not the FlightGear Aircraft directory: $1"
   exit;
fi
if [ ! -d engine ]; then
   echo "Please change to the root directory of the JSBSim package."
   exit;
fi

CDIR=`pwd`
ADIR=$1

NOTFOUND=
cd aircraft
DIRS=`find . -type d -maxdepth 1 -printf "%f\n"`
for n in $DIRS; do
    if [ $n"x" != ".x" -a $n"x" != "CVSx" ]; then
        if [ ! -f $n/INSTALL ]; then
            INSTALL="$ADIR/$n/$n.xml";
        else
            INSTALL="$ADIR/`grep "^FlightGear:" $n/INSTALL | awk '{print $2}'`";
        fi;

        if [ $n"x" != ".x" -a ! -f $INSTALL ]; then
            NOTFOUND="$NOTFOUND $INSTALL";
        else
            NUM=`diff $n/$n.xml $INSTALL | grep -e ">" -e "<" | wc -l`;
            NUM_ID=`diff $n/$n.xml $INSTALL | grep -e ">" -e "<" | grep "\$Revision:" | wc -l`;
            if [ ! $NUM -eq $NUM_ID ]; then
                cp -p $n/$n.xml $INSTALL;
            fi;
        fi
    fi
done

if [ "x$NOTFOUND" != "x" ]; then
   echo "The following aircraft files could not be found in the FlightGear"
   echo "base package:"
   for n in $NOTFOUND; do echo "    "$n; done
   echo
fi

NOTFOUND=
cd $ADIR
for n in `ls -1 */Engines/*.xml`; do 
    FILE=`echo $n | awk -F'/' '{printf $3}'`;
    if [ ! -f $CDIR/engine/$FILE ]; then 
        NOTFOUND="$NOTFOUND $n";
    else
        cp -p $CDIR/engine/$FILE $n;
    fi
done

if [ "x$NOTFOUND" != "x" ]; then
   echo "The following engine files could not be found in the JSBSim directory:"
   for n in $NOTFOUND; do echo "    "$n; done
fi
cd  $CDIR;