summarylogtreecommitdiffstats
path: root/euroscope-bin
blob: c7730c5df9a6dfe20519768cdc00a1e2f9beb14a (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
unset WINEPREFIX

progName="euroscope"
export WINEPREFIX="$HOME/.local/share/wineprefixes/$progName"
export INSTALL="/usr/share/euroscope-bin/EuroScope/"
export ES_PATH="$WINEPREFIX/drive_c/Program Files (x86)"
export CONFIG="$HOME/.config/euroscope"
currentVersion="4"

install_deps() {
  if [ ! -d "$CONFIG" ] ; then
    mkdir -p "$CONFIG"
    cd "$CONFIG"
    mkdir -p override
    cd override
    mkdir es
    mkdir font
  fi

  if [ -z "$TEST" ] ; then
    wine wineboot -u
    notify-send --app-name=EuroScope --icon=euroscope "Installing Dependencies" "It may take a few minutes."
    winetricks --unattended --force iertutil msls31 msxml6 urlmon vcrun2022 wininet
  fi

  cp -r "$INSTALL" "$ES_PATH"
  echo "$currentVersion" > "$WINEPREFIX/.installed"

  mkdir -p override
  if [ -e "$CONFIG/override/font/EuroScope.ttf" ] ; then
    cp "$CONFIG/override/font/EuroScope.ttf" "$WINEPREFIX/drive_c/windows/Fonts/";
  else
    cp "/usr/share/$progName/EuroScope.ttf" "$WINEPREFIX/drive_c/windows/Fonts/";
  fi

  if [ -z "$( ls -A "$CONFIG"/override/es/ )" ]; then
    echo "Empty -- skipping override ES files"; 
  else    
    cp -r "$CONFIG"/override/es/* "$ES_PATH/EuroScope/"
  fi
}

if [ ! -z "$TEST" ] ; then
  install_deps
fi

if [ ! -d "$WINEPREFIX" ] ; then
  mkdir -p "$WINEPREFIX"
  install_deps
fi

if ! grep -q $currentVersion "$WINEPREFIX/.installed" ; then
  install_deps
fi

cd "$CONFIG" && WINEDEBUG=-all wine "$ES_PATH/EuroScope/EuroScope.exe" "$@"