Integration/02x migration fixes (#1105)

* migrate root ca from 0.2.x

* migrate tor key, fix threading

* fixes lan address divergence across setup scenarios

* verifies that data drive matches the OS key on attachment

* fix 0.2.x recovery flow

* fixes issues with reading the product_key.txt file when it doesn't exist (NO_KEY=1)

* migrate tor key before initializing patchdb

* move patchdb lock guard acquisition into deferred async block

* pass product_key by parameter

* works, fucking finally

Co-authored-by: Matt Hill <matthewonthemoon@gmail.com>
Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
Keagan McClelland
2022-01-20 10:20:27 -07:00
committed by Aiden McClelland
parent 9d13c48640
commit 666f1bc0eb
8 changed files with 332 additions and 178 deletions

View File

@@ -131,36 +131,51 @@ export class RecoverPage {
}
async select (target: DiskBackupTarget) {
if (target['embassy-os'].version.startsWith('0.2')) {
return this.selectRecoverySource(target.logicalname)
}
const is02x = target['embassy-os'].version.startsWith('0.2')
if (this.stateService.hasProductKey) {
const modal = await this.modalController.create({
component: PasswordPage,
componentProps: { target },
cssClass: 'alertlike-modal',
})
modal.onDidDismiss().then(res => {
if (res.data && res.data.password) {
this.selectRecoverySource(target.logicalname, res.data.password)
}
})
await modal.present()
if (is02x) {
this.selectRecoverySource(target.logicalname)
} else {
const modal = await this.modalController.create({
component: PasswordPage,
componentProps: { target },
cssClass: 'alertlike-modal',
})
modal.onDidDismiss().then(res => {
if (res.data && res.data.password) {
this.selectRecoverySource(target.logicalname, res.data.password)
}
})
await modal.present()
}
// if no product key, it means they are an upgrade kit user
} else {
const modal = await this.modalController.create({
component: ProdKeyModal,
componentProps: { target },
cssClass: 'alertlike-modal',
})
modal.onDidDismiss().then(res => {
if (res.data && res.data.productKey) {
this.selectRecoverySource(target.logicalname)
}
})
await modal.present()
if (!is02x) {
const alert = await this.alertCtrl.create({
header: 'Error',
message: 'In order to use this image, you must select a drive containing a valid 0.2.x Embassy.',
buttons: [
{
role: 'cancel',
text: 'OK',
},
],
})
await alert.present()
} else {
const modal = await this.modalController.create({
component: ProdKeyModal,
componentProps: { target },
cssClass: 'alertlike-modal',
})
modal.onDidDismiss().then(res => {
if (res.data && res.data.productKey) {
this.selectRecoverySource(target.logicalname)
}
})
await modal.present()
}
}
}