Manifest file creation script

I got mortally sick of updating the http patching manifest file by hand, making mistakes, etc. It’s cost me so much time.

Here’s a script (that you’ll have to adapt just a bit - paths, etc) to do all of that hard work for you.

Feel free to reply with useful changes, replace paths with variables, clean up my awful scripting, etc.

The script is set up to run under WSL on Windows.

#!/bin/bash

declare -a dirs=("Android_ASTC")  # actual build type name, e.g. WindowsNoEditor
declare -a platforms=("Android")  # simple platform name from GetPlatform() or whatever

for ((i = 0; i < ${#dirs[@]}; i++))
do
  echo "-- Platform: ${platforms[$i]}"

  filename="/mnt/d/Build/MyProject/http/${dirs[$i]}/BuildManifest-${platforms[$i]}.txt"

  echo -- Clearing existing manifest
  > ${filename}

  echo -- Writing \$NUM_ENTRIES
  pakcount=0
  pakcount=$(find /mnt/d/Build/MyProject/http/${dirs[$i]}/MyReleaseName1_0/* -mindepth 0 -maxdepth 0 -type d | wc -l)
  echo \$NUM_ENTRIES = ${pakcount} >> ${filename}

  echo -- Writing \$BUILD_ID
  echo \$BUILD_ID = MyReleaseName1_0 >> ${filename}

  echo -- Finding paks
  for p in $(find /mnt/d/Build/MyProject/http/${dirs[$i]}/MyReleaseName1_0/*/*.pak) ;
  do
    filesize=$(stat -c%s "$p")
    pakid=$(basename $p | grep -oP '([0-9]){4,4}')
    pakpath=$(grep -oP '\/MyReleaseName1_0\/(.*)' <<< $p)
    myversion="ver001"
    echo -e "$(basename $p)\t${filesize}\t${myversion}\t${pakid}\t${pakpath}" >> ${filename}
  done
done
echo -- Done!
2 Likes