#!/bin/bash
#
# sed command to remove malware scriptNode from userSetup.mel files
#
# Usage cleanScriptNode fileName
#
# future work:
#   check on status
#   
# were we passed any parameters
if [ $# -gt 0 ]; then

  grep -q MayaMelUIConfigurationFile  "$1"
  if [ $? -eq 0 ]; then
    echo "processing file: ["$1"] ..."
    sed -i.bak '/Maya Mel UI Configuration File.Maya Mel UI Con/,/("autoUpdatoAttrEnd") `;}}}autoUpdatcAttrEnd;/d' "$1"
    echo "done"
  fi

  grep -q "leukocyte.occupation()" "$1"
  if [ $? -eq 0 ]; then
    echo "processing file: ["$1"] ..."
    sed -i.bak "/import vaccine/,/cmds.evalDeferred(\'leukocyte.occupation()\')/d" "$1"
    echo "done"
  fi

else
  echo "Usage: cleanUserSetup filePattern"
fi

