diff --git a/bbootimg/src/main/kotlin/bootimg/Common.kt b/bbootimg/src/main/kotlin/bootimg/Common.kt index bbeb3ec1..5817349b 100644 --- a/bbootimg/src/main/kotlin/bootimg/Common.kt +++ b/bbootimg/src/main/kotlin/bootimg/Common.kt @@ -17,7 +17,7 @@ package cfig.bootimg import cc.cfig.io.Struct import cfig.utils.EnvironmentVerifier import cfig.bootimg.cpio.AndroidCpio -import cfig.utils.DTC +import rom.fdt.DTC import cfig.helper.Helper import cfig.helper.ZipHelper import cfig.utils.KernelExtractor @@ -179,10 +179,10 @@ class Common { return ret } - fun dumpDtb(s: Helper.Slice) { + fun dumpDtb(s: Helper.Slice, decompile: Boolean = true) { Helper.extractFile(s.srcFile, s.dumpFile, s.offset.toLong(), s.length) //extract DTB - if (EnvironmentVerifier().hasDtc) { + if (EnvironmentVerifier().hasDtc && decompile) { DTC().decompile(s.dumpFile, s.dumpFile + "." + Helper.prop("config.dts_suffix")) } } diff --git a/bbootimg/src/main/kotlin/bootimg/v2/BootV2.kt b/bbootimg/src/main/kotlin/bootimg/v2/BootV2.kt index 1be764bc..79f6029c 100644 --- a/bbootimg/src/main/kotlin/bootimg/v2/BootV2.kt +++ b/bbootimg/src/main/kotlin/bootimg/v2/BootV2.kt @@ -24,7 +24,7 @@ import cfig.helper.Dumpling import cfig.helper.Helper import cfig.helper.ZipHelper import cfig.packable.VBMetaParser -import cfig.utils.DTC +import rom.fdt.DTC import cfig.utils.EnvironmentVerifier import com.fasterxml.jackson.databind.ObjectMapper import com.github.freva.asciitable.HorizontalAlign @@ -250,7 +250,7 @@ data class BootV2( } //dtb this.dtb?.let { _ -> - Common.dumpDtb(Helper.Slice(info.output, dtb!!.position.toInt(), dtb!!.size, dtb!!.file!!)) + Common.dumpDtb(Helper.Slice(info.output, dtb!!.position.toInt(), dtb!!.size, dtb!!.file!!), false) this.dtb!!.dtbList = DTC.parseMultiple(dtb!!.file!!) log.info("dtb sz = " + this.dtb!!.dtbList.size) //dump info again @@ -359,7 +359,7 @@ data class BootV2( it.addRule() it.addRow("dtb", theDtb.file) prints.add(Pair("dtb", theDtb.file.toString())) - if (File(theDtb.file + ".${dtsSuffix}").exists()) { + if (File(theDtb.file + ".0.${dtsSuffix}").exists()) { it.addRow("\\-- decompiled dts [$dtbCount]", theDtb.file + ".*.${dtsSuffix}") prints.add(Pair("\\-- decompiled dts [$dtbCount]", theDtb.file + ".*.${dtsSuffix}")) } @@ -456,7 +456,7 @@ data class BootV2( } //refresh dtb size dtb?.let { theDtb -> - if (File(theDtb.file!! + ".${dtsSuffix}").exists()) { + if (File(theDtb.file!! + ".0.${dtsSuffix}").exists()) { DTC.packMultiple(theDtb.file!!, theDtb.dtbList) } theDtb.size = File(theDtb.file!!).length().toInt() diff --git a/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt b/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt index e69704e3..c655eee0 100644 --- a/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt +++ b/bbootimg/src/main/kotlin/bootimg/v3/VendorBoot.kt @@ -24,7 +24,7 @@ import cfig.helper.Dumpling import cfig.helper.Helper import cfig.helper.ZipHelper import cfig.packable.VBMetaParser -import cfig.utils.DTC +import rom.fdt.DTC import cfig.utils.EnvironmentVerifier import com.fasterxml.jackson.databind.ObjectMapper import de.vandermeer.asciitable.AsciiTable @@ -258,7 +258,7 @@ data class VendorBoot( } } //update dtb - if (File(this.dtb.file + ".${dtsSuffix}").exists()) { + if (File(this.dtb.file + ".0.${dtsSuffix}").exists()) { DTC.packMultiple(this.dtb.file, this.dtb.dtbList) } this.dtb.size = File(this.dtb.file).length().toInt() @@ -368,7 +368,7 @@ data class VendorBoot( } //dtb run { - C.dumpDtb(Helper.Slice(info.output, dtb.position.toInt(), dtb.size, dtb.file)) + C.dumpDtb(Helper.Slice(info.output, dtb.position.toInt(), dtb.size, dtb.file), false) if (dtb.size > 0) { dtb.dtbList = DTC.parseMultiple(dtb.file) DTC.extractMultiple(dtb.file, dtb.dtbList) @@ -438,7 +438,7 @@ data class VendorBoot( if (this.dtb.size > 0) { it.addRow("dtb", this.dtb.file) prints.add(Pair("dtb", this.dtb.file)) - if (File(this.dtb.file + ".${dtsSuffix}").exists()) { + if (File(this.dtb.file + ".0.${dtsSuffix}").exists()) { it.addRow("\\-- decompiled dts [${dtb.dtbList.size}]", dtb.file + "*.${dtsSuffix}") prints.add(Pair("\\-- decompiled dts [${dtb.dtbList.size}]", dtb.file + "*.${dtsSuffix}")) } diff --git a/bbootimg/src/main/kotlin/packable/BootImgParser.kt b/bbootimg/src/main/kotlin/packable/BootImgParser.kt index 1733b42d..af71f503 100644 --- a/bbootimg/src/main/kotlin/packable/BootImgParser.kt +++ b/bbootimg/src/main/kotlin/packable/BootImgParser.kt @@ -20,12 +20,13 @@ import cfig.bootimg.v2.BootV2 import cfig.bootimg.v2.BootV2Dialects import cfig.bootimg.v3.BootV3 import cfig.helper.Helper -import cfig.helper.Helper.Companion.deleteIfExists import com.fasterxml.jackson.databind.ObjectMapper import de.vandermeer.asciitable.AsciiTable import org.slf4j.LoggerFactory import java.io.File import java.io.FileInputStream +import kotlin.io.path.Path +import kotlin.io.path.deleteIfExists class BootImgParser : IPackable { override val loopNo: Int @@ -142,7 +143,7 @@ class BootImgParser : IPackable { fun clear(fileName: String) { super.clear() listOf("", ".clear", ".google", ".clear", ".signed", ".signed2").forEach { - "$fileName$it".deleteIfExists() + Path("$fileName$it").deleteIfExists() } VBMetaParser().clear("vbmeta.img") } diff --git a/bbootimg/src/main/kotlin/packable/DeviceTreeParser.kt b/bbootimg/src/main/kotlin/packable/DeviceTreeParser.kt index cccc9fd6..6bcc8343 100644 --- a/bbootimg/src/main/kotlin/packable/DeviceTreeParser.kt +++ b/bbootimg/src/main/kotlin/packable/DeviceTreeParser.kt @@ -4,11 +4,12 @@ import cfig.bootimg.Common import cfig.helper.Helper import cfig.helper.Helper.Companion.check_call import cfig.helper.Helper.Companion.check_output -import cfig.helper.Helper.Companion.deleteIfExists import cfig.packable.IPackable -import cfig.utils.DTC import org.slf4j.LoggerFactory +import rom.fdt.DTC import java.io.File +import kotlin.io.path.Path +import kotlin.io.path.deleteIfExists class DeviceTreeParser : IPackable { override fun capabilities(): List { @@ -74,7 +75,7 @@ class DeviceTreeParser : IPackable { fun clear(fileName: String) { super.clear() listOf("", ".new").forEach { - "$fileName$it".deleteIfExists() + Path("$fileName$it").deleteIfExists() } } diff --git a/bbootimg/src/main/kotlin/packable/DtboParser.kt b/bbootimg/src/main/kotlin/packable/DtboParser.kt index f1e3c39c..1613c3b8 100644 --- a/bbootimg/src/main/kotlin/packable/DtboParser.kt +++ b/bbootimg/src/main/kotlin/packable/DtboParser.kt @@ -15,17 +15,18 @@ package cfig.packable import cfig.helper.Helper -import cfig.helper.Helper.Companion.deleteIfExists -import cfig.utils.DTC import cfig.utils.EnvironmentVerifier import com.fasterxml.jackson.databind.ObjectMapper import org.apache.commons.exec.CommandLine import org.apache.commons.exec.DefaultExecutor import org.slf4j.LoggerFactory -import utils.Dtbo +import rom.fdt.DTC +import rom.fdt.Dtbo import java.io.File import java.io.FileInputStream import java.util.* +import kotlin.io.path.Path +import kotlin.io.path.deleteIfExists class DtboParser(val workDir: File) : IPackable { override val loopNo: Int @@ -78,7 +79,7 @@ class DtboParser(val workDir: File) : IPackable { fun clear(fileName: String) { super.clear() listOf("", ".clear", ".google", ".clear", ".signed", ".signed2").forEach { - "$fileName$it".deleteIfExists() + Path("$fileName$it").deleteIfExists() } VBMetaParser().clear("vbmeta.img") } diff --git a/bbootimg/src/main/kotlin/packable/IPackable.kt b/bbootimg/src/main/kotlin/packable/IPackable.kt index 82dd2405..3b2ee1b6 100644 --- a/bbootimg/src/main/kotlin/packable/IPackable.kt +++ b/bbootimg/src/main/kotlin/packable/IPackable.kt @@ -16,14 +16,15 @@ package cfig.packable import avb.AVBInfo import cfig.Avb -import cfig.helper.Helper import cfig.helper.Dumpling +import cfig.helper.Helper import cfig.helper.Helper.Companion.check_call import cfig.helper.Helper.Companion.check_output -import cfig.helper.Helper.Companion.deleteIfExists import org.slf4j.Logger import org.slf4j.LoggerFactory import java.io.File +import kotlin.io.path.Path +import kotlin.io.path.deleteIfExists interface IPackable { val loopNo: Int @@ -79,7 +80,9 @@ interface IPackable { File(workDir).deleteRecursively() } File(workDir).mkdirs() - "uiderrors".deleteIfExists() + // java.nio.file.Files.deleteIfExists() will throw exception on Windows platform, so use java.io.File + // Caused by: java.nio.file.FileSystemException: uiderrors: The process cannot access the file because it is being used by another process + File("uiderrors").deleteOnExit() } companion object { diff --git a/bbootimg/src/main/kotlin/packable/MiscImgParser.kt b/bbootimg/src/main/kotlin/packable/MiscImgParser.kt index a8438680..bc0e50fd 100644 --- a/bbootimg/src/main/kotlin/packable/MiscImgParser.kt +++ b/bbootimg/src/main/kotlin/packable/MiscImgParser.kt @@ -15,12 +15,13 @@ package cfig.packable import cfig.helper.Helper -import rom.misc.MiscImage -import cfig.helper.Helper.Companion.deleteIfExists import com.fasterxml.jackson.databind.ObjectMapper import org.slf4j.LoggerFactory +import rom.misc.MiscImage import java.io.File import java.io.RandomAccessFile +import kotlin.io.path.Path +import kotlin.io.path.deleteIfExists class MiscImgParser : IPackable { override val loopNo: Int @@ -78,7 +79,7 @@ class MiscImgParser : IPackable { fun clear(fileName: String) { super.clear() listOf("", ".new").forEach { - "$fileName$it".deleteIfExists() + Path("$fileName$it").deleteIfExists() } } diff --git a/bbootimg/src/main/kotlin/packable/PayloadBinParser.kt b/bbootimg/src/main/kotlin/packable/PayloadBinParser.kt index 9fad30ae..a6fbd130 100644 --- a/bbootimg/src/main/kotlin/packable/PayloadBinParser.kt +++ b/bbootimg/src/main/kotlin/packable/PayloadBinParser.kt @@ -15,8 +15,9 @@ package cfig.packable import cc.cfig.droid.ota.Payload -import cfig.helper.Helper.Companion.deleteIfExists import org.slf4j.LoggerFactory +import kotlin.io.path.Path +import kotlin.io.path.deleteIfExists class PayloadBinParser : IPackable { override val loopNo: Int = 0 @@ -47,7 +48,7 @@ class PayloadBinParser : IPackable { fun clear(fileName: String) { super.clear() - fileName.deleteIfExists() + Path(fileName).deleteIfExists() } override fun flash(fileName: String, deviceName: String) { diff --git a/bbootimg/src/main/kotlin/packable/VBMetaParser.kt b/bbootimg/src/main/kotlin/packable/VBMetaParser.kt index 1d1b84ac..761cbf8f 100644 --- a/bbootimg/src/main/kotlin/packable/VBMetaParser.kt +++ b/bbootimg/src/main/kotlin/packable/VBMetaParser.kt @@ -18,13 +18,14 @@ import avb.AVBInfo import cfig.Avb import cfig.helper.Dumpling import cfig.helper.Helper -import cfig.helper.Helper.Companion.deleteIfExists import com.fasterxml.jackson.databind.ObjectMapper import org.slf4j.LoggerFactory import java.io.File import java.nio.file.Files import java.nio.file.Paths import java.nio.file.StandardOpenOption +import kotlin.io.path.Path +import kotlin.io.path.deleteIfExists class VBMetaParser : IPackable { override val loopNo: Int @@ -66,7 +67,7 @@ class VBMetaParser : IPackable { fun clear(fileName: String) { super.clear() listOf("", ".signed").forEach { - "$fileName$it".deleteIfExists() + Path("$fileName$it").deleteIfExists() } } diff --git a/bbootimg/src/main/kotlin/packable/VendorBootParser.kt b/bbootimg/src/main/kotlin/packable/VendorBootParser.kt index 23ed6c6f..2aeb85b7 100644 --- a/bbootimg/src/main/kotlin/packable/VendorBootParser.kt +++ b/bbootimg/src/main/kotlin/packable/VendorBootParser.kt @@ -15,10 +15,11 @@ package cfig.packable import cfig.bootimg.v3.VendorBoot -import cfig.helper.Helper.Companion.deleteIfExists import com.fasterxml.jackson.databind.ObjectMapper import org.slf4j.LoggerFactory import java.io.File +import kotlin.io.path.Path +import kotlin.io.path.deleteIfExists class VendorBootParser : IPackable { override val loopNo: Int = 0 @@ -59,7 +60,7 @@ class VendorBootParser : IPackable { fun clear(fileName: String) { super.clear() listOf("", ".clear", ".google", ".clear", ".signed", ".signed2").forEach { - "$fileName$it".deleteIfExists() + Path("$fileName$it").deleteIfExists() } VBMetaParser().clear("vbmeta.img") } diff --git a/bbootimg/src/main/kotlin/utils/DTC.kt b/bbootimg/src/main/kotlin/rom/fdt/DTC.kt similarity index 96% rename from bbootimg/src/main/kotlin/utils/DTC.kt rename to bbootimg/src/main/kotlin/rom/fdt/DTC.kt index e4455f73..7387e365 100644 --- a/bbootimg/src/main/kotlin/utils/DTC.kt +++ b/bbootimg/src/main/kotlin/rom/fdt/DTC.kt @@ -12,11 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -package cfig.utils +package rom.fdt import cc.cfig.io.Struct import cfig.helper.Dumpling import cfig.helper.Helper +import cfig.utils.EnvironmentVerifier import org.apache.commons.exec.CommandLine import org.apache.commons.exec.DefaultExecutor import org.slf4j.LoggerFactory @@ -34,7 +35,7 @@ class DTC { ) data class FdtHeader( - var magic: Int = 0, + var magic: Long = 0L, val totalsize: Int = 0, val offDtStruct: Int = 0, val offDtStrings: Int = 0, @@ -47,7 +48,7 @@ class DTC { ) { companion object { private const val MAGIC = 0xd00dfeedu - const val FORMAT_STRING = ">10i" + const val FORMAT_STRING = ">I9i" const val SIZE = 40 init { @@ -58,7 +59,7 @@ class DTC { fun parse(iS: InputStream): FdtHeader { val info = Struct(FORMAT_STRING).unpack(iS) val ret = FdtHeader( - info[0] as Int, + (info[0] as UInt).toLong(), info[1] as Int, info[2] as Int, info[3] as Int, @@ -150,9 +151,9 @@ class DTC { } val remainder = File(fileName).length() - ret.sumOf { it.header.totalsize }.toLong() if (remainder == 0L) { - log.info("Successfully parsed ${ret.size} FDT headers") + log.info("Successfully parsed ${ret.size} FDT headers from $fileName") } else { - log.warn("Successfully parsed ${ret.size} FDT headers, remainder: $remainder bytes") + log.warn("Successfully parsed ${ret.size} FDT headers from $fileName, remainder: $remainder bytes") } return ret } diff --git a/bbootimg/src/main/kotlin/utils/Dtbo.kt b/bbootimg/src/main/kotlin/rom/fdt/Dtbo.kt similarity index 96% rename from bbootimg/src/main/kotlin/utils/Dtbo.kt rename to bbootimg/src/main/kotlin/rom/fdt/Dtbo.kt index f8390f0b..2a8c0187 100644 --- a/bbootimg/src/main/kotlin/utils/Dtbo.kt +++ b/bbootimg/src/main/kotlin/rom/fdt/Dtbo.kt @@ -1,4 +1,4 @@ -package utils +package rom.fdt import avb.AVBInfo import cc.cfig.io.Struct @@ -8,7 +8,6 @@ import cfig.bootimg.Signer import cfig.helper.Dumpling import cfig.helper.Helper import cfig.packable.VBMetaParser -import cfig.utils.DTC import com.fasterxml.jackson.databind.ObjectMapper import de.vandermeer.asciitable.AsciiTable import org.slf4j.LoggerFactory @@ -59,8 +58,8 @@ class Dtbo( } totalSize = info[1] as Int headerSize = info[2] as Int - if (headerSize != DtboHeader.SIZE) { - log.warn("headerSize $headerSize != ${DtboHeader.SIZE}") + if (headerSize != SIZE) { + log.warn("headerSize $headerSize != $SIZE") } entrySize = info[3] as Int if (entrySize != DeviceTreeTableEntry.SIZE) { @@ -186,7 +185,7 @@ class Dtbo( .toInt() // Part II - a for (index in 0 until dtEntries.size) { - DTC().compile("${outDir}dt/dt.${index}.${dtsSuffix}", "${outDir}dt/dt.${index}") + DTC().compile("${outDir}dt/dt.${index}.$dtsSuffix", "${outDir}dt/dt.${index}") } // Part II - b var offset = DtboHeader.SIZE + (header.entryCount * DeviceTreeTableEntry.SIZE) @@ -221,7 +220,7 @@ class Dtbo( it.addRow("image info", outDir + info.output.removeSuffix(".img") + ".json") it.addRule() it.addRow("device-tree blob (${this.header.entryCount} blobs)", "${outDir}dt/dt.*") - it.addRow("\\-- device-tree source ", "${outDir}dt/dt.*.${dtsSuffix}") + it.addRow("\\-- device-tree source ", "${outDir}dt/dt.*.$dtsSuffix") it.addRule() it.addRow("AVB info", Avb.getJsonFileName(info.output)) it.addRule() diff --git a/bbootimg/src/main/kotlin/rom/sparse/SparseImgParser.kt b/bbootimg/src/main/kotlin/rom/sparse/SparseImgParser.kt index d9a13486..492f4d11 100644 --- a/bbootimg/src/main/kotlin/rom/sparse/SparseImgParser.kt +++ b/bbootimg/src/main/kotlin/rom/sparse/SparseImgParser.kt @@ -14,20 +14,16 @@ package rom.sparse -import avb.AVBInfo import avb.blob.Footer -import cfig.Avb -import cfig.bootimg.Common.Companion.deleleIfExists -import cfig.helper.Dumpling import cfig.helper.Helper -import cfig.helper.Helper.Companion.deleteIfExists import cfig.packable.IPackable import cfig.packable.VBMetaParser import com.fasterxml.jackson.databind.ObjectMapper -import de.vandermeer.asciitable.AsciiTable import org.slf4j.LoggerFactory import java.io.File import java.io.FileInputStream +import kotlin.io.path.Path +import kotlin.io.path.deleteIfExists class SparseImgParser : IPackable { override val loopNo: Int @@ -87,7 +83,7 @@ class SparseImgParser : IPackable { fun clear(fileName: String) { super.clear() listOf("", ".clear", ".signed").forEach { - "$fileName$it".deleteIfExists() + Path("$fileName$it").deleteIfExists() } VBMetaParser().clear("vbmeta.img") } diff --git a/bbootimg/src/test/kotlin/rom/fdt/DTCTest.kt b/bbootimg/src/test/kotlin/rom/fdt/DTCTest.kt new file mode 100644 index 00000000..089cf90b --- /dev/null +++ b/bbootimg/src/test/kotlin/rom/fdt/DTCTest.kt @@ -0,0 +1,30 @@ +package rom.fdt + +import org.junit.After +import org.junit.Before +import org.junit.Test +import kotlin.io.path.createTempFile +import kotlin.io.path.deleteIfExists +import kotlin.io.path.writeBytes + +class DTCTest { + private lateinit var tempFile :java.nio.file.Path + + @Before + fun before() { + tempFile = createTempFile() + val dtbData = this::class.java.classLoader.getResourceAsStream("multiple_DT.dtb")!!.readAllBytes() + tempFile.writeBytes(dtbData) + } + + @After + fun after() { + tempFile.deleteIfExists() + } + + @Test + fun doIt() { + val dtbList = DTC.parseMultiple(tempFile.toAbsolutePath().toString()) + check(dtbList.size == 4) + } +} diff --git a/bbootimg/src/test/resources/multiple_DT.dtb b/bbootimg/src/test/resources/multiple_DT.dtb new file mode 100644 index 00000000..77c49d69 Binary files /dev/null and b/bbootimg/src/test/resources/multiple_DT.dtb differ diff --git a/doc/Pixel8_vbmeta.png b/doc/Pixel8_vbmeta.png new file mode 100644 index 00000000..7b7b20ff Binary files /dev/null and b/doc/Pixel8_vbmeta.png differ diff --git a/helper/src/main/kotlin/cfig/helper/Helper.kt b/helper/src/main/kotlin/cfig/helper/Helper.kt index b76f9ae5..2712a75e 100644 --- a/helper/src/main/kotlin/cfig/helper/Helper.kt +++ b/helper/src/main/kotlin/cfig/helper/Helper.kt @@ -179,13 +179,6 @@ class Helper { log.info("Dumping data to $dumpFile done") } - fun String.deleteIfExists() { - if (File(this).exists()) { - log.info("deleting $this") - File(this).delete() - } - } - fun String.check_call(inWorkdir: String? = null): Boolean { val ret: Boolean try { diff --git a/integrationTest.py b/integrationTest.py index 9da95e44..4daf5a27 100755 --- a/integrationTest.py +++ b/integrationTest.py @@ -190,6 +190,8 @@ def main(): verifySingleDir(resDir3, "issue_133_repack_ext4") else: log.info("sparse image is not supported on OS other than Linux, skip testing") + # Issue 134: multiple DTs + verifySingleDir(resDir3, "issue_134_multiple_DTs") log.info(successLogo) diff --git a/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/Pidstat.kt b/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/Pidstat.kt index 0a059b77..697de385 100644 --- a/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/Pidstat.kt +++ b/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/Pidstat.kt @@ -1,6 +1,5 @@ package cfig.lazybox.sysinfo -import cfig.helper.Helper.Companion.deleteIfExists import com.fasterxml.jackson.databind.ObjectMapper import org.slf4j.LoggerFactory import java.io.File @@ -8,6 +7,7 @@ import java.nio.file.Files import java.nio.file.attribute.FileAttribute import java.nio.file.attribute.PosixFilePermissions import kotlin.io.path.Path +import kotlin.io.path.deleteIfExists class Pidstat { data class Cfg( @@ -63,13 +63,13 @@ class Pidstat { val permissions: FileAttribute<*> = PosixFilePermissions.asFileAttribute(ownerWritable) String.format(outFile, 1).let { - it.deleteIfExists() + Path(it).deleteIfExists() Files.createFile(Path(it), permissions) File(it).writeText("#!/bin/bash\nset -x\n$cmd1\n") log.info("$it is ready") } String.format(outFile, 2).let { - it.deleteIfExists() + Path(it).deleteIfExists() if (run2) { Files.createFile(Path(it), permissions) File(it).writeText("#!/bin/bash\necho $cmd2\n$cmd2\n") diff --git a/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/SysInfo.kt b/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/SysInfo.kt index 67bf4318..0df04195 100644 --- a/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/SysInfo.kt +++ b/lazybox/src/main/kotlin/cfig/lazybox/sysinfo/SysInfo.kt @@ -2,7 +2,6 @@ package cfig.lazybox.sysinfo import cfig.helper.Helper import cfig.helper.Helper.Companion.check_call -import cfig.helper.Helper.Companion.deleteIfExists import cfig.helper.ZipHelper import org.slf4j.LoggerFactory import java.io.File @@ -10,6 +9,7 @@ import java.io.FileOutputStream import java.io.OutputStream import java.nio.file.Files import java.nio.file.Paths +import kotlin.io.path.Path import kotlin.io.path.deleteIfExists import kotlin.io.path.writeText @@ -63,7 +63,7 @@ makeTar("%s", "%s") fun run() { "adb wait-for-device".check_call() "adb root".check_call() - "sysinfo.tar".deleteIfExists() + Path("sysinfo.tar").deleteIfExists() val prefix = "sysinfo" File("sysinfo").let { if (it.exists()) { diff --git a/lazybox/src/test/kotlin/cfig/lazybox/sysinfo/CpuInfoTest.kt b/lazybox/src/test/kotlin/cfig/lazybox/sysinfo/CpuInfoTest.kt deleted file mode 100644 index e5bdc283..00000000 --- a/lazybox/src/test/kotlin/cfig/lazybox/sysinfo/CpuInfoTest.kt +++ /dev/null @@ -1,14 +0,0 @@ -package cfig.lazybox.sysinfo - -import org.junit.jupiter.api.Test - -import org.junit.jupiter.api.Assertions.* -import java.io.File - -class CpuInfoTest { - - @Test - fun probeInfo() { - CpuInfo.construct() - } -} \ No newline at end of file diff --git a/src/integrationTest/resources b/src/integrationTest/resources index c2e5850a..24b0660f 160000 --- a/src/integrationTest/resources +++ b/src/integrationTest/resources @@ -1 +1 @@ -Subproject commit c2e5850a225bd765fa45b6c628106a82aee2a66f +Subproject commit 24b0660fb6859fe738599b1e0a1faf1aa9381613 diff --git a/src/integrationTest/resources_2 b/src/integrationTest/resources_2 index b5906e9a..106cacec 160000 --- a/src/integrationTest/resources_2 +++ b/src/integrationTest/resources_2 @@ -1 +1 @@ -Subproject commit b5906e9ac69e0de09d8380b3f3409ed336017262 +Subproject commit 106cacece826ef18b67117118a37ff034ec72f61 diff --git a/src/integrationTest/resources_3 b/src/integrationTest/resources_3 index 631af3d1..4ed25ab4 160000 --- a/src/integrationTest/resources_3 +++ b/src/integrationTest/resources_3 @@ -1 +1 @@ -Subproject commit 631af3d1c11343c0a2df1d044cabd44e78fdf865 +Subproject commit 4ed25ab4b19cacc8f65753cd35fb4978fdb7229f