rpg16/export.sh
2019-07-21 07:43:55 -04:00

75 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
# The directory to output to
EXPORT_DIR=build
TMP_DIR=tmp
function folderExport() {
echo "Exporting folder ${1}..."
rsync -r --exclude="*.gif" "${1}" "${EXPORT_DIR}"
for i in `find "${1}" -name "*.gif" -print`; do
mkdir -p "${EXPORT_DIR}/$(dirname "${i}")"
montage "${i}" -tile 1x -geometry '1x1+0+0<' -alpha set -background transparent -coalesce -quality 100 "${EXPORT_DIR}/${i%.gif}.png" || { echo "Failed to export ${i}"; exit 1; }
done
}
function copyExport() {
rsync "${1}" "${EXPORT_DIR}"
}
# Ensure that the build directory exists
mkdir -p "${EXPORT_DIR}"
# Create screenshot.png from source
screenshot_file="screenshot.tiff"
echo "Export ${screenshot_file}..."
#TODO: Generate the image?
convert "${screenshot_file}" -flatten "${EXPORT_DIR}/screenshot.png" || { echo "Failed to export ${1}"; exit 1; }
# Copy texture pack files
echo "Copy text files..."
copyExport "CHANGELOG.md"
copyExport "LICENSE.txt"
copyExport "override.txt"
copyExport "README.md"
copyExport "texture_pack.conf"
echo "Export textures..."
# Copy images, converting any source files
folderExport "awards"
folderExport "beds"
folderExport "binoculars"
folderExport "boats"
folderExport "bones"
folderExport "bucket"
folderExport "butterflies"
folderExport "carts"
folderExport "caverealms"
folderExport "default"
folderExport "doors"
folderExport "dye"
folderExport "farming"
folderExport "fire"
folderExport "fireflies"
folderExport "flowers"
folderExport "gui"
folderExport "handholds"
folderExport "hbarmor"
folderExport "hbhunger"
folderExport "hudbars"
folderExport "map"
folderExport "misc"
folderExport "mobs"
folderExport "mobs_monster"
folderExport "moreblocks"
folderExport "moreores"
folderExport "player_api"
folderExport "screwdriver"
folderExport "stairs"
folderExport "tnt"
folderExport "vessels"
folderExport "wool"
folderExport "xpanes"
echo "Done! Files copied to ${EXPORT_DIR}"