84 lines
3.9 KiB
Bash
Executable File
84 lines
3.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
# This script gets packaged with the release and should do the bulk of the setup work. This allows this setup to be tied
|
|
# to a specific release of the code, and guarantees it will never run along-side newer or older binaries.
|
|
|
|
USER=${SUDO_USER:-$USER}
|
|
USER_HOME=$(getent passwd $USER | cut -d: -f6)
|
|
UA_EVENT_NAME="breezy_install"
|
|
if [ -e "$USER_HOME/bin/breezy_vulkan_uninstall" ]; then
|
|
echo "Cleaning up the previous installation"
|
|
|
|
# ` || true` will ensure that this can't cause a failure, even with `set -e`
|
|
$USER_HOME/bin/breezy_vulkan_uninstall --for-install || true
|
|
|
|
UA_EVENT_NAME="breezy_update"
|
|
fi
|
|
|
|
UA_CLIENT_ID="BreezyVulkan"
|
|
UA_EVENT_VERSION="$1"
|
|
#INJECT_UA_CALL
|
|
|
|
echo "Copying the breezy_vulkan scripts to ${USER_HOME}/bin"
|
|
if [ ! -d "$USER_HOME/bin" ]; then
|
|
su -c 'mkdir -p '$USER_HOME'/bin' $USER
|
|
fi
|
|
cp bin/breezy_vulkan_uninstall $USER_HOME/bin
|
|
|
|
echo "Installing vkBasalt; copying binaries, configs, and shader files to ${USER_HOME}/.local and ${USER_HOME}/.config"
|
|
|
|
# much of the setup below was informed by https://github.com/simons-public/steam-deck-vkbasalt-install
|
|
# copy the vkBasalt binaries and configs
|
|
su -c 'mkdir -p '$USER_HOME'/.local/{lib,lib32,share/vulkan/implicit_layer.d}' $USER
|
|
su -c 'mkdir -p '$USER_HOME'/.config/{vkBasalt,reshade/Shaders,reshade/Textures}' $USER
|
|
cp vkBasalt.64/libvkbasalt.so $USER_HOME/.local/lib/
|
|
cp vkBasalt.32/libvkbasalt.so $USER_HOME/.local/lib32/
|
|
chown $USER:$USER $USER_HOME/.local/lib/libvkbasalt.so
|
|
chown $USER:$USER $USER_HOME/.local/lib32/libvkbasalt.so
|
|
|
|
# there is only one vkBasalt.json file, use the 64-bit directory for both, copy and make replacements
|
|
if grep -q SteamOS /etc/os-release ; then
|
|
sed -e "s|libvkbasalt.so|${USER_HOME}/.local/lib/libvkbasalt.so|" -e "s/ENABLE_VKBASALT/SteamDeck/" vkBasalt.64/vkBasalt.json > $USER_HOME/.local/share/vulkan/implicit_layer.d/vkBasalt.json
|
|
sed -e "s|libvkbasalt.so|${USER_HOME}/.local/lib32/libvkbasalt.so|" -e "s/ENABLE_VKBASALT/SteamDeck/" vkBasalt.64/vkBasalt.json > $USER_HOME/.local/share/vulkan/implicit_layer.d/vkBasalt.x86.json
|
|
else
|
|
sed -e "s|libvkbasalt.so|${USER_HOME}/.local/lib/libvkbasalt.so|" vkBasalt.64/vkBasalt.json > $USER_HOME/.local/share/vulkan/implicit_layer.d/vkBasalt.json
|
|
sed -e "s|libvkbasalt.so|${USER_HOME}/.local/lib32/libvkbasalt.so|" vkBasalt.64/vkBasalt.json > $USER_HOME/.local/share/vulkan/implicit_layer.d/vkBasalt.x86.json
|
|
fi
|
|
chown $USER:$USER $USER_HOME/.local/share/vulkan/implicit_layer.d/vkBasalt.*
|
|
|
|
# copy the vkBasalt.conf file and make replacements
|
|
sed -e "s|/path/to/reshade-shaders|${USER_HOME}/.config/reshade|" \
|
|
-e "s|/path/to/virtual_display|${USER_HOME}/.config/reshade/Shaders/IMUAdjust.fx|" \
|
|
-e "s|/path/to/sideview|${USER_HOME}/.config/reshade/Shaders/Sideview.fx|" \
|
|
config/vkBasalt.conf > $USER_HOME/.config/vkBasalt/vkBasalt.conf
|
|
chown -R $USER:$USER $USER_HOME/.config/vkBasalt
|
|
|
|
echo "Installing the Sombrero shaders and texture files to ${USER_HOME}/.config/reshade/{Shaders,Textures}"
|
|
cp *.fx* $USER_HOME/.config/reshade/Shaders
|
|
cp *.png $USER_HOME/.config/reshade/Textures
|
|
chown -R $USER:$USER $USER_HOME/.config/reshade
|
|
|
|
# escaping sed replace: https://stackoverflow.com/questions/407523/escape-a-string-for-a-sed-replace-pattern
|
|
ESCAPED_USER_HOME=$(printf '%s\n' "$USER_HOME" | sed -e 's/[\/&]/\\&/g')
|
|
|
|
echo "Copying the verification script and manifest to ${USER_HOME}/.local/bin/breezy_vulkan"
|
|
sed -i -e "s/{user_home}/$ESCAPED_USER_HOME/g" bin/verify_installation
|
|
if [ ! -d "$USER_HOME/.local/bin/breezy_vulkan" ]; then
|
|
mkdir -p $USER_HOME/.local/bin/breezy_vulkan
|
|
fi
|
|
cp -p bin/verify_installation $USER_HOME/.local/bin/breezy_vulkan
|
|
cp manifest $USER_HOME/.local/bin/breezy_vulkan
|
|
|
|
# set up the XREAL driver using the local binary
|
|
echo "Installing xrealAirLinuxDriver"
|
|
echo "BEGIN - xreal_driver_setup"
|
|
if [ -z "$1" ]
|
|
then
|
|
bin/xreal_driver_setup $(pwd)/xrealAirLinuxDriver.tar.gz
|
|
else
|
|
bin/xreal_driver_setup -v $1 $(pwd)/xrealAirLinuxDriver.tar.gz
|
|
fi
|
|
|
|
echo "END - xreal_driver_setup" |