diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2019-09-03 15:09:36 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2019-09-05 08:35:31 +0200 |
commit | 00d88a79453255ec56439af359aa3e805f1176dd (patch) | |
tree | fd9f5c9f1104930c8549212f247306982c71b721 /scripts | |
parent | d09ce5d4409b0a54f43815286dca1fb9f560c72f (diff) | |
download | OSELAS.Toolchain-00d88a79453255ec56439af359aa3e805f1176dd.tar.gz OSELAS.Toolchain-00d88a79453255ec56439af359aa3e805f1176dd.tar.xz |
add make target to install the toolchain
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/ptxd_make_toolchain_install.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/lib/ptxd_make_toolchain_install.sh b/scripts/lib/ptxd_make_toolchain_install.sh new file mode 100644 index 0000000..4ef49e9 --- /dev/null +++ b/scripts/lib/ptxd_make_toolchain_install.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# Copyright (C) 2019 by Michael Olbrich <m.olbrich@pengutronix.de> +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +ptxd_make_toolchain_install() { + local tmpfile install_helper + local prefix="$(ptxd_get_ptxconf PTXCONF_PREFIX_CROSS)" + local install_prefix="${ptx_install_destdir}${prefix}" + local install_source="${PTXDIST_SYSROOT_CROSS}${prefix}" + + echo "Installing to ${install_prefix} ..." + + if [ -d "${install_prefix}" ]; then + if [ -z "$(find "${install_prefix}" -maxdepth 0 -empty)" -a -z "${PTXDIST_FORCE}" ]; then + ptxd_bailout "${install_prefix} is not empty!" \ + "Use --force to remove the existing content first." + fi + fi + + mkdir -p "${install_prefix}" 2>/dev/null && + tmpfile="$(mktemp "${install_prefix}/touch.XXXXXXXX" 2>/dev/null)" && + rm "${tmpfile}" + if [ $? -ne 0 ]; then + echo + echo "'${install_prefix}' is not writable." + read -t 5 -p "Press enter to install with sudo!" + if [ ${?} -ne 0 ]; then + echo + return 1 + fi + install_helper=sudo + fi + ${install_helper} rm -rf "${install_prefix}" && + ${install_helper} mkdir -p $(dirname "${install_prefix}") && + ${install_helper} cp -a --no-preserve=ownership \ + "${install_source}" $(dirname "${install_prefix}") +} +export -f ptxd_make_toolchain_install |