Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update setup to use proper config/data home directories #4

Open
wheaney opened this issue Oct 31, 2023 · 7 comments
Open

Update setup to use proper config/data home directories #4

wheaney opened this issue Oct 31, 2023 · 7 comments

Comments

@wheaney
Copy link
Owner

wheaney commented Oct 31, 2023

Per the Vulkan Linux Layer Discovery documentation, before the setup script copies our vkBasalt config and lib files to ~/.config and ~/.local, we should be checking whether $XDG_CONFIG_HOME or $XDG_DATA_HOME environment variables are set and use them if they are.

@wheaney
Copy link
Owner Author

wheaney commented Nov 23, 2023

We should also be moving the driver's bin and config files to their proper directories. Keep in mind you'd need to update the setup scripts to copy the existing config file if the user already has one.

@wheaney
Copy link
Owner Author

wheaney commented Nov 23, 2023

Also note that the setup scripts call uninstall for the previous version already, so if you just update setup to do install properly going forward, you don't need to clean up the old bin files. Only the config file needs special treatment to be preserved.

@wheaney
Copy link
Owner Author

wheaney commented Nov 23, 2023

We should also update the README docs to reference new bin and config file locations.

@pravic
Copy link

pravic commented Dec 13, 2023

~/.xreal_driver_log should be moved somewhere better as well.

@wheaney
Copy link
Owner Author

wheaney commented Jan 30, 2024

I'm updating all the file locations now soon. Here's my plan:

  • logs: ~/.local/share/xr_driver/logs
    • currently ~/.xreal_driver_log
  • driver binary: /usr/local/bin/xr_driver/
    • currently ~/bin/xrealAirLinuxDriver
  • bash scripts: ~/.local/bin/xr_driver/
    • currently ~/bin/xreal_driver_(config/uninstall)
  • driver config file: ~/.config/xr_driver/
    • currently ~/.xreal_driver_config

@wheaney
Copy link
Owner Author

wheaney commented Mar 17, 2024

Just a note: all my recommendations above are based on eventually moving to a user-systemd service (instead of system/root like it is now).

Additional recommendations from a convo on the Discord:

If stuff is reading and writing to the user-directory then the systemd unit should probably be a user-unit in ${XDG_CONFIG_HOME}/systemd/user too.
Likewise IPC and lock bits would go into ${XDG_RUNTIME_DIR}/xr_driver
Rather than ~/.local/share/xr_driver/logs logs are considered state so would go to ${XDG_STATE_HOME}/xr_driver/logs

We should also move the license file currently located at /var/lib/xr_driver/device_license.

Also reiterating a point above: we'll want the driver setup script to move some of these files so they're preserved. Specifically the config and log files, but the license could be moved as well (it'll just be re-downloaded to the new location if we don't do this, but if somehow they ran the setup offline, it would be better to proactively move for them so they don't lose functionality if they aren't able to download).

@wheaney
Copy link
Owner Author

wheaney commented May 8, 2024

I plan to tackle this soon. Here's the current plan, slightly modified from the last, also incorporating the latest comments and a more comprehensive list including all Breezy stuff.

XRLinuxDriver

File type XDG directory Fallback Current location
Logs & license $XDG_STATE_HOME/xr_driver/(logs/*|license.json) ~/.local/state/xr_driver/(logs/*|license.json) ~/.xreal_driver_log /var/lib/xr_driver/device_license
Driver binary & scripts $XDG_BIN_HOME/xr_driver(_setup|_uninstall|_cli|_verify) ~/.local/bin/xr_driver(_setup|_uninstall|_cli|_verify) ~/bin/xrealAirLinuxDriver ~/bin/xreal_driver_(config|uninstall) ~/.local/bin/xr_driver/verify_installation
Driver config $XDG_CONFIG_HOME/xr_driver/config.ini ~/.config/xr_driver/config.ini ~/.xreal_driver_config
systemd unit $XDG_CONFIG_HOME/systemd/user/xr-driver.service ~/.config/systemd/user/xr-driver.service /etc/systemd/system/xreal-air-driver.service
Lock file $XDG_RUNTIME_DIR/xr_driver/lock.pid /tmp/xr_driver/lock.pid ~/.xreal_driver_lock
IMU data IPC $XDG_RUNTIME_DIR/xr_driver/shader_runtime_* /tmp/xr_driver/shader_runtime_* /tmp/shader_runtime_*
State/control IPC n/a n/a /dev/shm/xr_driver_(state|control) unchanged, uses shared memory location
Driver manifest $XDG_DATA_HOME/xr_driver/manifest ~/.local/share/xr_driver/manifest ~/.local/bin/xr_driver/manifest

Breezy Vulkan

File type XDG directory Fallback Current location
Breezy scripts $XDG_BIN_HOME/breezy_vulkan_(setup|uninstall|verify) ~/.local/bin/breezy_vulkan_(setup|uninstall|verify) ~/bin/breezy_vulkan_(setup|uninstall) ~/.local/bin/breezy_vulkan/verify_installation
Breezy manifest $XDG_DATA_HOME/breezy_vulkan/manifest ~/.local/share/breezy_vulkan/manifest ~/.local/bin/breezy_vulkan/manifest
vkBasalt binaries n/a n/a ~/.local/lib(32) no XDG spec for this one
vkBasalt & reshade config $XDG_CONFIG_HOME/(vkBasalt/*|reshade/*) ~/.config/(vkBasalt/*|reshade/*) ~/.config/(vkBasalt/*|reshade/*)
Vulkan implicit layer config $XDG_DATA_HOME/vulkan/implicit_layer.d/vkBasalt*.json ~/.local/share/vulkan/implicit_layer.d/vkBasalt*.json ~/.local/share/vulkan/implicit_layer.d/vkBasalt*.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants