I can't remember what I worked on just have a look

This commit is contained in:
Maxwell Jeffress 2024-09-19 13:17:06 +10:00
parent 75b49147df
commit 2a8f65c953
2 changed files with 6 additions and 2 deletions

2
.gitignore vendored
View File

@ -9,6 +9,8 @@ gradlew
gradlew.bat gradlew.bat
.kotlin .kotlin
test
### IntelliJ IDEA ### ### IntelliJ IDEA ###
.idea .idea
.idea/modules.xml .idea/modules.xml

View File

@ -58,7 +58,7 @@ suspend fun main(args: Array<String>) {
println(userInput) println(userInput)
if (userInput == "g") { if (userInput == "g") {
val userInput: String = args[1] val userInput: String = args[1]
val linkToUse = "https://git.maxwellj.xyz/mapm/stable/raw/branch/main/$userInput" val linkToUse = "https://git.maxwellj.xyz/mapm/stable/raw/branch/main/$userInput/source"
val dingus = Fuel.get(linkToUse).body.string() val dingus = Fuel.get(linkToUse).body.string()
println("Package $userInput found at $dingus") println("Package $userInput found at $dingus")
// val packageList = listOf($userInput) // val packageList = listOf($userInput)
@ -72,7 +72,7 @@ suspend fun main(args: Array<String>) {
val file = File("/usr/mapm/tmp/$userInput.tar.xz") val file = File("/usr/mapm/tmp/$userInput.tar.xz")
val fileBytes = Fuel.get(dingus).body.bytes() val fileBytes = Fuel.get(dingus).body.bytes()
file.writeBytes(fileBytes) file.writeBytes(fileBytes)
val fileChecksum = Fuel.get("https://git.maxwellj.xyz/mapm/stable/raw/branch/main/$userInput.hash").body.string() val fileChecksum = Fuel.get("https://git.maxwellj.xyz/mapm/stable/raw/branch/main/$userInput/hash").body.string()
if (fileChecksum == md5(file.readText())) { if (fileChecksum == md5(file.readText())) {
println("Checksum matches!") println("Checksum matches!")
uncompressXZFile(inputFile = "/usr/mapm/tmp/${userInput}.tar.xz", outputFile = "/usr/mapm/tmp/${userInput}.tar") uncompressXZFile(inputFile = "/usr/mapm/tmp/${userInput}.tar.xz", outputFile = "/usr/mapm/tmp/${userInput}.tar")
@ -97,6 +97,8 @@ suspend fun main(args: Array<String>) {
val userInput = args[1] val userInput = args[1]
val file = File(userInput) val file = File(userInput)
println("Checksum of that file is ${md5(file.readText())}") println("Checksum of that file is ${md5(file.readText())}")
} else if (userInput == "m") {
println("this feature is in progress")
} else { } else {
println("mapm - Max's Package Manager") println("mapm - Max's Package Manager")
println("Version 0.0.2") println("Version 0.0.2")