From d224f5c898ad9e79102ce6ffbaa9e8e7d30b41d2 Mon Sep 17 00:00:00 2001 From: Gabriel Niziolek Date: Thu, 25 Jan 2024 10:31:49 -0300 Subject: [PATCH] --add-data must be separated by semicolon --- entrypoint.sh | 2 +- test.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 test.sh diff --git a/entrypoint.sh b/entrypoint.sh index 1a4c0c8..16fde76 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -56,7 +56,7 @@ if [ ! -z "$ADD_DATA_DIRS" ]; then # Process every directory in the ADD_DATA_DIRS string for dir in $ADD_DATA_DIRS; do # Add the formatted directory to the output string - ADD_DATA+="--add-data $SRCDIR/$dir:$dir " + ADD_DATA+="--add-data \"$SRCDIR/$dir;$dir\" " done # Remove the extra space at the end of the output string diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..f9d3390 --- /dev/null +++ b/test.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Fail on errors. +set -e + +SRCDIR=$1 + +DIRS=$2 + +# DIRS will receive a list of directories to be processed in +# the form of a string, e.g. "dir1 dir2/subdir2 file1.txt dir3/file3.txt" +# those can be separated by comas or newlines. +# the output need to be in the format: "--add-data $SRCDIR/$dir1/:dir1/" +# so that pyinstaller can process it correctly. +# the output will be in the form of a string, e.g. +# "--add-data /src/dir1/:dir1/ --add-data /src/dir2/subdir2/:dir2/subdir2/ --add-data /src/file1.txt:file1.txt" + +# A string de saída +OUTPUT="" + +# Verifica se DIRS está vazio ou não fornecido +if [ ! -z "$DIRS" ]; then + + # Processa cada diretório na string DIRS + for dir in $DIRS; do + # Adiciona o diretório formatado à string de saída + OUTPUT+="--add-data $SRCDIR/$dir:$dir " + done + # Remove o espaço extra no final da string de saída + OUTPUT=${OUTPUT::-1} +fi + + +# Imprime a string de saída +echo $OUTPUT \ No newline at end of file