Skip to content

Instantly share code, notes, and snippets.

@orfibous
Last active August 20, 2020 17:59
Show Gist options
  • Save orfibous/dfacf026886b5d27c5c2c2f52df23995 to your computer and use it in GitHub Desktop.
Save orfibous/dfacf026886b5d27c5c2c2f52df23995 to your computer and use it in GitHub Desktop.
This script aims to remove all .bmp files from the .pak folders of a MoW:AS2 mod in order to make a MoW:AS2 (steam version running on Proton) mod compatible with Linux and stop the game from crashing. You may have to also manually delete some files (i.e. .jpg) from the .pak folder (indicated by the game crash report) for the mod to work. The scr…
#!/bin/bash
# Script Name: MoW:AS2 mod converter for Linux compatibility
# Description: This script aims to remove all .bmp files from the .pak folders of a MoW:AS2 mod in order to make a MoW:AS2 (steam version running on Proton) mod
# compatible with Linux. You may have to also manually delete some files (i.e. .jpg) from the .pak folder (indicated by the game crash report) for the mod to work.
# The script will unpack all .pak folder, Remove all .bmp files in them and repack all .pak folders
# LICENSE NOTICE
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# !!!SAFETY INSTRUCTIONS!!!
# -DO NOT USE THIS SCRIPT IF YOU DO NOT KNOW WHAT IT IS DOING
# -USE AT YOUR OWN RISK
# -THIS SCRIPT MAY BRAKE ONE OF YOUR Mow:AS2 MODS OR CAUSE DAMAGE TO YOUR FILESYSTEM
# -Tested only on Ubuntu 20.04 Linux
# !!!!!!!!!!!!!!!!!!!!!!!!!
# BEFORE YOU RUN THE SCRIPT
# INSTALL unp package with: sudo apt-get install unp
# Change the Path below
echo Welcome to the MoW:AS2 mod converter for Linux compatibility
# path should be the absolute path to the mods resource folder
# i.e. /home/.steam/steam/steamapps/common/Men\ of\ War\ Assault\ Squad\ 2/mods/{MOD_NAME}/resource
path=ENTER_PATH_HERE_ONLY_IN_LINE_38
if [[ "$path" == "ENTER_PATH_HERE_ONLY_IN_LINE_38" ]]
then
echo Enter mod/resource folder path in script. in example path=/home/.steam/steam/steamapps/common/Men\ of\ War\ Assault\ Squad\ 2/mods/{MOD_NAME}/resource
exit 1
fi
cd "$path"
unp -u *
find . -type f -iname \*.bmp -delete
for d in */ ; do
if [[ $(pwd) == "$path" ]]
then
echo "$d"
cd "$d"
sub=${d:0:-5}
zip -r "$sub" *
cd ..
cp "$d$sub" "$path/"
rm "$d" --recursive
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment