Skip to content

Commit

Permalink
Handle multiple exclusions with tar.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDoctor0 committed Jan 12, 2023
1 parent 2113173 commit 080160a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion entrypoint.sh
Expand Up @@ -48,7 +48,15 @@ then
then
tar -zcvf $INPUT_FILENAME $INPUT_PATH || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; }
else
tar -zcvf $INPUT_FILENAME --exclude=$INPUT_EXCLUSIONS $INPUT_PATH || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; }
EXCLUSIONS=''

for EXCLUSION in $INPUT_EXCLUSIONS
do
EXCLUSIONS+=" --exclude="
EXCLUSIONS+=$EXCLUSION
done

tar $EXCLUSIONS -zcvf $INPUT_FILENAME $INPUT_PATH || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; }
fi
else
printf "\n⛔ Invalid archiving tool.\n"; exit 1;
Expand Down

0 comments on commit 080160a

Please sign in to comment.