breezy-desktop icon indicating copy to clipboard operation
breezy-desktop copied to clipboard

Update setup to use proper config/data home directories

Open wheaney opened this issue 2 years ago • 7 comments

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 avatar Oct 31 '23 21:10 wheaney

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 avatar Nov 23 '23 21:11 wheaney

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 avatar Nov 23 '23 21:11 wheaney

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

wheaney avatar Nov 23 '23 21:11 wheaney

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

pravic avatar Dec 13 '23 19:12 pravic

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 avatar Jan 30 '24 16:01 wheaney

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 avatar Mar 17 '24 20:03 wheaney

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

wheaney avatar May 08 '24 17:05 wheaney

XRLinuxDriver portion almost complete in https://github.com/wheaney/XRLinuxDriver/compare/xdg_reorg

wheaney avatar Jul 20 '24 06:07 wheaney

This is mostly done, it's incorporated all the way through Breezy Vulkan build, setup, uninstall. Breezy GNOME and decky plugin still need updates, mainly via changes to the shared XRDriverIPC module.

wheaney avatar Jul 22 '24 22:07 wheaney

I've pushed updates to Breezy GNOME and the decky plugin that pull in all the latest XDG reorg changes. The only thing that's left is updated the driver and breezy PKGBUILD files so AUR can build off these changes.

wheaney avatar Jul 23 '24 19:07 wheaney

AUR has been updated to accommodate the XDG changes. Finally closing this!

wheaney avatar Jul 24 '24 21:07 wheaney