Skip to content

Commit

Permalink
v1.4.0 - avoid calling winetricks if not required, set Vortex user sy…
Browse files Browse the repository at this point in the history
…mlinks depending on the wine version used
  • Loading branch information
frostworx committed Aug 23, 2020
1 parent 440b820 commit edd3b02
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 51 deletions.
6 changes: 4 additions & 2 deletions README.md
Expand Up @@ -333,7 +333,9 @@ and when you exit Vortex the selected game will start normally (with your mods).
**Installation?**
If Vortex is not yet installed, it will be installed on the first launch, so the first launch will need some time (mostly depends on dotnets mind of its own... maybe 5 minutes).
Alternatively you can also install it via command line (see below).
Sometimes the dotnet installation hangs forever. I'm afraid there's nothing I can do to fix this (probably a winetricks bug(?).
If using proton-wine for `VORTEXWINE` (which is default if it is not configured) the `WINEPREFIX` user is "steamuser" (as always with proton wine).
When you switch to a wine version which doesn't patch the username to "steamuser" your user-settings are emtpy of course.
**stl** will not symlink in between those two users!

**Functionality**:
Some settings are preconfigured, to make this working without any user configuration, but of course all of the settings can be as well configured if you want.
Expand All @@ -344,7 +346,7 @@ Some settings are preconfigured, to make this working without any user configura
This directory contains the Vortex configfile `STLVORTEXCFG` *(`STLCFGDIR`/vortex/vortex.conf`)*

Here are the main configuration options:
- `VORTEXWINE`: the wine binary used for Vortex - **default commented out, but internally searches for system-wide wine if not configured**
- `VORTEXWINE`: the wine binary used for Vortex - **default commented out, if not configured it defaults to proton-wine if available and will fall back to system-wide wine**
- `VORTEXPREFIX`:the `WINEPREFIX` path used for Vortex - **default is `STLVORTEXDIR/wineprefix`**
- `VORTEXDOWNLOADPATH`: the path where all Vortex downloads should be stored - **default is `STLVORTEXDIR/downloads`**
- `VORTEXINSTALL`: download and install Vortex automatically if set to 1 **default enabled**
Expand Down
108 changes: 59 additions & 49 deletions stl
Expand Up @@ -5,7 +5,7 @@
### project ###

PROGNAME="SteamTinkerLaunch"
PROGVERS="v1.3.9"
PROGVERS="v1.4.0"
PROGCMD="$(basename "$0")"
PROJECTPAGE="https://github.com/frostworx/steamtinkerlaunch"

Expand Down Expand Up @@ -1790,45 +1790,36 @@ function hackWin32 {
function checkWinetricksInstPak {
if [ -n "$WINETRICKSPAKS" ]; then
if [ -x "$(command -v "$WINETRICKS" 2>/dev/null)" ]; then

writelog "INFO" "${FUNCNAME[0]} - installing $WINETRICKSPAKS silently with $WINETRICKS"
IFS=" " read -r -a INSTWINETRICKSPAKS <<< "$WINETRICKSPAKS"
# if everything goes well all packages are installed at once:
if [ "$FORCE32BITPFX" -eq 1 ]; then
extWine32Run "$WINETRICKS" --unattended "${INSTWINETRICKSPAKS[@]}"
else
extWine64Run "$WINETRICKS" --unattended "${INSTWINETRICKSPAKS[@]}"
fi

WTLOG="$GPFX/winetricks.log"
if [ -f "$WTLOG" ]; then
WTCNT="$(wc -l "$WTLOG" | awk '{print $1}')"
# if not this function tries to install the remaining ones one after another - pretty much untested so far:
if [ "${#INSTWINETRICKSPAKS[@]}" -gt "$WTCNT" ]; then
writelog "INFO" "${FUNCNAME[0]} - some packages in WINETRICKSPAKS have not been installed yet only $WTCNT of ${#INSTWINETRICKSPAKS[@]} installed so far - trying again"

IFS=" " read -r -a ISINSTALLED <<<"$(cat "$WTLOG")"
IFS=" " read -r -a NOTINSTALLED <<< "$(comm -23 <(echo "${INSTWINETRICKSPAKS[*]}") <(echo "${ISINSTALLED[*]}"))"

if [ -n "${NOTINSTALLED[0]}" ]; then
for u in "${NOTINSTALLED[@]}"; do
writelog "OK" "${FUNCNAME[0]} - ${#NOTINSTALLED[@]} of ${#INSTWINETRICKSPAKS[@]} - installing $u"
if [ "$FORCE32BITPFX" -eq 1 ]; then
mv "$GPFX/drive_c/windows/syswow64" "$GPFX/drive_c/windows/syswow64-$(cut -c1-4 <<< $RANDOM)"
extWine32Run "$WINETRICKS" --unattended "$u"
else
extWine64Run "$WINETRICKS" --unattended "$u"
fi

IFS=" " read -r -a ISINSTALLED <<<"$(cat "$WTLOG")"
IFS=" " read -r -a NOTINSTALLED <<< "$(comm -23 <(echo "${INSTWINETRICKSPAKS[*]}") <(echo "${ISINSTALLED[*]}"))"
done
if [ ! -f "$WTLOG" ]; then
writelog "INFO" "${FUNCNAME[0]} - installing $WINETRICKSPAKS silently with $WINETRICKS"
# if everything goes well all packages are installed at once:
if [ "$FORCE32BITPFX" -eq 1 ]; then
extWine32Run "$WINETRICKS" --unattended "${INSTWINETRICKSPAKS[@]}"
else
extWine64Run "$WINETRICKS" --unattended "${INSTWINETRICKSPAKS[@]}"
fi
else
writelog "OK" "${FUNCNAME[0]} - looks like all ${#INSTWINETRICKSPAKS[@]} packages in WINETRICKSPAKS have been installed successfully"
fi
else
writelog "ERROR" "${FUNCNAME[0]} - $WINETRICKS log $WTLOG not found - this should not happen"
NOTINSTALLEDLIST="$(comm -23 <(echo "${INSTWINETRICKSPAKS[*]}" | tr ' ' '\n' | sort) <(sort < "$WTLOG"))"
NOTINSTALLED=()
while IFS= read -r wp; do
NOTINSTALLED+=("$wp")
done <<< "$NOTINSTALLEDLIST"

if [ -n "${NOTINSTALLED[0]}" ]; then
writelog "INFO" "${FUNCNAME[0]} - installing following packages now: '${NOTINSTALLED[*]}'"
if [ "$FORCE32BITPFX" -eq 1 ]; then
mv "$GPFX/drive_c/windows/syswow64" "$GPFX/drive_c/windows/syswow64-$(cut -c1-4 <<< $RANDOM)"
extWine32Run "$WINETRICKS" --unattended "${NOTINSTALLED[@]}"
else
extWine64Run "$WINETRICKS" --unattended "${NOTINSTALLED[@]}"
fi
# re-check here?
# checkWinetricksInstPak
else
writelog "INFO" "${FUNCNAME[0]} - all packages of '$WINETRICKSPAKS' are already installed - nothing to do"
fi
fi
else
writelog "SKIP" "${FUNCNAME[0]} - $WINETRICKS not found - skipping"
Expand Down Expand Up @@ -2036,22 +2027,33 @@ function wineVortexRun {
}

function installVortexDeps {
if [ -x "$(command -v "$WINETRICKS" 2>/dev/null)" ]; then
writelog "INFO" "${FUNCNAME[0]} - installing Vortex dependencies"

if [ -f "${VORTEXPREFIX//\"/}/winetricks.log" ]; then
writelog "SKIP" "${FUNCNAME[0]} - winetricks.log found in ${VORTEXPREFIX//\"/} - assuming dependencies are already installed - skipping"
else

VORTEXDEPS="win10 corefonts dotnet48 dxvk"
# install deps:
if [ -x "$(command -v "$WINETRICKS" 2>/dev/null)" ]; then
writelog "INFO" "${FUNCNAME[0]} - installing Vortex dependencies first"
IFS=" " read -r -a INSTVORTEXPAKS <<< "$VORTEXDEPS"
VORTEXDEPS="win10 corefonts dotnet48 dxvk"
IFS=" " read -r -a INSTVORTEXPAKS <<< "$VORTEXDEPS"
WTLOG="${VORTEXPREFIX//\"/}/winetricks.log"

if [ ! -f "$WTLOG" ]; then
writelog "INFO" "${FUNCNAME[0]} - installing '$VORTEXDEPS' silently with $WINETRICKS"
wineVortexRun "$WINETRICKS" --unattended "${INSTVORTEXPAKS[@]}"
writelog "INFO" "${FUNCNAME[0]} - $VORTEXDEPS installed"
else
writelog "SKIP" "${FUNCNAME[0]} - $WINETRICKS not found - skipping Vortex dependency installation"
NOTINSTALLEDLIST="$(comm -23 <(echo "${INSTVORTEXPAKS[*]}" | tr ' ' '\n' | sort) <(sort < "$WTLOG"))"
NOTINSTALLED=()
while IFS= read -r wp; do
NOTINSTALLED+=("$wp")
done <<< "$NOTINSTALLEDLIST"

if [ -n "${NOTINSTALLED[0]}" ]; then
writelog "INFO" "${FUNCNAME[0]} - installing following packages now: '${NOTINSTALLED[*]}'"
wineVortexRun "$WINETRICKS" --unattended "${NOTINSTALLED[@]}"
else
writelog "INFO" "${FUNCNAME[0]} - all packages of '$VORTEXDEPS' are already installed - nothing to do"
fi
fi
else
writelog "SKIP" "${FUNCNAME[0]} - $WINETRICKS not found - skipping Vortex dependency installation"
fi
}

Expand Down Expand Up @@ -2777,9 +2779,17 @@ function checkVortex {
MyDocsMyGames="$MyDocs/My Games"
LocalSetAppData="Local Settings/Application Data"

UserMyDocs="${VORTEXPREFIX//\"/}/drive_c/users/$USER/$MyDocs"
UserMyDocsMyGames="${VORTEXPREFIX//\"/}/drive_c/users/$USER/$MyDocsMyGames"
UserLocalSetAppData="${VORTEXPREFIX//\"/}/drive_c/users/$USER/$LocalSetAppData"
if [ -d "${VORTEXPREFIX//\"/}/drive_c/users/steamuser" ];then
writelog "OK" "${FUNCNAME[0]} - Vortex is running with Proton wine - configuring for user 'steamuser'"
VUSER="steamuser"
else
writelog "OK" "${FUNCNAME[0]} - Vortex is running with regular wine - configuring for user '$USER'"
VUSER="$USER"
fi

UserMyDocs="${VORTEXPREFIX//\"/}/drive_c/users/$VUSER/$MyDocs"
UserMyDocsMyGames="${VORTEXPREFIX//\"/}/drive_c/users/$VUSER/$MyDocsMyGames"
UserLocalSetAppData="${VORTEXPREFIX//\"/}/drive_c/users/$VUSER/$LocalSetAppData"

if readlink "$UserMyDocsMyGames" >/dev/null ; then
writelog "OK" "${FUNCNAME[0]} - removing symlink '$UserMyDocsMyGames' pointing to '$(readlink "$UserMyDocsMyGames")'"
Expand Down

0 comments on commit edd3b02

Please sign in to comment.