Compare commits

..

No commits in common. "master" and "0.0.1" have entirely different histories.

4 changed files with 21 additions and 95 deletions

2
.gitignore vendored
View File

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

View File

@ -10,14 +10,6 @@ No reason. :)
### Setup ### Setup
**Make sure Java 17 or later is installed! Mapm is built targeting 17 or later, so it will not run on older versions!**
#### Express
Run the command `curl https://maxwellj.xyz/mapm/mapm.sh | bash`. This will run an express setup script.
#### Manual
Make directories /usr/mapm and /usr/mapm/tmp. Add /usr/mapm to path. Download the files and make sure Gradle is installed. Run `gradle distTar` to compile a Tar file with all the needed Jars in it, including mapm. Untar the archive in build/distributions. Run `./(where tar extracted to)/bin/mapm`. (or mapm.bat if you're crazy) Make directories /usr/mapm and /usr/mapm/tmp. Add /usr/mapm to path. Download the files and make sure Gradle is installed. Run `gradle distTar` to compile a Tar file with all the needed Jars in it, including mapm. Untar the archive in build/distributions. Run `./(where tar extracted to)/bin/mapm`. (or mapm.bat if you're crazy)
### Usage ### Usage
@ -33,20 +25,8 @@ To make a mapm package, go to https://git.maxwellj.xyz/mapm/stable and submit a
├── executable ├── executable
└── Any other files your package needs └── Any other files your package needs
``` ```
Zip all that up into a .tar.xz file and upload it to your own server. After creating the .tar.xz, use Mapm to create a checksum for the file. Run mapm, type `checksum`, press enter and type the file path. For now, there is no polished system for package processing, so for now send an email to max AT maxwellj.xyz with the package link and hash. Zip all that up into a .tar.xz file, upload it to your server and add the link to your pull request. After creating the .tar.xz, use Mapm to create a checksum for the file. Run mapm, type `checksum`, press enter and type the file path. Press enter and copy the checksum to `(packagename).hash` inside your pull request.
**Note**: If your package requires an update, make sure to email an updated link and hash, otherwise Mapm will reject your package when it is being installed.
### Making your own repo ### Making your own repo
For now, this isn't a thing, but you'll be able to when configuration is a thing. For now, this isn't a thing, but you'll be able to when configuration is a thing.
### FAQ's
**What is mapm?**
Mapm is a package manager, intended for UNIX-based/like OSes, running on the JVM. Mapm packages are organised neatly in /usr/mapm. When built around Mapm, packages have both their executables and config files inside one directory, with one symbolic link or launch script in /usr/mapm.
**Is Mapm any good?**
For now, Mapm doesn't have support for dependencies, meaning if your program requires another library, Mapm won't be able to provide those yet. Mapm also hasn't got very many packages right now, as it is still very experimental.

View File

@ -10,7 +10,7 @@ application {
} }
group = "xyz.maxwellj.mapm" group = "xyz.maxwellj.mapm"
version = "0.0.3" version = "0.0.1"
repositories { repositories {
mavenCentral() mavenCentral()

View File

@ -13,7 +13,6 @@ import java.io.BufferedInputStream
import java.io.FileInputStream import java.io.FileInputStream
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Paths import java.nio.file.Paths
import kotlin.collections.listOf as listOf
fun uncompressXZFile(inputFile: String, outputFile: String) { fun uncompressXZFile(inputFile: String, outputFile: String) {
@ -53,51 +52,21 @@ fun md5(input:String): String {
return BigInteger(1, md.digest(input.toByteArray())).toString(16).padStart(32, '0') return BigInteger(1, md.digest(input.toByteArray())).toString(16).padStart(32, '0')
} }
suspend fun main(args: Array<String>) { suspend fun main() {
if (args.size < 2) { println("Welcome to Mapm! What would you like to do? Type help for some help.")
if (args.size == 1) {
if (args[0] == "h") { val userInput = readln()
println("mapm - Max's Package Manager") if (userInput == "grab") {
println("Version 0.0.3") println("What would you like to grab?")
println("(C) Maxwell Jeffress 2024, licensed under the GNU GPL V3") val userInput = readln()
println("") val linkToUse = "https://git.maxwellj.xyz/mapm/stable/raw/branch/main/$userInput"
println("---Help---")
println("Arguments that can be run")
println("g Grab a package from the internet")
println("r Remove a package")
println("c Generate a checksum for a package")
println("")
println("More info at the following links:")
println("https://maxwellj.xyz/mapm")
println("https://git.maxwellj.xyz/max/mapm")
exitProcess(0)
} else {
println("USAGE: mapm [g, r, c, m] [package name] Type 'h' for help")
exitProcess(1)
}
} else {
println("USAGE: mapm [g, r, c, m] [package name] Type 'h' for help")
exitProcess(1)
}
}
var userInput: String = args[0]
if (userInput == "g") {
val userInput: String = args[1]
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(dingus)
// val packageList = listOf($userInput) val file = File("/usr/mapm/tmp/$userInput.tar.xz")
println("Downloading package $userInput") // file.writeBytes((Fuel.get(dingus).body.string()).toByteArray())
println("Is this okay?")
val userInputInteractive: String = readln()
if (userInputInteractive != "y") {
println("Confirmation not given. Exiting...")
exitProcess(0)
}
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")
@ -110,34 +79,13 @@ suspend fun main(args: Array<String>) {
println("Please tell Max or your app's developer to use mapm to generate a new checksum. If the checksum is right, check your internet connection security.") println("Please tell Max or your app's developer to use mapm to generate a new checksum. If the checksum is right, check your internet connection security.")
exitProcess(1) exitProcess(1)
} }
} else if (userInput == "r") { } else if (userInput == "delete") {
val executable = File("/usr/mapm/${args[1]}") println("What would you like to delete?")
println("Deleting package ${args[1]}") val userInput = readln()
println("Is this okay? (y/n)") } else if (userInput == "checksum") {
var userInput = readln() println("What file would you like to generate a checksum of? Type the whole path")
if (userInput != "y") { val userInput = readln()
executable.delete()
}
} else if (userInput == "c") {
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")
println("")
} else if (userInput == "h") {
println("mapm - Max's Package Manager")
println("Version 0.0.3")
println("(C) Maxwell Jeffress 2024, licensed under the GNU GPL V3")
println("")
println("---Help---")
println("Arguments that can be run")
println("g Grab a package from the internet")
println("r Remove a package")
println("c Generate a checksum for a package")
println("")
println("More info at the following links:")
println("https://maxwellj.xyz/mapm")
println("https://git.maxwellj.xyz/max/mapm")
} }
} }