Move updater to its own module

This commit is contained in:
Hannah Lindrob committed 2026-02-13 14:22:35 +01:00
1 parent 2d7877742c
commit bfea8026a4
3 files changed
+36 -10

No files matched your search

File renamed without changes.
@@ -6,33 +6,57 @@ class Linux {
fun updateLinux() {
updateLinuxSteamVRDriver()
updateServer()
}
//TODO: tell user in gui to add steamvr launch arguments
fun updateLinuxSteamVRDriver() {
val vrPathRegContents = executeShellCommand("${System.getProperty("user.home")}/.steam/steam/steamapps/common/SteamVR/bin/vrpathreg.sh")
val isDriverRegistered = vrPathRegContents.contains("LINUXSTEAMVRDRIVERDIRECTORY")
val isDriverRegistered = vrPathRegContents.contains("slimevr")
if (!isDriverRegistered) {
println("Downloading driver")
downloadFile(LINUXSTEAMVRDRIVERURL, LINUXSTEAMVRDRIVERNAME)
unzip(LINUXSTEAMVRDRIVERNAME, LINUXSTEAMVRDRIVERDIRECTORY)
println("Driver downloaded")
println("Registering driver with steamvr")
executeShellCommand(
"${System.getProperty("user.home")}/.steam/steam/steamapps/common/SteamVR/bin/vrpathreg.sh adddriver ${
Paths.get(
"",
).toAbsolutePath()
}/$LINUXSTEAMVRDRIVERDIRECTORY/slimevr",
println("${Paths.get("").toAbsolutePath()}/$LINUXSTEAMVRDRIVERDIRECTORY/slimevr")
executeShellCommand("${System.getProperty("user.home")}/.steam/steam/steamapps/common/SteamVR/bin/vrpathreg.sh",
"adddriver",
"${Paths.get(
"",
).toAbsolutePath()
}/$LINUXSTEAMVRDRIVERDIRECTORY/slimevr"
)
} else {
println("steamVR driver is already registered. Skipping...")
}
}
fun updateLinuxServer() {
fun removeLinuxSteamVRDriver() {
val vrPathRegContents = executeShellCommand("${System.getProperty("user.home")}/.steam/steam/steamapps/common/SteamVR/bin/vrpathreg.sh")
val isDriverRegistered = vrPathRegContents.contains("slimevr")
if (isDriverRegistered) {
println("Removing driver from steamvr")
executeShellCommand("${System.getProperty("user.home")}/.steam/steam/steamapps/common/SteamVR/bin/vrpathreg.sh",
"removedriver",
"${Paths.get(
"",
).toAbsolutePath()
}/$LINUXSTEAMVRDRIVERDIRECTORY/slimevr"
)
} else {
println("steamVR driver isn't registered. Skipping...")
}
}
fun updateServer() {
println("Downloading Server")
downloadFile(LINUXSERVERURL, LINUXSERVERNAME)
}
//TODO: Probably best to just ask the user in the ui to update udev if i can't access usb devices. Also does the steam frame have udev?
fun updateUdev() {
}
companion object {
@@ -43,5 +67,8 @@ class Linux {
private const val LINUXFEEDERURL = "https://github.com/SlimeVR/SlimeVR-Feeder-App/releases/latest/download/SlimeVR-Feeder-App-linux64.zip"
private const val LINUXFEEDERNAME = "SlimeVR-Feeder-App-linux64.zip"
private const val LINUXFEEDERDIRECTORY = "SlimeVR-Feeder-App-linux64"
private const val LINUXSERVERURL = "https://github.com/SlimeVR/SlimeVR-Server/releases/latest/download/SlimeVR-amd64.appimage"
private const val LINUXSERVERNAME = "SlimeVR-amd64.appimage"
private const val LINUXSERVERDIRECTORY = "slimevr-win64"
}
}
@@ -8,8 +8,7 @@ class Updater {
@Serializable
data class GHResponse(val tag_name: String)
//val os = System.getProperty("os.name").lowercase()
val os = "windows"
val os = System.getProperty("os.name").lowercase()
suspend fun runUpdater() {