summarylogtreecommitdiffstats
path: root/evesetup.shlib
diff options
context:
space:
mode:
Diffstat (limited to 'evesetup.shlib')
-rw-r--r--evesetup.shlib104
1 files changed, 104 insertions, 0 deletions
diff --git a/evesetup.shlib b/evesetup.shlib
new file mode 100644
index 000000000000..c2ce68e19a83
--- /dev/null
+++ b/evesetup.shlib
@@ -0,0 +1,104 @@
+#!/bin/sh
+
+# evelauncher fixed values
+
+CONFDIR="$HOME/.config/CCP"
+EVECONF="$CONFDIR/EVE.conf"
+
+# default value if not set
+
+SHAREDIR="$HOME/.eve"
+
+# evesetup shared functions
+
+check_env() {
+ if [ -d "$CONFDIR" ] ;then
+ if [ -r "$EVECONF" ] ;then
+ SHAREDIR=$(grep SharedCacheFolder $EVECONF | cut -d= -f2)
+ fi
+ fi
+ [ ! -d "$SHAREDIR" ] && SHAREDIR=""
+ if [ "x$SHAREDIR" != "x$EVEDIR/SharedCache/" ] ;then
+ desktop_msg "Please wait, preparing environment in $EVEDIR"
+ mkdir -p $CONFDIR
+ echo "[General]" >$EVECONF
+ echo "SharedCacheFolder=$EVEDIR/SharedCache/" >>$EVECONF
+ echo "UseCustomWine=true" >>$EVECONF
+ echo "CustomWinePath=$WINEPATH/wine" >>$EVECONF
+ mkdir -p $EVEDIR/SharedCache
+ tar xf $SETUPDIR/lib/evelauncher-$ELVER.tar.?z -C $EVEDIR
+ mv $EVEDIR/evelauncher $LAUNCHER
+ if [ -d "$SHAREDIR/ResFiles/" ] ;then
+ mv $SHAREDIR/ResFiles/ $EVEDIR/SharedCache/
+ mv $SHAREDIR/*.txt $EVEDIR/SharedCache/
+ rm -rf $SHAREDIR
+ fi
+ fi
+}
+
+check_steam() {
+ if [ ! -r "$LAUNCHER/steam_appid.txt" -a -x "$(which steam 2>/dev/null)" ] ;then
+ echo "8500" >$LAUNCHER/steam_appid.txt
+ fi
+}
+
+check_wine() {
+ if [ ! -r "$EVECONF" ] ;then
+ desktop_msg "ERROR: EVE Configuration not found!"
+ exit 1
+ fi
+ CUSTOMWP=$(grep CustomWinePath $EVECONF | cut -d= -f2)
+ SHAREDIR=$(grep SharedCacheFolder $EVECONF | cut -d= -f2)
+ UCW=$(grep UseCustomWine $EVECONF | cut -d= -f2)
+ WINEPREFIX=${SHAREDIR}wineenv
+ if [ "x$UCW" = "xtrue" ] ;then
+ WINEPATH=${CUSTOMWP%/*}
+ [ -d "${SHAREDIR}wine" ] && rm -rf ${SHAREDIR}wine
+ else
+ CUSTOMWP=${SHAREDIR}wine
+ WINEPATH=${SHAREDIR}wine/bin
+ fi
+ if [ ! -x "$WINEPATH/wine" ] ;then
+ desktop_msg "ERROR: \"$CUSTOMWP\" not found!"
+ exit 1
+ fi
+ INSTWINE=$(cat $WINEPREFIX/.update-timestamp 2>/dev/null | tr -dc [:digit:]) || true
+ WINEINFP=$(readlink -f $CUSTOMWP)
+ WINECONF=${WINEINFP%/bin*}/share/wine/wine.inf
+ WINEDATE=$(ls -l --time-style=+%s $WINECONF 2>/dev/null | cut -d' ' -f6)
+ if [ "x$WINEDATE" != "x$INSTWINE" ] ;then
+ desktop_msg "Preparing wine in $WINEPREFIX"
+ env WINEPREFIX=$WINEPREFIX \
+ WINEDEBUG=-all \
+ WINEDLLOVERRIDES="mscoree,mshtml=d" \
+ $WINEPATH/wineboot
+ env WINEPREFIX=$WINEPREFIX \
+ $WINEPATH/wine reg add \
+ 'HKCU\Software\Wine\FileOpenAssociations' \
+ /v Enable /d N /f >/dev/null
+ WINETRP=$(cat $WINEPREFIX/winetricks.log 2>/dev/null | uniq)
+ if [ "x$WINETRP" != "x" ] ;then
+ desktop_msg "Apply winetricks settings. This will take some time."
+ rm $WINEPREFIX/winetricks.log >/dev/null
+ env WINEPREFIX=$WINEPREFIX \
+ WINE=$WINEPATH/wine \
+ $(which winetricks) -q --force $WINETRP >/dev/null
+ fi
+ fi
+ if [ -x "$WINEPATH/wine64" ] ;then
+ WINE=$WINEPATH/wine64
+ else
+ WINE=$WINEPATH/wine
+ fi
+ env WINEPREFIX=$WINEPREFIX \
+ $WINE reg delete \
+ 'HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices' \
+ /v winemenubuilder /f >/dev/null || true
+}
+
+desktop_msg() {
+ if [ -x "$(which notify-send 2>/dev/null)" ] ;then
+ notify-send -i eve $(basename $0) "$@"
+ fi
+ printf "$(basename $0): $@\n"
+}