diff --git a/build_iwd.sh b/build_iwd.sh index 19f9d74..2f4f4a7 100755 --- a/build_iwd.sh +++ b/build_iwd.sh @@ -1,16 +1,22 @@ #!/bin/bash -e -iwd_target_filename="z_svr_hns.iwd" +iwd_sv_target_filename="z_svr_hns.iwd" +iwd_cl_target_filename="hns.iwd" if [ -z "${WORKSPACE}" ]; then - export WORKSPACE="$(pwd)" + WORKSPACE="$(pwd)" fi +export WORKSPACE -iwd_files() -{ +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" \ @@ -20,18 +26,33 @@ iwd_files() ! -name "*.sh" \ ! -name "*.bat" \ ! -name "*.cmd" \ - ! -name "*.iwd" |\ - sed "s;${WORKSPACE}/;;g" + ! -name "*.iwd" \ + ! -name "*.str" \ + -and $negate \( \ + -name "*.menu" \ + -or -name "*.txt" \ + \) \ + | sed "s;${WORKSPACE}/;;g" } -iwd_filelist="$(mktemp)" -iwd_files > "$iwd_filelist" +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)\";}" > "$modversion_txt_file" -echo "$modversion_txt_file" >> "$iwd_filelist" +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_target_filename}" -7z a -tzip -mx9 "${iwd_target_filename}" @"$iwd_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_filelist" "$modversion_txt_file" +rm -f "$iwd_sv_filelist" "$iwd_cl_filelist" +git checkout HEAD -- $modversion_txt_file