Skip to content

Commit

Permalink
give BL_BACKUP env var to install script
Browse files Browse the repository at this point in the history
  • Loading branch information
nift4 committed Jan 18, 2025
1 parent fa95fbe commit 6bf314d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/org/andbootmgr/app/DeviceLogic.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class DeviceLogic(private val ctx: Context) {
val abmDb = File(abmBootset, "db")
val abmEntries = File(abmDb, "entries")
val abmDbConf = File(abmDb, "db.conf")
val lkBackupPrimary = File(fileDir, "backup_lk1.img")
val lkBackupSecondary = File(fileDir, "backup_lk.img")
var mounted = false
fun mountBootset(d: DeviceInfo): Boolean {
if (checkMounted()) return true
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/andbootmgr/app/DroidBootFlow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,10 @@ private fun Flash(d: DroidBootFlowDataHolder) {
entry.exportToFile(File(vm.logic.abmEntries, "real.conf"))
if (!vm.deviceInfo.isBooted(vm.logic)) {
terminal.add(vm.activity.getString(R.string.term_flashing_droidboot))
val backupLk = File(vm.logic.fileDir, "backup_lk1.img")
val f = SuFile.open(vm.deviceInfo.blBlock)
if (!f.canWrite())
terminal.add(vm.activity.getString(R.string.term_cant_write_bl))
vm.copyPriv(SuFileInputStream.open(vm.deviceInfo.blBlock), backupLk)
vm.copyPriv(SuFileInputStream.open(vm.deviceInfo.blBlock), vm.logic.lkBackupPrimary)
try {
vm.copyPriv(vm.chosen["droidboot"]!!.openInputStream(vm), File(vm.deviceInfo.blBlock))
} catch (e: IOException) {
Expand All @@ -355,6 +354,7 @@ private fun Flash(d: DroidBootFlowDataHolder) {
terminal.add(vm.activity.getString(R.string.term_device_setup))
vm.logic.runShFileWithArgs(
"BOOTED=${vm.deviceInfo.isBooted(vm.logic)} SETUP=true " +
"BL_BACKUP=${vm.logic.lkBackupPrimary.absolutePath} " +
"${tmpFile!!.absolutePath} real"
).to(terminal).exec()
tmpFile.delete()
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/org/andbootmgr/app/FixDroidBootFlow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@ private fun Flash(vm: WizardState) {
}
} else null
terminal.add(vm.activity.getString(R.string.term_flashing_droidboot))
val backupLk = File(vm.logic.fileDir, "backup_lk.img")
val f = SuFile.open(vm.deviceInfo.blBlock)
if (!f.canWrite())
terminal.add(vm.activity.getString(R.string.term_cant_write_bl))
vm.copyPriv(SuFileInputStream.open(vm.deviceInfo.blBlock), backupLk)
vm.copyPriv(SuFileInputStream.open(vm.deviceInfo.blBlock), vm.logic.lkBackupSecondary)
try {
vm.copyPriv(vm.chosen["droidboot"]!!.openInputStream(vm), File(vm.deviceInfo.blBlock))
} catch (e: IOException) {
Expand All @@ -84,7 +83,8 @@ private fun Flash(vm: WizardState) {
if (vm.deviceInfo.postInstallScript) {
terminal.add(vm.activity.getString(R.string.term_device_setup))
vm.logic.runShFileWithArgs(
"BOOTED=${vm.deviceInfo.isBooted(vm.logic)} SETUP=true " +
"BOOTED=${vm.deviceInfo.isBooted(vm.logic)} SETUP=false " +
"BL_BACKUP=${vm.logic.lkBackupSecondary.absolutePath} " +
"${tmpFile!!.absolutePath} real"
).to(terminal).exec()
tmpFile.delete()
Expand Down

0 comments on commit 6bf314d

Please sign in to comment.