diff options
author | Alexey Neyman <stilor@att.net> | 2019-01-20 16:42:12 -0800 |
---|---|---|
committer | Alexey Neyman <stilor@att.net> | 2019-01-26 13:13:32 -0800 |
commit | 57e5be632d4e40314cd8d1a67973ee1e58d3dfb8 (patch) | |
tree | 21fd3ff534587fc94aef3c622e3e2a00e8eee102 /scripts/version-check.sh | |
parent | 127c6cc64dcb5b1e47e7e5eecb0aac6f6ae0b48e (diff) | |
download | crosstool-ng-57e5be632d4e40314cd8d1a67973ee1e58d3dfb8.tar.gz crosstool-ng-57e5be632d4e40314cd8d1a67973ee1e58d3dfb8.tar.bz2 crosstool-ng-57e5be632d4e40314cd8d1a67973ee1e58d3dfb8.zip |
Basic framework for checking config file version
Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'scripts/version-check.sh')
-rw-r--r-- | scripts/version-check.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/version-check.sh b/scripts/version-check.sh new file mode 100644 index 00000000..c4a2bd07 --- /dev/null +++ b/scripts/version-check.sh @@ -0,0 +1,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 |