summarylogtreecommitdiffstats
path: root/gog-heroes-of-might-and-magic-3-complete-edition-hota
blob: 4bb7aa47c63339fe98564fc542bae93dfb84dca0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
unset WINEPREFIX
export WINEPREFIX="$HOME"/.local/share/gog-heroes-of-might-and-magic-3-complete-edition 
SOURCE=/opt/gog/heroes-of-might-and-magic-3-complete-edition
DATA_DIR="${WINEPREFIX}/HoMM3-data"
UNIONFS_MNT="${WINEPREFIX}/drive_c/GOG Games/HoMM 3 Complete"
if [ ! -d "$WINEPREFIX" ]
then
  mkdir -p "$WINEPREFIX"
  wineboot -i
fi

if [ ! -d "${DATA_DIR}" ]
then
  mkdir -p "${DATA_DIR}"
fi

if [ ! -d "${UNIONFS_MNT}" ]
then
  mkdir -p "${UNIONFS_MNT}"
fi
if ! mountpoint "${UNIONFS_MNT}"
then
  if ! unionfs -o cow,allow_other,relaxed_permissions,suid,dev ${DATA_DIR}=RW:${SOURCE}=RO "${UNIONFS_MNT}"
  then
    echo "Failed to mount unionfs" >&2
    exit 1
  fi
fi
cd "${UNIONFS_MNT}"
wine HotA_launcher.exe "$@"
cd ..
fusermount -u "${UNIONFS_MNT}"
#wine HD_Launcher.exe "$@"