Created
March 31, 2021 01:31
-
-
Save sedme0/79821d14df0fd18e6ce6b757aac210e2 to your computer and use it in GitHub Desktop.
Might and Magic 1 Linux Install Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Last modified 3/30/2020 | |
# Prerequisites: wget winetricks lgogdownloader 7z libreoffice (used to convert WhereAreWe documentation to pdf) | |
# Wine doesn't need to be installed because it will automatically download the required version | |
# Usage: Put this script in an empty folder and run it. Running it once will install the game, after that running it will run the game. | |
WINEBASE=$HOME/.PlayOnLinux/wine/linux-amd64/5.11 | |
export WINE=$WINEBASE/bin/wine | |
export WINESERVER=$WINEBASE/bin/wineserver | |
WINEDOWNLOAD=https://www.playonlinux.com/wine/binaries/phoenicis/upstream-linux-amd64/PlayOnLinux-wine-5.11-upstream-linux-amd64.tar.gz | |
export WINEPREFIX=$PWD/wineprefix | |
export WINEARCH=win64 | |
export WINEDEBUG=err-all,fixme-all | |
if [ ! -d "$WINEBASE" ]; then | |
echo "Required Wine version not detected. Installing." | |
mkdir -p "$WINEBASE" | |
wget -O "$WINEBASE/wine.tar.gz" $WINEDOWNLOAD | |
tar -xf "$WINEBASE/wine.tar.gz" -C "$WINEBASE" | |
rm -f "$WINEBASE/wine.tar.gz" | |
echo "Required Wine version installed." | |
fi | |
if [ ! -d "$WINEPREFIX" ]; then | |
echo "Wine prefix does not exist. Performing first-time setup." | |
# .NET Framework 4.5 needed for Where Are We? | |
echo "Installing .NET Framework 4.5" | |
winetricks dotnet45 > /dev/null # Piping output to /dev/null so terminal output is less cluttered | |
echo ".NET Framework 4.5 installed." | |
fi | |
if [ ! -d "$WINEPREFIX/drive_c/Games/Might and Magic 1" ]; then | |
echo "Might and Magic 1 not installed. Performing installation now." | |
lgogdownloader --download --game might_and_magic_1_book_i | |
mv might_and_magic_1_book_i/* ./ | |
rm -rf might_and_magic_1_book_i/ | |
for i in extras/*.zip; do | |
7z -oextras/ e $i > /dev/null | |
done | |
rm -rf extras/*/ | |
rm -rf extras/*.zip | |
# Using ls to find the installer because there might be a version change or something | |
$WINE $(ls ./setup_*.exe) /VERYSILENT /DIR="C:\Games\Might and Magic 1" /NOICON /COMPONENTS="component0" | |
rm ./setup_*.exe | |
rm "$WINEPREFIX/drive_c/Games/Might and Magic 1/Manual.pdf" # The manual is already included in the extras folder | |
sed -E -i 's/(fullscreen)=true/\1=false/g' "$WINEPREFIX/drive_c/Games/Might and Magic 1/dosboxMM1.conf" # Disable fullscreen | |
echo "Might and Magic 1 installed." | |
fi | |
if [ ! -d WhereAreWe ]; then | |
echo "WhereAreWe not installed. Installing now." | |
wget -P WhereAreWe https://www.eskimo.com/~edv/lockscroll/WhereAreWe/WhereAreWe-Application-v1.1.1.zip | |
wget -P WhereAreWe https://www.eskimo.com/~edv/lockscroll/WhereAreWe/WhereAreWe-Surface_Maps-v1.1.0.zip | |
wget -P WhereAreWe https://www.eskimo.com/~edv/lockscroll/WhereAreWe/WhereAreWe-Documentation-v1.1.0.docx | |
for i in WhereAreWe/*.zip; do | |
7z -oWhereAreWe/ e $i > /dev/null | |
done | |
lowriter --convert-to pdf WhereAreWe/WhereAreWe-Documentation-v1.1.0.docx | |
mv WhereAreWe-Documentation-v1.1.0.pdf WhereAreWe/ | |
rm -rf WhereAreWe/*.zip | |
echo "WhereAreWe installed." | |
fi | |
if [ ! -e mm1.desktop ]; then | |
echo "Desktop entry not detected. Creating now." | |
cat << EOF > mm1.desktop | |
[Desktop Entry] | |
Type=Application | |
Version=1.0 | |
Name=Might and Magic 1: The Secret of the Inner Sanctum | |
Path=$PWD | |
Exec="$PWD/mm1.sh" | |
Icon=$WINEPREFIX/drive_c/Games/Might and Magic 1/goggame-1207661203.ico | |
Terminal=false | |
Categories=Games | |
EOF | |
chmod +x mm1.desktop | |
echo "Please run the script again to launch the game. You can use the desktop entry placed in the same directory as this script." | |
else | |
cd WhereAreWe # Must be in the same directory as the surface maps for WhereAreWe to read them | |
$WINE WhereAreWe-Application-v1.1.1.exe | |
$WINESERVER -k # Quit all applications when WhereAreWe exits | |
fi |
I recently lost the other versions of this script in a huge loss of data. Whoops.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, if anyone's interested, I made versions of this for Might and Magic 2 and 3 as well. I think I also did World of Xeen, I can't remember. I also can't remember if 3 is part of World of Xeen or if that's 4 and 5. Either way it wouldn't be hard to add World of Xeen because I modified the script to be generic instead of game-specific. I'd upload them now, but they're on a different computer. I'll probably do it regardless of interest (after all, the work is already done), but if you show interest, I'll go out of my way to share it with you, as opposed to just doing it at my own leisurely pace.