it (should) work

pull/2/head
axtlos 3 years ago
parent 881b39648c
commit c52f7bfa36
No known key found for this signature in database
GPG Key ID: A468AFD71DD51D4A

Binary file not shown.

@ -1,3 +1,2 @@
Disks:widget /dev/sda [LOG]
/dev/nvme0n1

@ -17,6 +17,8 @@ class InstallPrefs {
final String hostname; final String hostname;
final bool ipv6; final bool ipv6;
final bool enableTimeshift; final bool enableTimeshift;
final bool manualPartitioning;
final List<String> partitions;
InstallPrefs({ InstallPrefs({
this.locale = const Location(), this.locale = const Location(),
@ -34,13 +36,16 @@ class InstallPrefs {
this.hostname = "", this.hostname = "",
this.ipv6 = false, this.ipv6 = false,
this.enableTimeshift = false, this.enableTimeshift = false,
this.manualPartitioning = false,
this.partitions = const [],
}); });
Map toJson() => { Map toJson() => {
"partition": { "partition": {
"device": disk, "device": disk,
"mode": "auto", "mode": manualPartitioning ? "manual" : "auto",
"efi": isEfi, "efi": isEfi,
"partitions": partitions,
}, },
"bootloader": { "bootloader": {
"type": bootloader, "type": bootloader,

@ -6,6 +6,6 @@ class Partition {
Partition({ Partition({
this.partition = "", this.partition = "",
this.mountpoint = "none", this.mountpoint = "none",
this.filesystem = "", this.filesystem = "don't format",
}); });
} }

@ -11,8 +11,8 @@ test(setOutput, running, setRunning, config, writeToLog) async {
await File(filename).writeAsString(config); await File(filename).writeAsString(config);
writeToLog("Json config: $config"); writeToLog("Json config: $config");
var process = var process =
await Process.start('pkexec', ['/opt/jade_gui/scripts/jadewrapper.sh']); //await Process.start('pkexec', ['/opt/jade_gui/scripts/jadewrapper.sh']);
//await Process.start('/opt/jade_gui/scripts/jadeemu.sh', []); await Process.start('/opt/jade_gui/scripts/jadeemu.sh', []);
process.stdout.transform(utf8.decoder).forEach(setOutput); process.stdout.transform(utf8.decoder).forEach(setOutput);
setRunning(true); setRunning(true);
} }
@ -38,7 +38,17 @@ Widget install(
running, running,
setRunning, setRunning,
writeToLog, writeToLog,
) { partitions,
manual) {
List<String> partsParsed = <String>[];
for (var part in partitions) {
if (part.mountpoint != "none" && part.filesystem != "none") {
partsParsed
.add("${part.mountpoint}:${part.partition}:${part.filesystem}");
}
}
InstallPrefs prefs = InstallPrefs( InstallPrefs prefs = InstallPrefs(
locale: locale, locale: locale,
keymap: keymap, keymap: keymap,
@ -49,6 +59,8 @@ Widget install(
rootPass: rootPass, rootPass: rootPass,
desktop: desktop, desktop: desktop,
disk: disk.replaceAll("/dev/", ""), disk: disk.replaceAll("/dev/", ""),
manualPartitioning: manual,
partitions: partsParsed,
isEfi: isEfi, isEfi: isEfi,
bootloader: bootloader, bootloader: bootloader,
bootloaderLocation: isEfi ? "/boot/efi" : disk, bootloaderLocation: isEfi ? "/boot/efi" : disk,

@ -23,6 +23,7 @@ Widget partitioning(
setPartitions, setPartitions,
partitions, partitions,
setPartitionMountPoint, setPartitionMountPoint,
setFilesystem,
) { ) {
if (doManualPartitioning) { if (doManualPartitioning) {
setRunningInfoMan(false); setRunningInfoMan(false);
@ -36,6 +37,7 @@ Widget partitioning(
setPartitionMountPoint, setPartitionMountPoint,
setManual, setManual,
next, next,
setFilesystem,
); );
} else { } else {
setRunningInfo(false); setRunningInfo(false);

@ -4,8 +4,7 @@ import 'package:flutter/material.dart';
import 'package:jade_gui/classes/partition.dart'; import 'package:jade_gui/classes/partition.dart';
Widget partitionTemplate(partition, runningInfo, setRunningInfo, mountpoints, Widget partitionTemplate(partition, runningInfo, setRunningInfo, mountpoints,
setPartitionMountpoint) { setPartitionMountpoint, filesystems, setFilesystem) {
String mount = "none";
if (partition().partition != "") { if (partition().partition != "") {
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
@ -33,6 +32,7 @@ Widget partitionTemplate(partition, runningInfo, setRunningInfo, mountpoints,
icon: const Icon(Icons.arrow_downward), icon: const Icon(Icons.arrow_downward),
elevation: 16, elevation: 16,
style: const TextStyle(color: Colors.deepPurple), style: const TextStyle(color: Colors.deepPurple),
dropdownColor: const Color.fromARGB(255, 23, 23, 23),
underline: Container( underline: Container(
height: 2, height: 2,
color: Colors.deepPurpleAccent, color: Colors.deepPurpleAccent,
@ -40,14 +40,39 @@ Widget partitionTemplate(partition, runningInfo, setRunningInfo, mountpoints,
onChanged: (String? newValue) { onChanged: (String? newValue) {
setPartitionMountpoint( setPartitionMountpoint(
partition(), newValue == "" ? "none" : newValue); partition(), newValue == "" ? "none" : newValue);
mount = newValue == "" ? "none" : newValue!;
print(partition().mountpoint); print(partition().mountpoint);
}, },
items: items:
mountpoints.map<DropdownMenuItem<String>>((String value) { mountpoints.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>( return DropdownMenuItem<String>(
value: value, value: value,
child: Text(value), child: Text(value,
style: const TextStyle(color: Colors.white)),
);
}).toList(),
),
const SizedBox(width: 10),
DropdownButton<String>(
value: partition().filesystem,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
dropdownColor: const Color.fromARGB(255, 23, 23, 23),
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
onChanged: (String? newValue) {
setFilesystem(
partition(), newValue == "" ? "none" : newValue);
print(partition().filesystem);
},
items:
filesystems.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value,
style: const TextStyle(color: Colors.white)),
); );
}).toList(), }).toList(),
), ),
@ -61,8 +86,20 @@ Widget partitionTemplate(partition, runningInfo, setRunningInfo, mountpoints,
} }
} }
Widget manualPartitioning(partitions, setState, runningPart, setRunningPart, /*mkfs.bfs mkfs.cramfs mkfs.ext3 mkfs.fat mkfs.msdos mkfs.xfs
runningInfo, setRunningInfo, setPartitionMountpoint, setManual, next) { mkfs.btrfs mkfs.ext2 mkfs.ext4 mkfs.minix mkfs.vfat */
Widget manualPartitioning(
partitions,
setState,
runningPart,
setRunningPart,
runningInfo,
setRunningInfo,
setPartitionMountpoint,
setManual,
next,
setFilesystem) {
var mountpoints = <String>[ var mountpoints = <String>[
"none", "none",
"/", "/",
@ -74,6 +111,20 @@ Widget manualPartitioning(partitions, setState, runningPart, setRunningPart,
"/usr", "/usr",
"/var" "/var"
]; ];
var filesystems = <String>[
"don't format",
"bfs",
"cramfs",
"ext3",
"fat",
"msdos",
"xfs",
"btrfs",
"ext2",
"ext4",
"minix",
"vfat"
];
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -118,6 +169,8 @@ Widget manualPartitioning(partitions, setState, runningPart, setRunningPart,
setRunningInfo, setRunningInfo,
mountpoints, mountpoints,
setPartitionMountpoint, setPartitionMountpoint,
filesystems,
setFilesystem,
), ),
) )
.toList(), .toList(),
@ -146,25 +199,23 @@ Widget manualPartitioning(partitions, setState, runningPart, setRunningPart,
child: Column( child: Column(
children: [ children: [
const Text( const Text(
'Currently chosen Disk: ', 'Select partitions',
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255), color: Color.fromARGB(255, 169, 0, 255),
), ),
), ),
const SizedBox(height: 10),
const Text( const Text(
"selectedPartition", 'to format',
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255), color: Color.fromARGB(255, 169, 0, 255),
), ),
), ),
const SizedBox(height: 5),
const Text( const Text(
'Size: diskInfo', 'and mount',
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,

@ -62,6 +62,7 @@ Widget summary(
nextPage, nextPage,
running, running,
setRunning, setRunning,
partitions,
) { ) {
getDiskType(setDiskType, disk, running, setRunning); getDiskType(setDiskType, disk, running, setRunning);
return Column( return Column(

@ -644,18 +644,18 @@ class _JadeguiState extends State<Jadegui> {
partitions, partitions,
(partition, value) { (partition, value) {
setState(() { setState(() {
/*for (int i = 0; i < partitions.length; i++) {
if (partitions[i].partition == partition.partition) {
partitions[i].mountpoint = value;
print("moutnpoint: ${partitions[i].mountpoint}");
print("partition: ${partitions[i].partition}");
}
}*/
partition.mountpoint = value; partition.mountpoint = value;
print("moutnpoint: ${partition.mountpoint}"); print("moutnpoint: ${partition.mountpoint}");
print("partition: ${partition.partition}"); print("partition: ${partition.partition}");
}); });
}, },
(partition, value) {
setState(() {
partition.filesystem = value;
print("filesystem: ${partition.filesystem}");
print("partition: ${partition.partition}");
});
},
), ),
), ),
), ),
@ -714,6 +714,7 @@ class _JadeguiState extends State<Jadegui> {
runningSum = true; runningSum = true;
}); });
}, },
partitions,
), ),
), ),
), ),
@ -758,6 +759,8 @@ class _JadeguiState extends State<Jadegui> {
}); });
}, },
writeToLog, writeToLog,
partitions,
manualPartitioning,
), ),
), ),
), ),

Loading…
Cancel
Save