Skip to content

Commit 6bf314d

Browse files
committed
give BL_BACKUP env var to install script
1 parent fa95fbe commit 6bf314d

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

app/src/main/java/org/andbootmgr/app/DeviceLogic.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class DeviceLogic(private val ctx: Context) {
2626
val abmDb = File(abmBootset, "db")
2727
val abmEntries = File(abmDb, "entries")
2828
val abmDbConf = File(abmDb, "db.conf")
29+
val lkBackupPrimary = File(fileDir, "backup_lk1.img")
30+
val lkBackupSecondary = File(fileDir, "backup_lk.img")
2931
var mounted = false
3032
fun mountBootset(d: DeviceInfo): Boolean {
3133
if (checkMounted()) return true

app/src/main/java/org/andbootmgr/app/DroidBootFlow.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,10 @@ private fun Flash(d: DroidBootFlowDataHolder) {
337337
entry.exportToFile(File(vm.logic.abmEntries, "real.conf"))
338338
if (!vm.deviceInfo.isBooted(vm.logic)) {
339339
terminal.add(vm.activity.getString(R.string.term_flashing_droidboot))
340-
val backupLk = File(vm.logic.fileDir, "backup_lk1.img")
341340
val f = SuFile.open(vm.deviceInfo.blBlock)
342341
if (!f.canWrite())
343342
terminal.add(vm.activity.getString(R.string.term_cant_write_bl))
344-
vm.copyPriv(SuFileInputStream.open(vm.deviceInfo.blBlock), backupLk)
343+
vm.copyPriv(SuFileInputStream.open(vm.deviceInfo.blBlock), vm.logic.lkBackupPrimary)
345344
try {
346345
vm.copyPriv(vm.chosen["droidboot"]!!.openInputStream(vm), File(vm.deviceInfo.blBlock))
347346
} catch (e: IOException) {
@@ -355,6 +354,7 @@ private fun Flash(d: DroidBootFlowDataHolder) {
355354
terminal.add(vm.activity.getString(R.string.term_device_setup))
356355
vm.logic.runShFileWithArgs(
357356
"BOOTED=${vm.deviceInfo.isBooted(vm.logic)} SETUP=true " +
357+
"BL_BACKUP=${vm.logic.lkBackupPrimary.absolutePath} " +
358358
"${tmpFile!!.absolutePath} real"
359359
).to(terminal).exec()
360360
tmpFile.delete()

app/src/main/java/org/andbootmgr/app/FixDroidBootFlow.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,10 @@ private fun Flash(vm: WizardState) {
6868
}
6969
} else null
7070
terminal.add(vm.activity.getString(R.string.term_flashing_droidboot))
71-
val backupLk = File(vm.logic.fileDir, "backup_lk.img")
7271
val f = SuFile.open(vm.deviceInfo.blBlock)
7372
if (!f.canWrite())
7473
terminal.add(vm.activity.getString(R.string.term_cant_write_bl))
75-
vm.copyPriv(SuFileInputStream.open(vm.deviceInfo.blBlock), backupLk)
74+
vm.copyPriv(SuFileInputStream.open(vm.deviceInfo.blBlock), vm.logic.lkBackupSecondary)
7675
try {
7776
vm.copyPriv(vm.chosen["droidboot"]!!.openInputStream(vm), File(vm.deviceInfo.blBlock))
7877
} catch (e: IOException) {
@@ -84,7 +83,8 @@ private fun Flash(vm: WizardState) {
8483
if (vm.deviceInfo.postInstallScript) {
8584
terminal.add(vm.activity.getString(R.string.term_device_setup))
8685
vm.logic.runShFileWithArgs(
87-
"BOOTED=${vm.deviceInfo.isBooted(vm.logic)} SETUP=true " +
86+
"BOOTED=${vm.deviceInfo.isBooted(vm.logic)} SETUP=false " +
87+
"BL_BACKUP=${vm.logic.lkBackupSecondary.absolutePath} " +
8888
"${tmpFile!!.absolutePath} real"
8989
).to(terminal).exec()
9090
tmpFile.delete()

0 commit comments

Comments
 (0)