-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmake.dart
More file actions
55 lines (49 loc) · 2.03 KB
/
make.dart
File metadata and controls
55 lines (49 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import 'dart:io';
bool isDir(String path) {
return FileStat.statSync(path).type == FileSystemEntityType.directory;
}
bool fileItemNotFound(String path) {
return FileStat.statSync(path).type == FileSystemEntityType.notFound;
}
void installDependenciesIfNotInstalled(List<String> depNames) async {
for (var i = 0; i < depNames.length; i++) {
if (Platform.isLinux) {
var checkPackageInstalled = await Process.run("dpkg", ["-l", depNames[i]]);
if (checkPackageInstalled.stderr.toString().contains("no packages found")) {
print("Installing ${depNames[i]}...");
await Process.run("sudo", ["apt", "install", depNames[i], "-y"]);
}
}
}
}
void main() async {
// await Process.run("sudo", "apt-get install libsdl2-dev".split(" "));
// await Process.run("sudo", "apt-get install libcairo2-dev".split(" "));
// install dependencies
if (Platform.isLinux) {
installDependenciesIfNotInstalled(["build-essential", "git"]);
installDependenciesIfNotInstalled([
"libasound2-dev","libx11-dev","libxrandr-dev",
"libxi-dev","libgl1-mesa-dev","libglu1-mesa-dev",
"libxcursor-dev","libxinerama-dev","libwayland-dev",
"libxkbcommon-dev"
]);
}
// if OpenSans not installed
if (Platform.isLinux) {
if (fileItemNotFound("/usr/share/fonts/truetype/OpenSans")) {
print("Installing OpenSans...");
// install OpenSans
await Process.run("sudo", "cp ./assets/OpenSans /usr/share/fonts/truetype -r".split(" "));
// update font cache
await Process.run("fc-cache", "-f -v".split(" "));
// check that font is installed
var fontDetails = await Process.run("fc-match", "OpenSans".split(" "));
if (!fontDetails.stdout.toString().contains("OpenSans")) {
print("ERROR: Failed to install OpenSans");
} else {
print("OpenSans installed");
}
}
}
}