From e2c7f224e0a5928c865699eb28f1e8179dae064f Mon Sep 17 00:00:00 2001 From: axtlos Date: Thu, 19 May 2022 19:26:13 +0200 Subject: [PATCH] unakite implemented, can be set up from gui now --- jade_log.txt | 3 ++- lib/classes/install_prefs.dart | 19 ++++++++++++++++- lib/functions/install.dart | 18 +++++++++++++++-- lib/functions/partitioning/manual.dart | 3 ++- lib/main.dart | 28 +++++++++++++++++++++++--- 5 files changed, 63 insertions(+), 8 deletions(-) diff --git a/jade_log.txt b/jade_log.txt index eb72a4b..a1b8118 100644 --- a/jade_log.txt +++ b/jade_log.txt @@ -1,2 +1,3 @@ -Disks:widget \ No newline at end of file +Disks:widget /dev/sda +/dev/nvme0n1 diff --git a/lib/classes/install_prefs.dart b/lib/classes/install_prefs.dart index f89ba8e..a097356 100644 --- a/lib/classes/install_prefs.dart +++ b/lib/classes/install_prefs.dart @@ -20,6 +20,11 @@ class InstallPrefs { final bool enableFlatpak; final bool manualPartitioning; final List partitions; + final bool enableUnakite; + final String unakiteRoot; + final String crystalRoot; + final String unakiteEfiDir; + final String unakiteBootDev; InstallPrefs({ this.locale = const Location(), @@ -40,6 +45,11 @@ class InstallPrefs { this.enableFlatpak = false, this.manualPartitioning = false, this.partitions = const [], + this.enableUnakite = true, + this.unakiteRoot = "", + this.crystalRoot = "", + this.unakiteEfiDir = "", + this.unakiteBootDev = "", }); Map toJson() => { @@ -77,6 +87,13 @@ class InstallPrefs { "flatpak": enableFlatpak, "extra_packages": [ "firefox", - ] + ], + "unakite": { + "enable": enableUnakite, + "root": unakiteRoot, + "oldroot": crystalRoot, + "efidir": unakiteEfiDir, + "bootdev": unakiteBootDev, + } }; } diff --git a/lib/functions/install.dart b/lib/functions/install.dart index 2149922..8f7a260 100644 --- a/lib/functions/install.dart +++ b/lib/functions/install.dart @@ -33,6 +33,11 @@ Widget install( bool ipv6, bool enableTimeshift, bool enableFlatpak, + bool enableUnakite, + String unakiteRoot, + String unakiteBootDev, + String unakiteEfiDir, + String crystalRoot, setOutput, output, running, @@ -44,8 +49,12 @@ Widget install( for (var part in partitions) { if (part.mountpoint != "none" && part.filesystem != "none") { - partsParsed - .add("/mnt${part.mountpoint}:${part.partition}:${part.filesystem}"); + if (part.mountpoint == "unakite") { + partsParsed.add("none:${part.partition}:btrfs"); + } else { + partsParsed + .add("/mnt${part.mountpoint}:${part.partition}:${part.filesystem}"); + } } } @@ -68,6 +77,11 @@ Widget install( ipv6: ipv6, enableTimeshift: enableTimeshift, enableFlatpak: enableFlatpak, + enableUnakite: enableUnakite, + unakiteRoot: unakiteRoot, + unakiteBootDev: unakiteBootDev, + unakiteEfiDir: unakiteEfiDir, + crystalRoot: crystalRoot, ); String jsonPrefs = jsonEncode(prefs.toJson()); //writeConfig(jsonPrefs); diff --git a/lib/functions/partitioning/manual.dart b/lib/functions/partitioning/manual.dart index d8d087b..7c56c2b 100644 --- a/lib/functions/partitioning/manual.dart +++ b/lib/functions/partitioning/manual.dart @@ -122,7 +122,8 @@ Widget manualPartitioning( "/opt", "/tmp", "/usr", - "/var" + "/var", + "unakite" ]; var filesystems = [ "don't format", diff --git a/lib/main.dart b/lib/main.dart index ba358bc..11a0bdf 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -123,6 +123,7 @@ class _JadeguiState extends State { bool enableFlatpak = true; bool connected = false; bool manualPartitioning = false; + bool enableUnakite = true; bool running = false; bool runningInfo = false; bool runningPart = false; @@ -142,6 +143,10 @@ class _JadeguiState extends State { String _diskType = ""; String hostname = ""; String output = ""; + String unakiteRoot = ""; + String crystalRoot = ""; + String unakiteEfiDir = ""; + String unakiteBootDev = ""; Desktop currDesktop = desktops[0]; Keymap chosenLayout = Keymap(); List partitions = []; @@ -671,14 +676,26 @@ class _JadeguiState extends State { (partition, value) { setState(() { partition.mountpoint = value; - if (value == "/boot/efi") { - partition.format = "vfat"; + if (value == "/boot/efi" && isEfi) { + partition.filesystem = "vfat"; + unakiteEfiDir = value; + unakiteBootDev = partition.partition; + } else if (value == "/boot") { + unakiteEfiDir = value; + unakiteBootDev = partition.partition; + } else if (value == "/") { + crystalRoot = partition.partition; + } else if (value == "unakite") { + unakiteRoot = partition.partition; + partition.filesystem = "btrfs"; } }); }, (partition, value) { setState(() { - partition.filesystem = value; + if (partition.mountpoint != "unakite") { + partition.filesystem = value; + } }); }, isEfi), @@ -757,6 +774,11 @@ class _JadeguiState extends State { ipv6, enableTimeshift, enableFlatpak, + enableUnakite, + unakiteRoot, + unakiteBootDev, + unakiteEfiDir, + crystalRoot, (value) { setState(() { if (value.compareTo(output) == 1) {