From de0589ea9e7f524cc7df8ce53d1d1e59c81b30f3 Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Fri, 24 May 2019 23:34:13 +0300 Subject: [PATCH] build-package.sh: fix license installation step --- scripts/build/termux_step_install_license.sh | 22 +++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/scripts/build/termux_step_install_license.sh b/scripts/build/termux_step_install_license.sh index 88681f1e9..f0e88f91e 100644 --- a/scripts/build/termux_step_install_license.sh +++ b/scripts/build/termux_step_install_license.sh @@ -1,24 +1,32 @@ termux_step_install_license() { mkdir -p "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME" + if [ ! "${TERMUX_PKG_LICENSE_FILE}" = "" ]; then + local LICENSE for LICENSE in $TERMUX_PKG_LICENSE_FILE; do - if [ ! -f "$TERMUX_PKG_SRCDIR/$LICENSE" ]; then termux_error_exit "$TERMUX_PKG_SRCDIR/$LICENSE does not exist"; fi - cp -f ${TERMUX_PKG_SRCDIR}/${LICENSE} ${TERMUX_PREFIX}/share/doc/${TERMUX_PKG_NAME} + if [ ! -f "$TERMUX_PKG_SRCDIR/$LICENSE" ]; then + termux_error_exit "$TERMUX_PKG_SRCDIR/$LICENSE does not exist" + fi + cp -f "${TERMUX_PKG_SRCDIR}/${LICENSE}" "${TERMUX_PREFIX}/share/doc/${TERMUX_PKG_NAME}"/ done else local COUNTER=0 - for LICENSE in "$(echo $TERMUX_PKG_LICENSE | sed 's/,/ /g')"; do + local LICENSE + while read -r LICENSE; do if [ -f "$TERMUX_SCRIPTDIR/packages/termux-licenses/LICENSES/${LICENSE}.txt" ]; then - if [[ $COUNTER > 0 ]]; then + if [[ $COUNTER -gt 0 ]]; then ln -sf "../../LICENSES/${LICENSE}.txt" "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME/LICENSE.${COUNTER}" else ln -sf "../../LICENSES/${LICENSE}.txt" "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME/LICENSE" fi fi COUNTER=$((COUNTER + 1)) + done < <(echo "$TERMUX_PKG_LICENSE" | sed "s/,/\n/g") + + for LICENSE in "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME"/LICENSE*; do + if [ "$LICENSE" = "$TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME/LICENSE*" ]; then + termux_error_exit "No LICENSE file was installed for $TERMUX_PKG_NAME" + fi done - if [ ! -f $TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME/LICENSE* ] && [ ! -L $TERMUX_PREFIX/share/doc/$TERMUX_PKG_NAME/LICENSE* ]; then - termux_error_exit "No LICENSE file was installed for $TERMUX_PKG_NAME" - fi fi }