diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index ef54bd5..51e357f 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -16,7 +16,7 @@ tauri-build = { version = "1.2", features = [] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.2", features = ["dialog-open", "path-all", "shell-open"] } +tauri = { version = "1.2", features = ["dialog-open", "path-all", "process-exit", "shell-open"] } compress-tools = "0.14.1" fs_extra = "1.3.0" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index cde0052..4a2b5f0 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "android-x86-installer", - "version": "0.0.0" + "version": "0.1.0" }, "tauri": { "allowlist": { @@ -25,6 +25,9 @@ "open": true, "save": false }, + "process": { + "exit": true + }, "path": { "all": true } diff --git a/src/installer_app.js b/src/installer_app.js index 3830bdc..c960229 100644 --- a/src/installer_app.js +++ b/src/installer_app.js @@ -7,6 +7,8 @@ import '@material/web/button/outlined-button'; import '@material/web/button/text-button'; import '@material/web/dialog/dialog'; import '@material/web/circularprogress/circular-progress'; +import '@material/web/elevation/elevation' +import { exit } from '@tauri-apps/api/process'; import androidLogo from './assets/android.svg' @@ -19,6 +21,7 @@ export class InstallerApp extends LitElement { dialogTitle_: {type: String}, dialogMsg_: {type: String}, progressPercent_: {type: Number}, + bootloaderMsg_: {type: String}, }; } @@ -26,6 +29,12 @@ export class InstallerApp extends LitElement { super(); this.activeCategory_ = 'install'; this.progressPercent_ = 0; + this.bootloaderMsg_ = +` menuentry "Android" --class android-x86 { + savedefault + search --no-floppy --set=root --file /boot/grub/grub.cfg + configfile /boot/grub/grub.cfg + }`; } /** @override */ @@ -93,6 +102,32 @@ export class InstallerApp extends LitElement { height: 80vh; width: 60vh; } + + .codeblock-surface { + background-color: var( --md-sys-color-surface-container-high); + border-radius: 1em; + border-width: 1px; + margin-bottom: 1.5rem; + overflow: hidden; + width: 100%; + --md-elevation-level: 5; + } + + .copy-button { + display: flex; + border-radius: 9999px; + background-color: rgb(34 34 34); + color: rgb(158 158 158); + position: absolute; + justify-content: center; + align-items: center; + width: 2.5rem; + height: 2.5rem; + outline: 2px solid transparent; + outline-offset: 2px; + top: 0; + right: 0; + } ` } @@ -143,13 +178,26 @@ export class InstallerApp extends LitElement {
- +
+

Open /etc/grub.d/40_custom or /boot/grub/grub.cfg in a text editor

+

Create a new grub entry with the following code:

+
+ +
+ +
+
${this.bootloaderMsg_}
+
+

If it is desired to edit /etc/grub.d/40_custom then + re-generate grub config after saving file to apply changes

+
+
${this.dialogTitle_}
- ${this.dialogMsg_} + ${this.dialogMsg_}
@@ -190,6 +238,10 @@ export class InstallerApp extends LitElement { this.dialog.show(); } + async onFinishButtonClicked() { + await exit(1); + } + closeDialog() { this.dialog.close(); } @@ -198,6 +250,11 @@ export class InstallerApp extends LitElement { this.progressPercent_ = progress; this.circularProgress.progress = progress / 100; } + + async copyCode() { + await navigator.clipboard.writeText(this.bootloaderMsg_); + this.showDialog('Copied to clipboard', this.bootloaderMsg_); + } firstUpdated() { this.dialog = this.renderRoot.querySelector('#dialog'); diff --git a/src/main.js b/src/main.js index 978ee66..b7353f3 100644 --- a/src/main.js +++ b/src/main.js @@ -47,7 +47,16 @@ async function updateProgress() { await listen('new-dir-size', (event) => { installEl.updateProgress(event.payload) }); - if (installEl.progressPercent_ >= 100) break; + if (installEl.progressPercent_ >= 100) { + sidePanelEl.activateNextCategory(); + installEl.bootloaderMsg_ = +` menuentry "${osTitleTextFieldEl.value}" --class android-x86 { + savedefault + search --no-floppy --set=root --file ${installDirTextFieldEl.value}/boot/grub/grub.cfg + configfile ${installDirTextFieldEl.value}/boot/grub/grub.cfg + }`; + break; + } } }