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 { class Desktop {
String name = ""; final String name;
String displayManager = ""; final String displayManager;
List<String> packages = []; final List<String> packages;
String imageurl = ""; final String imageurl;
Desktop({ const Desktop({
this.name = "", this.name = "",
this.displayManager = "", this.displayManager = "",
this.packages = const [""], 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 { class Location {
String region = ""; final String region;
String location = ""; final String location;
String locale = ""; final String locale;
String image = ""; final String image;
Location({ const Location({
this.region = "", this.region = "",
this.location = "", this.location = "",
this.locale = "", 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 { } 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), 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, nextPage,
setDiskType, setDiskType,
String rotational, String rotational,
bool isEfi,
) { ) {
getDiskType(setDiskType, disk); getDiskType(setDiskType, disk);
return Column( return Column(
@ -242,6 +243,8 @@ Widget summary(
infoTextTemplate("Disk Size", diskSize), infoTextTemplate("Disk Size", diskSize),
const SizedBox(height: 10), const SizedBox(height: 10),
infoTextTemplate("Disk Type", diskType(disk, rotational)), 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/desktop.dart';
import 'package:jade_gui/functions/partition.dart'; import 'package:jade_gui/functions/partition.dart';
import 'package:jade_gui/functions/summary.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/keymap.dart';
import 'package:jade_gui/classes/desktop.dart'; import 'package:jade_gui/classes/desktop.dart';
import 'package:jade_gui/desktops/desktops.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( void main() => runApp(
const MaterialApp( const MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
@ -29,9 +44,9 @@ class _JadeguiState extends State<Jadegui> {
int _selectedIndex = 0; int _selectedIndex = 0;
bool nextpage = false; bool nextpage = false;
bool choseLayout = false; bool choseLayout = false;
Keymap chosenLayout = Keymap();
bool enableSudo = false; bool enableSudo = false;
bool enableRoot = false; bool enableRoot = false;
bool isEfi = false;
String password = ""; String password = "";
String confirmPassword = ""; String confirmPassword = "";
String username = ""; String username = "";
@ -43,6 +58,8 @@ class _JadeguiState extends State<Jadegui> {
String _diskType = ""; String _diskType = "";
Desktop currDesktop = desktops[0]; Desktop currDesktop = desktops[0];
Keymap chosenLayout = Keymap();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -337,25 +354,38 @@ class _JadeguiState extends State<Jadegui> {
); );
break; break;
case 5: case 5:
widget = partitioning(disks, (value) { widget = partitioning(
disks,
(value) {
setState(() { setState(() {
disks = value; disks = value;
}); });
}, (value) { },
(value) {
setState(() { setState(() {
selectedDisk = value; selectedDisk = value;
}); });
}, () { },
() {
setState(() { setState(() {
_selectedIndex = _selectedIndex + 1; _selectedIndex = _selectedIndex + 1;
}); });
}, (value) { },
(value) {
setState(() { setState(() {
partitionInfo = value; partitionInfo = value;
}); });
}, selectedDisk, partitionInfo); },
selectedDisk,
partitionInfo,
);
break; break;
case 6: case 6:
checkIsEfi((value) {
setState(() {
isEfi = value;
});
});
widget = summary( widget = summary(
getChosenLayout(), getChosenLayout(),
getChosenVariant(), getChosenVariant(),
@ -377,16 +407,19 @@ class _JadeguiState extends State<Jadegui> {
}); });
}, },
_diskType, _diskType,
isEfi,
); );
break; break;
case 7: case 7:
widget = const Text( widget = install(
'Showing Installing screen', getChosenLayout(),
style: TextStyle( getChosenVariant(),
fontSize: 18, enableSudo,
fontWeight: FontWeight.bold, enableRoot,
color: Color.fromARGB(255, 169, 0, 255), username,
), selectedDisk,
currDesktop,
getSelectedLocPack(),
); );
break; break;
default: default:

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