-
Notifications
You must be signed in to change notification settings - Fork 265
Create devcontainer.json #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
R0nni333
wants to merge
2
commits into
cfig:dev
Choose a base branch
from
R0nni333:patch-1
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"image": "mcr.microsoft.com/devcontainers/universal:2", | ||
"features": {} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package cfig.lazybox | ||
|
||
import cfig.helper.Helper | ||
import cfig.helper.Helper.Companion.check_call | ||
import org.slf4j.LoggerFactory | ||
import java.io.File | ||
import java.nio.file.Files | ||
import java.nio.file.Paths | ||
|
||
class ImageRelease { | ||
companion object { | ||
private val log = LoggerFactory.getLogger(ImageRelease::class.java) | ||
fun run() { | ||
val buildId = Helper.adbCmd("getprop ro.build.id").lowercase() | ||
val variant = Helper.adbCmd("getprop ro.build.type") | ||
val product = Helper.adbCmd("getprop ro.build.product") | ||
val rel = Helper.adbCmd("getprop ro.build.version.release") | ||
val increment = Helper.adbCmd("getprop ro.build.version.incremental") | ||
val fp = Helper.adbCmd("getprop ro.build.fingerprint") | ||
|
||
val computFacDir = "$product-factory-$buildId" | ||
val computFacZip = "$product-factory-$buildId-$increment.zip" | ||
val computOtaZip = "$product-ota-$buildId-$increment.zip" | ||
val computEmmcZip = "$product-eMMCimg-$buildId-$increment.zip" | ||
|
||
log.info("fingerprint: $fp") | ||
log.info("$product-factory-$buildId-$increment -> $product-factory-$buildId") | ||
log.info("$product-ota-$buildId-$increment") | ||
log.info("$product-eMMCimg-$buildId-$increment") | ||
|
||
//factory | ||
if (File("factory.zip").exists()) { | ||
"rm -fr factory_image factory_img $computFacDir $computFacZip".check_call() | ||
"unzip factory.zip".check_call() | ||
val facDir = if (File("factory_img").exists()) { | ||
//user | ||
"factory_img" | ||
} else if (File("factory_image").exists()) { | ||
//userdebug | ||
"factory_image" | ||
} else { | ||
throw IllegalStateException("can not find factory image folder") | ||
} | ||
File(facDir).listFiles()?.filter { it.name.endsWith(".sh") }?.forEach { it.delete() } | ||
"cp -v /tftp/flash_platypus.sh $facDir/flash.sh".check_call() | ||
"mv -v $facDir $computFacDir".check_call() | ||
"zip $computFacZip -r $computFacDir".check_call() | ||
"rm -fr $computFacDir".check_call() | ||
} | ||
|
||
File("factory.zip").delete() | ||
if (File("ota.zip").exists()) { | ||
Files.move(Paths.get("ota.zip"), Paths.get(computOtaZip)) | ||
} | ||
if (File("emmc.zip").exists()) { | ||
Files.move(Paths.get("emmc.zip"), Paths.get(computEmmcZip)) | ||
} | ||
|
||
log.info("fingerprint: $fp") | ||
log.info("$product-factory-$buildId-$increment -> $product-factory-$buildId") | ||
log.info(computFacZip) | ||
log.info(computOtaZip) | ||
log.info(computEmmcZip) | ||
} | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
package cfig.lazybox | ||
|
||
import org.slf4j.LoggerFactory | ||
import java.io.BufferedWriter | ||
import java.io.File | ||
import java.io.FileOutputStream | ||
import java.io.FileWriter | ||
|
||
class MountAnalyzer { | ||
data class MountInfo( | ||
var dev: String = "", | ||
var mountPoint: String = "", | ||
var fsType: String = "", | ||
var flags: String? = null, | ||
) | ||
|
||
class MiComparator : Comparator<MountInfo> { | ||
override fun compare(p1: MountInfo, p2: MountInfo): Int { | ||
var ret = p1.fsType.compareTo(p2.fsType) * 100 | ||
ret += p1.dev.compareTo(p2.dev) * 10 | ||
ret += p1.mountPoint.compareTo(p2.mountPoint) * 1 | ||
return ret | ||
} | ||
} | ||
|
||
fun run() { | ||
val loopApex = mutableListOf<MountInfo>() | ||
val dmApex = mutableListOf<MountInfo>() | ||
val tmpApex = mutableListOf<MountInfo>() | ||
val bootApex = mutableListOf<MountInfo>() | ||
val fuseInfo = mutableListOf<MountInfo>() | ||
val sysInfo = mutableListOf<MountInfo>() | ||
val androidRo = mutableListOf<MountInfo>() | ||
val androidRw = mutableListOf<MountInfo>() | ||
val otherRw = mutableListOf<MountInfo>() | ||
val unknownMi = mutableListOf<MountInfo>() | ||
val lines = File("mount.log").readLines() | ||
lines.forEachIndexed { n, line -> | ||
val regex = Regex("(\\S+)\\s+on\\s+(\\S+)\\s+type\\s+(\\w+)\\s+\\(([^)]*)\\)") // Capture flags | ||
val matchResult = regex.find(line) | ||
if (matchResult != null) { | ||
val dev = matchResult.groupValues[1] | ||
val mountPoint = matchResult.groupValues[2] | ||
val fsType = matchResult.groupValues[3] | ||
val flags = | ||
if (matchResult.groupValues.size > 4) matchResult.groupValues[4] else null // Handle no flags | ||
val mi = MountInfo(dev, mountPoint, fsType, flags) | ||
if (mi.mountPoint.startsWith("/apex") || mi.mountPoint.startsWith("/bootstrap-apex")) { | ||
if (mi.mountPoint.startsWith("/bootstrap-apex")) { | ||
bootApex.add(mi) | ||
} else if (mi.dev.startsWith("/dev/block/loop")) { | ||
loopApex.add(mi) | ||
} else if (mi.dev.startsWith("/dev/block/dm")) { | ||
dmApex.add(mi) | ||
} else if (mi.dev.startsWith("tmpfs")) { | ||
tmpApex.add(mi) | ||
} else { | ||
log.info("$fsType: $dev -> $mountPoint") | ||
throw IllegalStateException("X1") | ||
} | ||
} else if (mi.mountPoint.startsWith("/sys/") || mi.mountPoint == "/sys") { | ||
sysInfo.add(mi) | ||
} else if (mi.fsType == "fuse") { | ||
fuseInfo.add(mi) | ||
} else { | ||
log.info("$fsType: $dev -> $mountPoint") | ||
if (mi.flags!!.contains("ro,") or mi.flags!!.contains("ro)")) { | ||
androidRo.add(mi) | ||
} else if (mi.flags!!.contains("rw,") or mi.flags!!.contains("rw)")) { | ||
if (mi.dev.startsWith("/dev/")) { | ||
androidRw.add(mi) | ||
} else { | ||
otherRw.add(mi) | ||
} | ||
} else { | ||
throw IllegalStateException("X2") | ||
} | ||
} | ||
} else { //For lines without flags | ||
val regexNoFlags = Regex("(\\S+)\\s+on\\s+(\\S+)\\s+type\\s+(\\w+)") | ||
val matchResultNoFlags = regexNoFlags.find(line) | ||
if (matchResultNoFlags != null) { | ||
val dev = matchResultNoFlags.groupValues[1] | ||
val mountPoint = matchResultNoFlags.groupValues[2] | ||
val fsType = matchResultNoFlags.groupValues[3] | ||
val mi = MountInfo(dev, mountPoint, fsType, null) | ||
unknownMi.add(mi) | ||
} else { | ||
throw IllegalStateException("X3") | ||
} | ||
} | ||
} // end-of-lines | ||
//sanity check, make sure consistent | ||
check( | ||
listOf( | ||
loopApex, | ||
dmApex, | ||
tmpApex, | ||
bootApex, | ||
fuseInfo, | ||
sysInfo, | ||
androidRo, | ||
androidRw, | ||
otherRw, | ||
unknownMi | ||
).sumOf { it.size } == lines.size) | ||
//dump | ||
val infoNames = listOf( | ||
"fusefs", | ||
"sysfs", | ||
"Android RO", | ||
"Android RW", | ||
"other Rw", | ||
"loop apex", | ||
"dm apex", | ||
"tmp apex", | ||
"boot apex", | ||
"unknown" | ||
) | ||
BufferedWriter(FileWriter(File("sorted_mount.log"))).use { fos -> | ||
listOf( | ||
fuseInfo, | ||
sysInfo, | ||
androidRo, | ||
androidRw, | ||
otherRw, | ||
loopApex, | ||
dmApex, | ||
tmpApex, | ||
bootApex, | ||
unknownMi | ||
).forEachIndexed { n, mis -> | ||
mis.sortWith(MiComparator()) | ||
log.info(infoNames.get(n)) | ||
fos.write(infoNames.get(n) + "\n") | ||
mis.forEachIndexed { index, it -> | ||
log.info("[$index] ${it.fsType} : ${it.dev} -> ${it.mountPoint} (${it.flags})") | ||
fos.write("#$index | ${it.fsType} | ${it.dev} | ${it.mountPoint} | (${it.flags})\n") | ||
} | ||
fos.write("\n") | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
private val log = LoggerFactory.getLogger(MountAnalyzer::class.java) | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.