aboutsummarylogtreecommitdiffstats
path: root/heidisql.sh
blob: 3dd8bf8bfbf0f50afce761b61885f54a2e3419af (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
#!/bin/bash

progName="heidisql"
progRealPath="/usr/share/$progName"
if [ -n "$HEIDISQL_HOME" ]; then
    progHome="$HEIDISQL_HOME"
else
    progHome="$HOME/.$progName"
fi
progBin="$progName.exe"

# Create folder
mkdir -p "$progHome" >/dev/null 2>&1

# Create read-only symlinks
ln -s "$progRealPath/$progBin" "$progHome/$progBin" >/dev/null 2>&1
ln -s "$progRealPath/readme.txt" "$progHome/readme.txt" >/dev/null 2>&1
ln -s "$progRealPath/libmysql.dll" "$progHome/libmysql.dll" >/dev/null 2>&1
ln -s "$progRealPath/libmariadb.dll" "$progHome/libmariadb.dll" >/dev/null 2>&1
ln -s "$progRealPath/plugins" "$progHome/plugins" >/dev/null 2>&1

# Create a blank config file (otherwise HeidiSQL stores its settings in the Windows Registry)
if [ -n "$XDG_CONFIG_HOME" ]; then
    mkdir -p "$XDG_CONFIG_HOME/$progName" >/dev/null 2>&1
    touch "$XDG_CONFIG_HOME/$progName/portable_settings.txt"
    ln -s "$XDG_CONFIG_HOME/$progName/portable_settings.txt" "$progHome/portable_settings.txt" >/dev/null 2>&1
else
    touch "$progHome/portable_settings.txt"
fi

# If default wineprefix defined - run from it
if [ -n "$WINEPREFIX" ]; then
    WINEDEBUG=-all WINEPREFIX="$WINEPREFIX" WINEDLLOVERRIDES="d2d1=n" wine "$progHome/$progBin" "$@"
else
    WINEDEBUG=-all WINEDLLOVERRIDES="d2d1=n" wine "$progHome/$progBin" "$@"
fi