diff --git a/bin/package_vulkan b/bin/package_vulkan index 5236546..59cb32f 100755 --- a/bin/package_vulkan +++ b/bin/package_vulkan @@ -46,22 +46,42 @@ cp $VULKAN_MODULES/sombrero/*.png $PACKAGE_DIR wget -P $PACKAGE_DIR https://raw.githubusercontent.com/crosire/reshade-shaders/384465d0287999caa6190b5ebea506200b4f4a0a/Shaders/ReShade.fxh wget -P $PACKAGE_DIR https://raw.githubusercontent.com/crosire/reshade-shaders/384465d0287999caa6190b5ebea506200b4f4a0a/Shaders/ReShadeUI.fxh +# if a custom_banner image exists, copy it over the sombrero one +if [ -e "$VULKAN_DIR/custom_banner.png" ]; then + cp $VULKAN_DIR/custom_banner.png $PACKAGE_DIR +fi + # copy vulkan setup scripts and configs mkdir -p $PACKAGE_DIR/bin -copy_and_inject_ua "$XREAL_DRIVER_DIR/bin/ua.sh" "$PACKAGE_DIR/bin" "$VULKAN_DIR/bin/setup" "$VULKAN_DIR/bin/breezy_vulkan_uninstall" +copy_and_inject_ua "$XREAL_DRIVER_DIR/bin/ua.sh" "$PACKAGE_DIR/bin" "$VULKAN_DIR/bin/setup" "$VULKAN_DIR/bin/verify_installation" "$VULKAN_DIR/bin/breezy_vulkan_uninstall" cp -r $VULKAN_DIR/config $PACKAGE_DIR # build xreal driver XREAL_BINARY=$XREAL_DRIVER_DIR/build/xrealAirLinuxDriver.tar.gz +pushd $XREAL_DRIVER_DIR + if [ ! -e "$XREAL_BINARY" ] || [ "$1" != "--skip-module-builds" ]; then - pushd $XREAL_DRIVER_DIR + # if a file exists at custom_banner_config.yml, copy it to the xrealAirLinuxDriver directory + if [ -e "$VULKAN_DIR/custom_banner_config.yml" ]; then + cp $VULKAN_DIR/custom_banner_config.yml $XREAL_DRIVER_DIR + fi + bin/package - popd fi +XREAL_MANIFEST_LINE=$(sha256sum build/driver_air_glasses/manifest) +popd + # copy xreal binary and setup script cp $XREAL_BINARY $PACKAGE_DIR cp $XREAL_DRIVER_DIR/bin/xreal_driver_setup $PACKAGE_DIR/bin +# create manifest file for verifying installed file checksums against the originally packaged versions +# include any file that doesn't get modified during setup (e.g. vkBasalt.json files) +pushd $PACKAGE_DIR +echo $XREAL_MANIFEST_LINE > manifest +sha256sum bin/breezy_vulkan_uninstall vkBasalt.64/libvkbasalt.so vkBasalt.32/libvkbasalt.so *.fx* *.png >> manifest +popd + # bundle everything up tar -zcvf $VULKAN_BUILD/breezyVulkan.tar.gz --directory $VULKAN_BUILD breezy_vulkan \ No newline at end of file diff --git a/modules/xrealAirLinuxDriver b/modules/xrealAirLinuxDriver index 82d38ce..5d074de 160000 --- a/modules/xrealAirLinuxDriver +++ b/modules/xrealAirLinuxDriver @@ -1 +1 @@ -Subproject commit 82d38ce285e68df8671d7516480391b589a7f78f +Subproject commit 5d074de7456d1fce2e5aa49293dc04bc34e3195b diff --git a/vulkan/bin/breezy_vulkan_uninstall b/vulkan/bin/breezy_vulkan_uninstall index f089056..d88eaaa 100755 --- a/vulkan/bin/breezy_vulkan_uninstall +++ b/vulkan/bin/breezy_vulkan_uninstall @@ -34,6 +34,9 @@ rm $USER_HOME/.local/share/vulkan/implicit_layer.d/vkBasalt.x86.json rm -rf $USER_HOME/.config/vkBasalt rm -rf $USER_HOME/.config/reshade +[ "$for_install" -eq 0 ] && echo "Removing scripts at $USER_HOME/.local/bin/breezy_vulkan" +rm -rf $USER_HOME/.local/bin/breezy_vulkan + [ "$for_install" -eq 0 ] && echo "SKIPPING xrealAirLinuxDriver uninstall to keep mouse/joystick driver functionality." [ "$for_install" -eq 0 ] && echo "To manually uninstall xrealAirLinuxDriver, do: \"sudo ~/bin/xreal_driver_uninstall\"" diff --git a/vulkan/bin/setup b/vulkan/bin/setup index 4f9ad41..a55476a 100755 --- a/vulkan/bin/setup +++ b/vulkan/bin/setup @@ -60,6 +60,17 @@ 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" @@ -69,4 +80,5 @@ then else bin/xreal_driver_setup -v $1 $(pwd)/xrealAirLinuxDriver.tar.gz fi + echo "END - xreal_driver_setup" \ No newline at end of file diff --git a/vulkan/bin/verify_installation b/vulkan/bin/verify_installation new file mode 100755 index 0000000..9cfcb85 --- /dev/null +++ b/vulkan/bin/verify_installation @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +set -e + +# create a string to string mapping, file name to expected file location +declare -A file_paths +file_paths=( + ["bin/breezy_vulkan_uninstall"]="{user_home}/bin/breezy_vulkan_uninstall" + ["vkBasalt.64/libvkbasalt.so"]="{user_home}/.local/lib/libvkbasalt.so" + ["vkBasalt.32/libvkbasalt.so"]="{user_home}/.local/lib32/libvkbasalt.so" + ["IMUAdjust.fx"]="{user_home}/.config/reshade/Shaders/IMUAdjust.fx" + ["ReShade.fxh"]="{user_home}/.config/reshade/Shaders/ReShade.fxh" + ["ReShadeUI.fxh"]="{user_home}/.config/reshade/Shaders/ReShadeUI.fxh" + ["Sideview.fx"]="{user_home}/.config/reshade/Shaders/Sideview.fx" + ["calibrating.png"]="{user_home}/.config/reshade/Textures/calibrating.png" + ["custom_banner.png"]="{user_home}/.config/reshade/Textures/custom_banner.png" + ["build/driver_air_glasses/manifest"]="{user_home}/.local/bin/xr_driver/manifest" +) + +# verify the file hashes in ./manifest +while IFS= read -r line +do + # split the line into hash and filename + manifest_hash=$(echo $line | awk '{print $1}') + file=$(echo $line | awk '{print $2}') + + actual_file_path=${file_paths[$file]} + + # compute the SHA256 hash of the actual file + actual_hash=$(sha256sum $actual_file_path | awk '{print $1}') + + # compare the hashes + if ! [ "$manifest_hash" = "$actual_hash" ]; then + echo "Verification failed" >&2 + exit 1 + fi +done < "{user_home}/.local/bin/breezy_vulkan/manifest" + +# if our checks succeeded, run the xr_driver verify script +{user_home}/.local/bin/xr_driver/verify_installation > /dev/null + +echo "Verification succeeded" \ No newline at end of file diff --git a/vulkan/custom_banner.png b/vulkan/custom_banner.png new file mode 100644 index 0000000..6372a13 Binary files /dev/null and b/vulkan/custom_banner.png differ diff --git a/vulkan/custom_banner_config.yml b/vulkan/custom_banner_config.yml new file mode 100644 index 0000000..62c3f64 --- /dev/null +++ b/vulkan/custom_banner_config.yml @@ -0,0 +1,3 @@ +start_date: 1707523200 +end_date: 1709942400 +target_device_vendor_id: 0x3318 \ No newline at end of file diff --git a/vulkan/modules/sombrero b/vulkan/modules/sombrero index acaeb56..d077766 160000 --- a/vulkan/modules/sombrero +++ b/vulkan/modules/sombrero @@ -1 +1 @@ -Subproject commit acaeb5666ea6861f68d3011be535dd65f63a9894 +Subproject commit d077766d2a594871418cc56fed93cbfd5d20513e