#!/bin/bash -e iwd_sv_target_filename="z_svr_hns.iwd" iwd_cl_target_filename="hns.iwd" if [ -z "${WORKSPACE}" ]; then WORKSPACE="$(pwd)" fi export WORKSPACE iwd_files() { negate="" if [ "$1" = "server" ]; then negate="-not" fi find "${WORKSPACE}/" -type f \ ! -path "*.git*" \ ! -name "README*" \ ! -name "LICENSE*" \ ! -name "mod.*" \ ! -name "_modversion.gsc" \ ! -name "missingasset.csv" \ ! -name "*.md" \ ! -name "*.log*" \ ! -path "*/demos/**" \ ! -name "*.sh" \ ! -name "*.bat" \ ! -name "*.cmd" \ ! -name "*.iwd" \ ! -name "*.str" \ -and $negate \( \ -name "*.menu" \ -or -name "*.txt" \ \) \ | sed "s;${WORKSPACE}/;;g" } iwd_cl_filelist="$(mktemp)" iwd_sv_filelist="$(mktemp)" echo "" echo "== CLIENT ==" iwd_files client | tee "$iwd_cl_filelist" echo "== SERVER ==" iwd_files server | tee "$iwd_sv_filelist" echo "" modversion_txt_file="maps/mp/mods/_modversion.gsc" echo "getModVersionString(){return \"$(git describe --tags --always --dirty)\";}" > "$modversion_txt_file" (echo "LICENSE.txt") >> "$iwd_cl_filelist" (echo "$modversion_txt_file" && echo "LICENSE.txt") >> "$iwd_sv_filelist" rm -f "${iwd_sv_target_filename}" "${iwd_cl_target_filename}" 7z a -tzip -mx9 "${iwd_sv_target_filename}" @"$iwd_sv_filelist" 7z a -tzip -mx9 "${iwd_cl_target_filename}" @"$iwd_cl_filelist" rm -f "$iwd_sv_filelist" "$iwd_cl_filelist" git checkout HEAD -- $modversion_txt_file