summaryrefslogtreecommitdiff
path: root/scripts/version-check.sh
blob: c4a2bd07831a192259b666b53f196d50d67b1145 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# This script checks the version of the configuration file and either
# alerts the user about the need to run the upgrade, or attempts to
# perform such an upgrade.

CFGFILE="${1}"

. "${CT_LIB_DIR}/scripts/functions"
. "${CFGFILE}"
if [ "${CT_CONFIG_VERSION_CURRENT}" == "${CT_CONFIG_VERSION}" ]; then
    # Nothing to do
    exit 0
fi

if [ -z "${CT_UPGRADECONFIG}" ]; then
    if [ "${CT_CONFIG_VERSION}" != "0" ]; then
        oldversion="is version ${CT_CONFIG_VERSION}"
    else
        oldversion="has no version"
    fi
    cat 2>&1 <<EOF

Configuration file was generated by an older version of crosstool-NG;
configuration file ${oldversion}; crosstool-NG currently expects
version ${CT_CONFIG_VERSION_CURRENT}. If this configuration file was generated by a crosstool-NG
version 1.23.0 or later, you can run 'ct-ng upgradeconfig'.
Compatibility with previous releases is not guaranteed. In any case,
verify the resulting configuration.

EOF
    if [ "${CT_VCHECK}" = "strict" ]; then
        exit 1
    else
        exit 0
    fi
fi

echo "TBD not implemented yet" >&2
exit 1