Skip to content

Commit

Permalink
entrypoint.sh: some tweaks
Browse files Browse the repository at this point in the history
These tweaks fix Shellcheck warnings and simplify a bit all the
quotations and escaping involved in generating the configuration file.
These changes should be tested.
  • Loading branch information
AlexTMjugador committed Jul 3, 2021
1 parent f4bccb3 commit ec61c08
Showing 1 changed file with 27 additions and 26 deletions.
53 changes: 27 additions & 26 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

# options variable
# options variables
SETTING_FILE=${1}
DIRECTORY_PATH=${2}
SKIP_PACK_ICON=${3}
Expand All @@ -9,10 +9,10 @@ COMPRESS_ALREADY_COMPRESSED_FILES=${5}
IGNORE_SYSTEM_AND_HIDDEN_FILES=${6}
ALLOW_MOD_OPTIFINE=${7}
ALLOW_MODS="["
if [ $ALLOW_MOD_OPTIFINE = "true" ]; then
ALLOW_MODS=$ALLOW_MODS"\"OptiFine\""
if [ "$ALLOW_MOD_OPTIFINE" = "true" ]; then
ALLOW_MODS="$ALLOW_MODS'OptiFine'"
fi
ALLOW_MODS=$ALLOW_MODS"]"
ALLOW_MODS="$ALLOW_MODS]"
SAMPLING_FREQUENCY=${8}
TARGET_PITCH=${9}
MINIMUM_BITRATE=${10}
Expand All @@ -21,35 +21,36 @@ QUANTIZE_IMAGE=${12}
OUTPUT=${13}

# print version
packsquash --version
printf 'PackSquash version: ' && packsquash --version

# change to GitHub WorkSpace Directory
cd "$GITHUB_WORKSPACE"
cd "$GITHUB_WORKSPACE" || exit 1

if [ -z $SETTING_FILE ]; then
if [ -z "$SETTING_FILE" ]; then
# generate settings
echo '
resource_pack_directory = "'$DIRECTORY_PATH'"
skip_pack_icon = '$SKIP_PACK_ICON'
strict_zip_spec_compliance = '$STRICT_ZIP_SPEC_COMPLIANCE'
compress_already_compressed_files = '$COMPRESS_ALREADY_COMPRESSED_FILES'
ignore_system_and_hidden_files = '$IGNORE_SYSTEM_AND_HIDDEN_FILES'
allowed_mods = '$ALLOW_MODS'
output_file_path = "'$OUTPUT'"
["assets/*/sounds/{music,ambience}/?*.{og[ga],mp3,wav,flac}"]
sampling_frequency = '$SAMPLING_FREQUENCY'
minimum_bitrate = '$MINIMUM_BITRATE'
maximum_bitrate = '$MAXIMUM_BITRATE'
["**/*.png"]
quantize_image = '$QUANTIZE_IMAGE'
' > packsquash-settings.toml
echo "
resource_pack_directory = '$DIRECTORY_PATH'
skip_pack_icon = $SKIP_PACK_ICON
strict_zip_spec_compliance = $STRICT_ZIP_SPEC_COMPLIANCE
compress_already_compressed_files = $COMPRESS_ALREADY_COMPRESSED_FILES
ignore_system_and_hidden_files = $IGNORE_SYSTEM_AND_HIDDEN_FILES
allowed_mods = $ALLOW_MODS
output_file_path = '$OUTPUT'
['**/*.{og[ga],mp3,wav,flac}']
sampling_frequency = $SAMPLING_FREQUENCY
minimum_bitrate = $MINIMUM_BITRATE
maximum_bitrate = $MAXIMUM_BITRATE
target_pitch = $TARGET_PITCH
['**/*.png']
quantize_image = $QUANTIZE_IMAGE
" > packsquash-settings.toml

SETTING_FILE=packsquash-settings.toml
fi

cat $SETTING_FILE
echo 'Will use these settings:' && cat $SETTING_FILE

# optimize
packsquash packsquash-settings.toml
packsquash packsquash-settings.toml

0 comments on commit ec61c08

Please sign in to comment.