Skip to content

Instantly share code, notes, and snippets.

@helpful-fox-senko-san
Last active February 4, 2025 02:56
Show Gist options
  • Save helpful-fox-senko-san/6238143f5c7352ab44e62c5a0f7f7642 to your computer and use it in GitHub Desktop.
Save helpful-fox-senko-san/6238143f5c7352ab44e62c5a0f7f7642 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
# You can change the install path here if you like
TT_PATH=/opt/tt
command -v tar > /dev/null || { echo "'tar' command is required"; exit 1; }
command -v wget > /dev/null || { echo "'wget' command is required"; exit 1; }
command -v unzip > /dev/null || { echo "'unzip' command is required"; exit 1; }
welcome()
{
echo "This script will download and install TexTools in to $TT_PATH"
echo "More than 3GB of free space is required for installation"
echo "Expected installation time is around 5 minutes + 500MB of downloads"
echo ""
echo "If any step of the installation process fails, it should not be attempted manually"
echo "without extreme care, as it is very easy to end up with a non-working installation."
echo ""
echo "If you do not wish to install press Ctrl+C now otherwise press ENTER to continue."
read _
}
sudo_mkdir()
{
echo ""
echo "Prompting for password to create $TT_PATH"
[ -z "$UID" ] && UID=`id -u`
[ -z "$GID" ] && GID=`id -g`
sudo /bin/sh -c "mkdir -p \"$TT_PATH\"; chown $UID:$GID \"$TT_PATH\""
}
install_segoe()
{
echo "Installing Segoe UI fonts"
( cd "$WINEPREFIX"/drive_c/windows/Fonts/; unzip -q -o -j "$TT_PATH"/segoe-ui-linux-a89213b7136da6dd5c3638db1f2c6e814c40fa84.zip "segoe-ui-linux-a89213b7136da6dd5c3638db1f2c6e814c40fa84/font/*" )
cat << EOF > "$TT_PATH"/install_segoe_ui.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts]
"Segoe Script (TrueType)"="segoesc.ttf"
"Segoe Script Bold (TrueType)"="segoescb.ttf"
"Segoe UI (TrueType)"="segoeui.ttf"
"Segoe UI Bold (TrueType)"="segoeuib.ttf"
"Segoe UI Italic (TrueType)"="segoeuii.ttf"
"Segoe UI Bold Italic (TrueType)"="segoeuiz.ttf"
"Segoe UI Semibold (TrueType)"="seguisb.ttf"
"Segoe UI Light (TrueType)"="segoeuil.ttf"
"Segoe UI Symbol (TrueType)"="seguisym.ttf"
EOF
"$WINE64" regedit "$TT_PATH"/install_segoe_ui.reg
}
restart_wineprefix()
{
[ -d "$WINEPREFIX" ] || exit 1
echo ""
echo "WINEPREFIX directory $WINEPREFIX already exists"
echo ""
echo "Please delete this directory and re-run the script to restart the installation."
echo ""
exit 1
}
cleanup()
{
rm -f \
"$TT_PATH"/GE-Proton9-15.tar.gz \
"$TT_PATH"/segoe-ui-linux-a89213b7136da6dd5c3638db1f2c6e814c40fa84.zip \
"$TT_PATH"/install_segoe_ui.reg \
"$TT_PATH"/Install_TexTools.exe
}
welcome
[ -d "$TT_PATH" ] || mkdir "$TT_PATH" || sudo_mkdir "$TT_PATH"
cd "$TT_PATH"
# Set up environment variables mostly for winetricks to work
export WINETRICKS="$TT_PATH"/winetricks
WINE_BIN="$TT_PATH"/GE-Proton9-15/files/bin
export WINE="$WINE_BIN"/wine
export WINE64="$WINE_BIN"/wine64
export WINESERVER="$WINE_BIN"/wineserver
export WINEARCH=win64
export WINEPREFIX="$TT_PATH"/wineprefix
export WINEDEBUG="fixme-all,-ole,-combase,-environ"
export DXVK_LOG_LEVEL=error
# extra error suppression during installation
export WINETRICKS_SUPER_QUIET=1
EXTRAQUIET="$WINEDEBUG,-rpc,-ntoskrnl,-tabtip,-imagehlp,-richedit"
[ -d "$WINEPREFIX" ] && restart_wineprefix
echo === Downloading files ...
wget --quiet --show-progress -N https://github.com/GloriousEggroll/proton-ge-custom/releases/download/GE-Proton9-15/GE-Proton9-15.tar.gz
wget --quiet --show-progress -N https://github.com/TexTools/FFXIV_TexTools_UI/releases/download/v3.0.8.7/Install_TexTools.exe
[ -f segoe-ui-linux-a89213b7136da6dd5c3638db1f2c6e814c40fa84.zip ] || wget --quiet --show-progress https://github.com/mrbvrz/segoe-ui-linux/archive/a89213b7136da6dd5c3638db1f2c6e814c40fa84.zip -O segoe-ui-linux-a89213b7136da6dd5c3638db1f2c6e814c40fa84.zip
[ -f winetricks ] || wget --quiet --show-progress https://raw.githubusercontent.com/Winetricks/winetricks/20240105/src/winetricks
INTEGRITY="0465cca44b8f068401c4ecbd7aad63a23942d3355015c10f799134a39dd42260 GE-Proton9-15.tar.gz
88b77302a05297dd7f1ec8dee8285ef5814ea548ef6f542a79f44da5e8f73d0a Install_TexTools.exe
f14f5315c74634e320cd6af498393c096a20f3f1f2bf0241a6b0499188924f86 segoe-ui-linux-a89213b7136da6dd5c3638db1f2c6e814c40fa84.zip
8f28985b06e9e04b5268e2aef3429b2a0f6abd4fd12c4a30472dfe66355128fa winetricks";
if command -v sha256sum > /dev/null; then
echo === Verifying downloaded files ...
INTEGRITY_CHECK=`sha256sum GE-Proton9-15.tar.gz Install_TexTools.exe segoe-ui-linux-a89213b7136da6dd5c3638db1f2c6e814c40fa84.zip winetricks`
[ "$INTEGRITY" != "$INTEGRITY_CHECK" ] && { echo "Download integrity check failed!"; exit 1; }
fi
tar -xf GE-Proton9-15.tar.gz
chmod +x winetricks
# Create wineprefix without prompting to install Mono (not required with proton)
#echo === Initializing $WINEPREFIX ...
#mkdir "$WINEPREFIX"
#WINEDEBUG="$EXTRAQUIET" WINEDLLOVERRIDES="mscoree,mshtml=" "$WINEBOOT" -i
# Use winetricks to install .NET Framework 4.8 + DXVK + required fonts
echo === Installing .NET 4.8 ...
WINEDEBUG="$EXTRAQUIET" "$WINETRICKS" -q dotnet48
echo === Installing DXVK ...
WINEDEBUG="$EXTRAQUIET" "$WINETRICKS" -q dxvk
echo === Installing fonts ...
WINEDEBUG="$EXTRAQUIET" "$WINETRICKS" -q corefonts
WINEDEBUG="$EXTRAQUIET" install_segoe
# Install TexTools ... and re-run in GUI mode if the installation fails !
echo === Installing TexTools ...
WINEDEBUG="$EXTRAQUIET" "$WINE64" ./Install_Textools.exe /S || WINEDEBUG="$EXTRAQUIET" "$WINE64" ./Install_Textools.exe
# At this point everything is installed, so don't abort the script over a last minute stumble
set +e
# Bonus: Link some folder to real folders
STEAMUSER="$WINEPREFIX/drive_c/users/steamuser"
[ -e ~/Desktop -a -d "$STEAMUSER/Desktop" ] && rmdir "$STEAMUSER/Desktop" && ln -s ~/Desktop/ "$STEAMUSER/Desktop"
[ -e ~/Documents -a -d "$STEAMUSER/Documents" ] && rmdir "$STEAMUSER/Documents"/* && rmdir "$STEAMUSER/Documents" && ln -s ~/Documents/ "$STEAMUSER/Documents"
[ -e ~/Downloads -a -d "$STEAMUSER/Downloads" ] && rmdir "$STEAMUSER/Downloads" && ln -s ~/Downloads/ "$STEAMUSER/Downloads"
echo === Creating shortcuts ...
cat << EOF > "$TT_PATH/textools"
#!/bin/sh
export WINEPREFIX="$WINEPREFIX"
export WINEDEBUG="$WINEDEBUG"
export DXVK_LOG_LEVEL="$DXVK_LOG_LEVEL"
exec "$WINE64" "$WINEPREFIX/drive_c/Program Files/FFXIV TexTools/FFXIV_TexTools/FFXIV_TexTools.exe" "\$@"
EOF
chmod +x "$TT_PATH/textools"
cat << EOF > "$TT_PATH/consoletools"
#!/bin/sh
export WINEPREFIX="$WINEPREFIX"
export WINEDEBUG="$WINEDEBUG"
export DXVK_LOG_LEVEL="$DXVK_LOG_LEVEL"
exec "$WINE64" "$WINEPREFIX/drive_c/Program Files/FFXIV TexTools/FFXIV_TexTools/ConsoleTools.exe" "\$@"
EOF
chmod +x "$TT_PATH/consoletools"
# Bonus: Link launcher script "textools" (and consoletools) in ~/bin/ if it exists
[ -e ~/bin/textools ] && rm ~/bin/textools || [ 1 ]
[ -e ~/bin/consoletools ] && rm ~/bin/consoletools || [ 1 ]
[ -d ~/bin -a ! -e ~/bin/textools ] && ln -s "$TT_PATH/textools" ~/bin/textools && echo " - Command 'textools' installed for user"
[ -d ~/bin -a ! -e ~/bin/consoletools ] && ln -s "$TT_PATH/consoletools" ~/bin/consoletools && echo " - Command 'consoletools' installed for user"
# Bonus: Create desktop icon
mkdir -p ~/.local/share/applications/
cat << EOF > ~/.local/share/applications/FFXIV_TexTools.desktop
[Desktop Entry]
Type=Application
Name=FFXIV TexTools
Icon=$WINEPREFIX/drive_c/Program Files/FFXIV TexTools/FFXIV_TexTools/Resources/ffxiv2.ico
Exec=env WINEDEBUG="$WINEDEBUG" DXVK_LOG_LEVEL="$DXVK_LOG_LEVEL" WINEPREFIX="$WINEPREFIX" "$WINE64" "$WINEPREFIX/drive_c/Program Files/FFXIV TexTools/FFXIV_TexTools/FFXIV_TexTools.exe" %F
EOF
[ -f ~/.local/share/applications/FFXIV_TexTools.desktop ] && echo " - Application shortcut installed for user";
cleanup
# This updates the desktop / app launcher to display the new shortcut hopefully
xdg-desktop-menu forceupdate || [ 1 ]
echo === All done!
@helpful-fox-senko-san
Copy link
Author

Uninstall

sudo rm -rf /opt/tt/
rm -f ~/bin/textools ~/bin/consoletoools ~/.local/share/applications/FFXIV_TexTools.desktop
xdg-desktop-menu forceupdate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment