kt-go-split #1
2
.idea/gradle.xml
generated
2
.idea/gradle.xml
generated
@ -8,6 +8,8 @@
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/definition" />
|
||||
<option value="$PROJECT_DIR$/host" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
|
||||
2
.idea/kotlinc.xml
generated
2
.idea/kotlinc.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinJpsPluginSettings">
|
||||
<option name="version" value="2.2.10" />
|
||||
<option name="version" value="2.2.20" />
|
||||
</component>
|
||||
</project>
|
||||
@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
kotlin("jvm") version "2.2.10"
|
||||
kotlin("plugin.serialization") version "2.2.20"
|
||||
}
|
||||
|
||||
group = "moe.rosa"
|
||||
@ -11,6 +12,7 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
testImplementation(kotlin("test"))
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0")
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
|
||||
}
|
||||
rootProject.name = "planterette"
|
||||
rootProject.name = "planterette"
|
||||
include("definition")
|
||||
include("host")
|
||||
@ -1,5 +1,2 @@
|
||||
package moe.rosa.planterette
|
||||
|
||||
fun main() {
|
||||
|
||||
}
|
||||
62
src/main/kotlin/moe/rosa/planterette/hakurei/Filesystem.kt
Normal file
62
src/main/kotlin/moe/rosa/planterette/hakurei/Filesystem.kt
Normal file
@ -0,0 +1,62 @@
|
||||
package moe.rosa.planterette.hakurei
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class AbsolutePath(private val path: String) {
|
||||
override fun toString(): String {
|
||||
return path
|
||||
}
|
||||
}
|
||||
|
||||
interface FSType {
|
||||
val type: String
|
||||
}
|
||||
data class ApplyState(val autoEtcPrefix: String)
|
||||
|
||||
@Serializable
|
||||
data class FSBind(
|
||||
val target: AbsolutePath,
|
||||
val source: AbsolutePath,
|
||||
val write: Boolean,
|
||||
val device: Boolean,
|
||||
val ensure: Boolean,
|
||||
val optional: Boolean,
|
||||
val special: Boolean,
|
||||
|
||||
override val type: String = "bind",
|
||||
) : FSType
|
||||
|
||||
@Serializable
|
||||
data class FSEphemeral(
|
||||
val target: AbsolutePath,
|
||||
val write: Boolean,
|
||||
val size: Int,
|
||||
val perm: Int,
|
||||
|
||||
override val type: String = "ephemeral"
|
||||
) : FSType
|
||||
|
||||
@Serializable
|
||||
data class FSLink(
|
||||
val target: AbsolutePath,
|
||||
val linkname: String,
|
||||
val dereference: Boolean,
|
||||
|
||||
override val type: String = "link"
|
||||
) : FSType
|
||||
|
||||
@Serializable
|
||||
data class FSOverlay(
|
||||
val target: AbsolutePath,
|
||||
val lower: List<AbsolutePath>,
|
||||
val upper: AbsolutePath,
|
||||
val work: AbsolutePath,
|
||||
|
||||
override val type: String = "overlay"
|
||||
) : FSType
|
||||
|
||||
@Serializable
|
||||
data class FilesystemConfig(
|
||||
val config: FSType
|
||||
)
|
||||
93
src/main/kotlin/moe/rosa/planterette/hakurei/Hakurei.kt
Normal file
93
src/main/kotlin/moe/rosa/planterette/hakurei/Hakurei.kt
Normal file
@ -0,0 +1,93 @@
|
||||
package moe.rosa.planterette.hakurei
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class HakureiConfig(
|
||||
val id: String,
|
||||
val path: AbsolutePath,
|
||||
val args: List<String>,
|
||||
val enablements: Enablements,
|
||||
val sessionBus: DBusConfig,
|
||||
val systemBus: DBusConfig,
|
||||
val directWayland: Boolean,
|
||||
val username: String,
|
||||
val shell: AbsolutePath,
|
||||
val home: AbsolutePath,
|
||||
|
||||
val extraPerms: ExtraPermsConfig,
|
||||
val identity: Int,
|
||||
val groups: List<String>,
|
||||
|
||||
val container: ContainerConfig,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class DBusConfig(
|
||||
val see: List<String>,
|
||||
val talk: List<String>,
|
||||
val own: List<String>,
|
||||
val call: Map<String, String>,
|
||||
val broadcast: Map<String, String>,
|
||||
val log: Boolean,
|
||||
val filter: Boolean,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class Enablements(
|
||||
val wayland: Boolean,
|
||||
val x11: Boolean,
|
||||
val dbus: Boolean,
|
||||
val pulse: Boolean,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class ContainerConfig(
|
||||
val hostname: String,
|
||||
val waitDelay: Long,
|
||||
val seccompFlags: Int,
|
||||
val seccompPresets: Int,
|
||||
val seccompCompat: Boolean,
|
||||
val devel: Boolean,
|
||||
val userns: Boolean,
|
||||
val hostNet: Boolean,
|
||||
val hostAbstract: Boolean,
|
||||
val tty: Boolean,
|
||||
val multiarch: Boolean,
|
||||
|
||||
val env: Map<String, String>,
|
||||
|
||||
val mapRealUid: Boolean,
|
||||
val device: Boolean,
|
||||
|
||||
val filesystem: List<FilesystemConfig>,
|
||||
)
|
||||
@Serializable
|
||||
data class ExtraPermsConfig(
|
||||
val ensure: Boolean,
|
||||
val path: AbsolutePath,
|
||||
val read: Boolean,
|
||||
val write: Boolean,
|
||||
val execute: Boolean,
|
||||
) {
|
||||
override fun toString(): String {
|
||||
val buffer = StringBuffer(5 + path.toString().length)
|
||||
buffer.append("---")
|
||||
if(ensure) {
|
||||
buffer.append("+")
|
||||
}
|
||||
buffer.append(":")
|
||||
buffer.append(path.toString())
|
||||
if(read) {
|
||||
buffer.setCharAt(0, 'r')
|
||||
}
|
||||
if(write) {
|
||||
buffer.setCharAt(1, 'w')
|
||||
}
|
||||
if(execute) {
|
||||
buffer.setCharAt(2, 'x')
|
||||
}
|
||||
return buffer.toString()
|
||||
}
|
||||
}
|
||||
|
||||
0
src/test/resources/ChromiumExample.kts
Normal file
0
src/test/resources/ChromiumExample.kts
Normal file
Loading…
x
Reference in New Issue
Block a user