scripts: fix finishing the toolchain when download/extract-only is set
author"Yann E. MORIN" <yann.morin.1998@free.fr>
Mon Jan 28 21:53:18 2013 +0100 (2013-01-28)
changeset 317620f2459b97bf
parent 3175 efad82bf7b9b
child 3177 47a7a813b589
child 3180 0c76cb00a9c6
scripts: fix finishing the toolchain when download/extract-only is set

In case we only download or extract the sources, do not fail while
finishing the toolchain: the test-suite directory may not exist, so
we can't chmod it.

Also, use safer constructs that won't trigger the 'set -e' in case of
failure (eg.: "[ ... ] && ..." is not safe in case the test fails).

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
scripts/crosstool-NG.sh.in
     1.1 --- a/scripts/crosstool-NG.sh.in	Thu Jan 24 22:37:31 2013 +0100
     1.2 +++ b/scripts/crosstool-NG.sh.in	Mon Jan 28 21:53:18 2013 +0100
     1.3 @@ -659,7 +659,12 @@
     1.4          bzip2 -9 "${CT_PREFIX_DIR}/build.log"
     1.5      fi
     1.6  fi
     1.7 -[ "${CT_INSTALL_DIR_RO}" = "y"  ] && chmod -R a-w "${CT_INSTALL_DIR}"
     1.8 -[ "${CT_TEST_SUITE}" = "y" ] && chmod -R u+w "${CT_TEST_SUITE_DIR}"
     1.9 +if [ "${CT_INSTALL_DIR_RO}" = "y" ]; then
    1.10 +    chmod -R a-w "${CT_INSTALL_DIR}"
    1.11 +fi
    1.12 +# CT_TEST_SUITE_DIR may not exist if only downloading or extracting
    1.13 +if [ "${CT_TEST_SUITE}" = "y" -a -d "${CT_TEST_SUITE_DIR}" ]; then
    1.14 +    chmod -R u+w "${CT_TEST_SUITE_DIR}"
    1.15 +fi
    1.16  
    1.17  trap - EXIT