added function to check if user is using uefi or legacy

pull/2/head
axtlos 3 years ago
parent 5aa37a1e5f
commit 35fa6a7e17

@ -1,10 +1,10 @@
class Desktop {
String name = "";
String displayManager = "";
List<String> packages = [];
String imageurl = "";
final String name;
final String displayManager;
final List<String> packages;
final String imageurl;
Desktop({
const Desktop({
this.name = "",
this.displayManager = "",
this.packages = const [""],

@ -0,0 +1,28 @@
import 'package:jade_gui/classes/desktop.dart';
import 'package:jade_gui/classes/location.dart';
class installPrefs {
final Location locale;
final String keymap;
final String layout;
final String username;
final bool enableSudo;
final bool enableRoot;
final Desktop desktop;
final String disk;
installPrefs({
this.locale = const Location(),
this.keymap = "",
this.layout = "",
this.username = "",
this.enableSudo = false,
this.enableRoot = false,
this.desktop = const Desktop(),
this.disk = "",
});
/* Map toJson() => {
}*/
}

@ -1,10 +1,10 @@
class Location {
String region = "";
String location = "";
String locale = "";
String image = "";
final String region;
final String location;
final String locale;
final String image;
Location({
const Location({
this.region = "",
this.location = "",
this.locale = "",

@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import 'package:jade_gui/classes/installPrefs.dart';
import 'package:jade_gui/classes/desktop.dart';
import 'package:jade_gui/classes/location.dart';
Widget install(
String keymap,
String layout,
bool enableSudo,
bool enableRoot,
String username,
String disk,
Desktop currDesktop,
Location locale,
) {
installPrefs prefs = installPrefs(
locale: locale,
keymap: keymap,
layout: layout,
username: username,
enableSudo: enableSudo,
enableRoot: enableRoot,
desktop: currDesktop);
return Column(
children: [
const Text(
'Installing...',
style: TextStyle(
fontSize: 50,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255)),
),
],
);
}

@ -56,7 +56,7 @@ Widget partitionTemplate(partition, setPartition, setPartitionInfo) {
],
);
} else {
return SizedBox(height: 0);
return const SizedBox(height: 0);
}
}
@ -155,7 +155,8 @@ Widget partitioning(partitions, setState, setPartition, next, setPartitionInfo,
),
),
const SizedBox(height: 5),
Image(image: AssetImage('assets/jade_logo.png')),
const Image(
image: AssetImage('assets/jade_logo.png')),
],
),
),

@ -50,6 +50,7 @@ Widget summary(
nextPage,
setDiskType,
String rotational,
bool isEfi,
) {
getDiskType(setDiskType, disk);
return Column(
@ -242,6 +243,8 @@ Widget summary(
infoTextTemplate("Disk Size", diskSize),
const SizedBox(height: 10),
infoTextTemplate("Disk Type", diskType(disk, rotational)),
const SizedBox(height: 10),
infoTextTemplate("Boot Type", isEfi ? "UEFI" : "Legacy")
],
),
),

@ -7,10 +7,25 @@ import 'package:jade_gui/functions/users.dart';
import 'package:jade_gui/functions/desktop.dart';
import 'package:jade_gui/functions/partition.dart';
import 'package:jade_gui/functions/summary.dart';
import 'package:jade_gui/functions/install.dart';
import 'package:jade_gui/classes/keymap.dart';
import 'package:jade_gui/classes/desktop.dart';
import 'package:jade_gui/desktops/desktops.dart';
import 'dart:io';
Future<void> checkIsEfi(setState) async {
final String scriptOutput =
await Process.run("/opt/jade_gui/scripts/checkEfi.sh", [])
.then((ProcessResult result) {
return result.stdout;
});
bool isEfi = scriptOutput == "UEFI" ? false : true;
debugPrint(isEfi.toString());
debugPrint(scriptOutput);
setState(isEfi);
}
void main() => runApp(
const MaterialApp(
debugShowCheckedModeBanner: false,
@ -29,9 +44,9 @@ class _JadeguiState extends State<Jadegui> {
int _selectedIndex = 0;
bool nextpage = false;
bool choseLayout = false;
Keymap chosenLayout = Keymap();
bool enableSudo = false;
bool enableRoot = false;
bool isEfi = false;
String password = "";
String confirmPassword = "";
String username = "";
@ -43,6 +58,8 @@ class _JadeguiState extends State<Jadegui> {
String _diskType = "";
Desktop currDesktop = desktops[0];
Keymap chosenLayout = Keymap();
@override
Widget build(BuildContext context) {
return Scaffold(
@ -337,25 +354,38 @@ class _JadeguiState extends State<Jadegui> {
);
break;
case 5:
widget = partitioning(disks, (value) {
widget = partitioning(
disks,
(value) {
setState(() {
disks = value;
});
}, (value) {
},
(value) {
setState(() {
selectedDisk = value;
});
}, () {
},
() {
setState(() {
_selectedIndex = _selectedIndex + 1;
});
}, (value) {
},
(value) {
setState(() {
partitionInfo = value;
});
}, selectedDisk, partitionInfo);
},
selectedDisk,
partitionInfo,
);
break;
case 6:
checkIsEfi((value) {
setState(() {
isEfi = value;
});
});
widget = summary(
getChosenLayout(),
getChosenVariant(),
@ -377,16 +407,19 @@ class _JadeguiState extends State<Jadegui> {
});
},
_diskType,
isEfi,
);
break;
case 7:
widget = const Text(
'Showing Installing screen',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
widget = install(
getChosenLayout(),
getChosenVariant(),
enableSudo,
enableRoot,
username,
selectedDisk,
currDesktop,
getSelectedLocPack(),
);
break;
default:

@ -0,0 +1,2 @@
#!/usr/bin/bash
[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS
Loading…
Cancel
Save