Skip to content

Commit

Permalink
Add support for 7z (#44)
Browse files Browse the repository at this point in the history
* Add manual 7z

Unsure about what i'm doing

* Update README.md

* Update entrypoint.sh

* Update entrypoint.sh

* Update entrypoint.sh

* Trying to fix 7z exclusions

* Another attempt

* Again

* Again

* Last attempt

After that, the computer goes through the window

* Revert some tests

---------

Co-authored-by: Valentin Silvestre <[email protected]>
  • Loading branch information
HolographicWings and vasilvestre authored Oct 29, 2023
1 parent b83d190 commit 51801f7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The path to the files or directory that should be archived, relative to `directo
### `type`
Default: `zip`

Either `zip` or `tar`.
Either `zip` or `tar` or `7z`.

Defines if either a ZIP-file is created, or a tar archive (the latter gzipped).

Expand Down
22 changes: 22 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ then
zip -r "$INPUT_FILENAME" "$INPUT_PATH" -x $INPUT_EXCLUSIONS $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; }
fi
fi
elif [ "$INPUT_TYPE" = "7z" ] || [ "$INPUT_TYPE" = "7zip" ]
then
if [ -z "$INPUT_EXCLUSIONS" ]
then
7z a -tzip $INPUT_FILENAME $INPUT_PATH $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; }
else
EXCLUSIONS=''

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

for EXCLUSION in $INPUT_RECURSIVE_EXCLUSIONS
do
EXCLUSIONS+=" -xr!"
EXCLUSIONS+=$EXCLUSION
done

7z a -tzip $INPUT_FILENAME $INPUT_PATH $EXCLUSIONS $INPUT_CUSTOM || { printf "\n⛔ Unable to create %s archive.\n" "$INPUT_TYPE"; exit 1; }
fi
elif [ "$INPUT_TYPE" = "tar" ] || [ "$INPUT_TYPE" = "tar.gz" ]
then
if [ -z "$INPUT_EXCLUSIONS" ]
Expand Down

0 comments on commit 51801f7

Please sign in to comment.