95_components_library.sh 1.31 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. ${DIR}/common.sh

# Fetch and install latest ASN1SCC release
LIBDIR=${PREFIX}/share/components_library
mkdir -p ${LIBDIR} || exit 1

getver() {
    grep TASTE_IV_Properties::Version "$@" | head -1 | \
        awk -F\" '{print $(NF-1)}'
}

cd "${DIR}"/../components_library || exit 1
for i in * ; do
    # Only check folders (the components folder has files, too)
    cd "${DIR}"/../components_library || exit 1
    [ ! -d "$i" ] && continue
    # Is it already installed?
    if [ ! -d ${LIBDIR}/"$i" ] ; then
        # No, install component in library
        echo "[-] Installing $i in component library..."
        cp -a "$i" ${LIBDIR} || exit 1
24 25 26
        cd ${LIBDIR}/"$i" || exit 1
        echo "[-] Updating ASN.1 file paths..."
        taste-update-data-view *asn
27 28 29 30 31 32 33 34
    else
        # Yes, it is - check for updates
        cd "${DIR}"/../components_library/"$i" || exit 1
        NEWVER=$(getver *aadl)
        cd ${LIBDIR}/"$i" || exit 1
        OLDVER=$(getver *aadl)
        if [ "${OLDVER}" != "${NEWVER}" ] ; then
            echo "[-] Updating $i in component library..."
35
            rm -f *
36
            cp -a "${DIR}"/../components_library/"$i"/* . 
37 38
            echo "[-] Updating ASN.1 file paths..."
            taste-update-data-view *asn
39 40 41
        fi
    fi
done