Skip to content

Commit

Permalink
fix when phase reboot is used via old jar
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkyAI committed Aug 1, 2021
1 parent 8767277 commit 636177e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ class InstallMultiMCCommand: CliktCommand(
}

enum class Phase {
PRE, POST
PRE, POST, REBOOT
}
10 changes: 7 additions & 3 deletions multimc/installer/src/main/kotlin/voodoo/multimc/Installer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ object Installer {
currentJarFile.copyTo(voodooFolder.resolve("multimc-installer.jar"), overwrite = true)
exitProcess(0)
}
Phase.PRE -> {
Phase.PRE, Phase.REBOOT -> {
// always copy current jar to post.jar
val postFile = voodooFolder.resolve("post.jar")
if(postFile.exists()) {
Expand Down Expand Up @@ -106,7 +106,8 @@ object Installer {
} else {
postFile.download(installerUrl, cacheHome)
}
val newFile = cacheHome.resolve("tmp.jar")
val newFile = cacheHome.resolve("tmp-${newSha256}.jar")
newFile.delete()
postFile.copyTo(newFile, overwrite = true)
return newFile
}
Expand Down Expand Up @@ -228,7 +229,10 @@ object Installer {
"--mc",
minecraftDir.path,
"--phase",
phase.toString()
when(phase) {
Phase.REBOOT -> Phase.PRE
else -> phase
}.toString()
)

logger.info { "Executing ${args.joinToString()}" }
Expand Down

0 comments on commit 636177e

Please sign in to comment.