Compare commits
No commits in common. "master" and "0.0.2" have entirely different histories.
45
README.md
45
README.md
|
@ -2,7 +2,7 @@
|
|||
|
||||
### What is Mapm?
|
||||
|
||||
Mapm is a package manager (written in Kotlin) for, you know, managing packages. So far it's VERY early in development. Mapm is designed to run on the JVM, while using Linux system (as the packages are only compiled for Linux at present).
|
||||
Mapm is a package manager (written in Kotlin) for, you know, managing packages. So far it's VERY early in development. Mapm is designed to run on the JVM, while using a UNIX-like system.
|
||||
|
||||
### Why?
|
||||
|
||||
|
@ -10,54 +10,23 @@ 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`.
|
||||
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
|
||||
|
||||
Mapm has a few options for the command line. So far these are:
|
||||
|
||||
* g: Grab a package from the internet.
|
||||
* r: Remove a package from your system. (work in progress)
|
||||
* c: Make a checksum that Mapm can reproduce and recognise.
|
||||
* m: Automatically make a Mapm package (work in progress)
|
||||
* h: Get help.
|
||||
|
||||
Some example commands:
|
||||
|
||||
* `mapm g mash`: Grab the package `mash` and install it.
|
||||
* `mapm r mash`: Remove the package `mash` from your computer.
|
||||
* `mapm c mash-0.0.2.tar.xz`: Generate a checksum for the file `mash-0.0.2.tar.xz`
|
||||
Run mapm. For now, command line arguments aren't supported, but this is planned for a later date. Once you're in mapm, you can type `grab` and press enter. Type the thing you want and it will download.
|
||||
|
||||
### Making a mapm package
|
||||
|
||||
To make a mapm package, go to https://git.maxwellj.xyz/mapm/stable and submit a pull request. Add your package's name as the file name, and the link to where your package is stored as the contents. Don't add anything more or you'll confuse mapm. Make sure the link points to a .tar.xz archive. The file structure should be like this:
|
||||
```
|
||||
├── (packagename) (Your executable)
|
||||
├── (packagename) (A symbolic link to your executable in packagename.d)
|
||||
└── (packagename).d
|
||||
├── 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 c (file name` to get the checksum. 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, hash and all dependencies required to run your program.
|
||||
|
||||
**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 their config files inside one directory, with an executable in /usr/mapm.
|
||||
|
||||
**Is Mapm any good?**
|
||||
|
||||
Mapm is in constant development, and things may break. Automatic update detection is not avaliable yet, meaning it is harder to patch security holes for now.
|
||||
For now, this isn't a thing, but you'll be able to when configuration is a thing.
|
|
@ -10,7 +10,7 @@ application {
|
|||
}
|
||||
|
||||
group = "xyz.maxwellj.mapm"
|
||||
version = "0.0.3"
|
||||
version = "0.0.2"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.nio.file.Files
|
|||
import java.nio.file.Paths
|
||||
import kotlin.collections.listOf as listOf
|
||||
|
||||
|
||||
fun uncompressXZFile(inputFile: String, outputFile: String) {
|
||||
XZInputStream(FileInputStream(inputFile)).use { input ->
|
||||
FileOutputStream(outputFile).use { output ->
|
||||
|
@ -52,90 +53,45 @@ fun md5(input:String): String {
|
|||
return BigInteger(1, md.digest(input.toByteArray())).toString(16).padStart(32, '0')
|
||||
}
|
||||
|
||||
suspend fun grabDependencies(input:String): String {
|
||||
val dependencyList = Fuel.get("https://git.maxwellj.xyz/mapm/stable/raw/branch/main/$input/dependencies").body.string()
|
||||
return(dependencyList)
|
||||
}
|
||||
|
||||
suspend fun grabPackage(input:String): Int {
|
||||
println("Downloading package $input...")
|
||||
val linkToUse = "https://git.maxwellj.xyz/mapm/stable/raw/branch/main/$input/source"
|
||||
val packageLocation = Fuel.get(linkToUse).body.string()
|
||||
val file = File("/usr/mapm/tmp/$input.tar.xz")
|
||||
val fileBytes = Fuel.get(packageLocation).body.bytes()
|
||||
file.writeBytes(fileBytes)
|
||||
val fileChecksum = Fuel.get("https://git.maxwellj.xyz/mapm/stable/raw/branch/main/$input/hash").body.string()
|
||||
if (fileChecksum == md5(file.readText())) {
|
||||
println("Checksum matches!")
|
||||
uncompressXZFile(inputFile = "/usr/mapm/tmp/${input}.tar.xz", outputFile = "/usr/mapm/tmp/${input}.tar")
|
||||
unarchiveTarFile(tarFilePath = "/usr/mapm/tmp/${input}.tar", outputDirectoryPath = "/usr/mapm/")
|
||||
Runtime.getRuntime().exec("chmod +x /usr/mapm/${input}")
|
||||
println("Finished!")
|
||||
return(0)
|
||||
} else {
|
||||
println("Checksum doesn't match! Aborting...")
|
||||
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.")
|
||||
return(1)
|
||||
}
|
||||
}
|
||||
|
||||
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]
|
||||
println(userInput)
|
||||
if (userInput == "g") {
|
||||
val userInput: String = args[1]
|
||||
val linkToUse = "https://git.maxwellj.xyz/mapm/stable/raw/branch/main/$userInput/source"
|
||||
val packageLocation = Fuel.get(linkToUse).body.string()
|
||||
val dependencies = grabDependencies(userInput)
|
||||
println("Downloading packages $userInput $dependencies")
|
||||
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)
|
||||
println("Confirmation not given. Exiting...")
|
||||
exitProcess(0)
|
||||
}
|
||||
var currentPackage = ""
|
||||
for (char in dependencies) {
|
||||
if (char.toString() != " ") {
|
||||
currentPackage += char.toString()
|
||||
} else {
|
||||
grabPackage(currentPackage)
|
||||
var currentPackage = ""
|
||||
}
|
||||
}
|
||||
grabPackage(userInput)
|
||||
val file = File("/usr/mapm/tmp/$userInput.tar.xz")
|
||||
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()
|
||||
if (fileChecksum == md5(file.readText())) {
|
||||
println("Checksum matches!")
|
||||
uncompressXZFile(inputFile = "/usr/mapm/tmp/${userInput}.tar.xz", outputFile = "/usr/mapm/tmp/${userInput}.tar")
|
||||
unarchiveTarFile(tarFilePath = "/usr/mapm/tmp/${userInput}.tar", outputDirectoryPath = "/usr/mapm/")
|
||||
Runtime.getRuntime().exec("chmod +x /usr/mapm/${userInput}")
|
||||
println("Finished!")
|
||||
exitProcess(0)
|
||||
} else {
|
||||
println("Checksum doesn't match! Aborting...")
|
||||
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()
|
||||
executable.delete()
|
||||
}
|
||||
} else if (userInput == "c") {
|
||||
val userInput = args[1]
|
||||
|
@ -143,10 +99,9 @@ suspend fun main(args: Array<String>) {
|
|||
println("Checksum of that file is ${md5(file.readText())}")
|
||||
} else if (userInput == "m") {
|
||||
println("this feature is in progress")
|
||||
println("")
|
||||
} else if (userInput == "h") {
|
||||
} else {
|
||||
println("mapm - Max's Package Manager")
|
||||
println("Version 0.0.3")
|
||||
println("Version 0.0.2")
|
||||
println("(C) Maxwell Jeffress 2024, licensed under the GNU GPL V3")
|
||||
println("")
|
||||
println("---Help---")
|
||||
|
@ -159,4 +114,4 @@ suspend fun main(args: Array<String>) {
|
|||
println("https://maxwellj.xyz/mapm")
|
||||
println("https://git.maxwellj.xyz/max/mapm")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user