rpg16/export.sh
2019-07-20 21:14:44 -04:00

85 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
# The directory to output to
EXPORT_DIR=build
TMP_DIR=tmp
function xcfExport() {
echo "Export ${1}..."
#TODO: Overlay version number
#TODO: Generate the image?
convert "${1}" -flatten "${EXPORT_DIR}/screenshot.png" || { echo "Failed to export ${1}"; exit 1; }
}
function gifExport() {
mkdir -p "${EXPORT_DIR}/$(dirname "${1}")"
montage "${1}" -tile 1x -geometry '1x1+0+0<' -alpha set -background transparent -coalesce -quality 100 "${EXPORT_DIR}/${1%.gif}.png" || { echo "Failed to export ${1}"; exit 1; }
}
# function folderGifExport() {
# }
function copyExport() {
rsync "${1}" "${EXPORT_DIR}"
}
function folderExport() {
echo "Exporting folder ${1}..."
rsync -r --exclude="*.gif" "${1}" "${EXPORT_DIR}"
for i in `find "${1}" -name "*.gif" -print`; do
gifExport "${i}"
done
}
# Ensure that the build directory exists
mkdir -p "${EXPORT_DIR}"
# Create screenshot.png from source
xcfExport "screenshot.tiff"
# Copy texture pack files
echo "Copy text files..."
#TODO: Assign versioning information
copyExport "CHANGELOG.md"
copyExport "LICENSE.txt"
copyExport "override.txt"
copyExport "README.md"
copyExport "texture_pack.conf"
echo "Export textures..."
# Copy images, skipping 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}"