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
.kotlin
test
### IntelliJ IDEA ###
.idea
.idea/modules.xml

View File

@ -10,14 +10,6 @@ No reason. :)
### 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)
### Usage
@ -33,20 +25,8 @@ To make a mapm package, go to https://git.maxwellj.xyz/mapm/stable and submit a
├── executable
└── 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.
**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.
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.
### Making your own repo
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.
For now, this isn't a thing, but you'll be able to when configuration is a thing.

View File

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

View File

@ -13,7 +13,6 @@ import java.io.BufferedInputStream
import java.io.FileInputStream
import java.nio.file.Files
import java.nio.file.Paths
import kotlin.collections.listOf as listOf
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')
}
suspend fun main(args: Array<String>) {
if (args.size < 2) {
if (args.size == 1) {
if (args[0] == "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")
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"
suspend fun main() {
println("Welcome to Mapm! What would you like to do? Type help for some help.")
val userInput = readln()
if (userInput == "grab") {
println("What would you like to grab?")
val userInput = readln()
val linkToUse = "https://git.maxwellj.xyz/mapm/stable/raw/branch/main/$userInput"
val dingus = Fuel.get(linkToUse).body.string()
println("Package $userInput found at $dingus")
// val packageList = listOf($userInput)
println("Downloading package $userInput")
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")
println(dingus)
val file = File("/usr/mapm/tmp/$userInput.tar.xz")
// file.writeBytes((Fuel.get(dingus).body.string()).toByteArray())
val fileBytes = Fuel.get(dingus).body.bytes()
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())) {
println("Checksum matches!")
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.")
exitProcess(1)
}
} else if (userInput == "r") {
val executable = File("/usr/mapm/${args[1]}")
println("Deleting package ${args[1]}")
println("Is this okay? (y/n)")
var userInput = readln()
if (userInput != "y") {
executable.delete()
}
} else if (userInput == "c") {
val userInput = args[1]
} else if (userInput == "delete") {
println("What would you like to delete?")
val userInput = readln()
} else if (userInput == "checksum") {
println("What file would you like to generate a checksum of? Type the whole path")
val userInput = readln()
val file = File(userInput)
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")
}
}