summaryrefslogtreecommitdiff
path: root/raveos-theme/gnome/theme-data/extensions/installed/customreboot@nova1545/efibootmgr.js
diff options
context:
space:
mode:
authorAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
committerAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
commit70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69 (patch)
treeab1123d4067c1b086dd6faa7ee4ea643236b565a /raveos-theme/gnome/theme-data/extensions/installed/customreboot@nova1545/efibootmgr.js
parent5d94c0a7d44a2255b81815a52a7056a94a39842d (diff)
downloadRaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.tar.gz
RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.zip
Replaced file structures for themes in the correct format
Diffstat (limited to 'raveos-theme/gnome/theme-data/extensions/installed/customreboot@nova1545/efibootmgr.js')
-rw-r--r--raveos-theme/gnome/theme-data/extensions/installed/customreboot@nova1545/efibootmgr.js101
1 files changed, 0 insertions, 101 deletions
diff --git a/raveos-theme/gnome/theme-data/extensions/installed/customreboot@nova1545/efibootmgr.js b/raveos-theme/gnome/theme-data/extensions/installed/customreboot@nova1545/efibootmgr.js
deleted file mode 100644
index f34cec0..0000000
--- a/raveos-theme/gnome/theme-data/extensions/installed/customreboot@nova1545/efibootmgr.js
+++ /dev/null
@@ -1,101 +0,0 @@
-import Gio from "gi://Gio";
-import { ExecCommand, Log, LogWarning } from './utils.js';
-
-/**
- * Represents efibootmgr
- */
-export class EFIBootManager {
- /**
- * Get's all available boot options
- * @returns {[Map, string]} Map(title, id), defaultOption
- */
- static async GetBootOptions() {
- const [status, stdout, stderr] = await ExecCommand(['efibootmgr'],);
- const lines = stdout.split("\n");
-
- let boot_first = "0000";
-
- const boot_options = new Map();
-
- for (let l = 0; l < lines.length; l++) {
- const line = lines[l];
- if (line.startsWith("BootOrder:")) {
- boot_first = line.split(" ")[1].split(",")[0];
- continue;
- }
-
- const regex = /(Boot[0-9]{4})/;
- const vLine = regex.exec(line)
- if (vLine && vLine.length) {
- const option = line.replace("Boot", "").split("*");
- const title = option[1];
- if (title.includes("HD") || title.includes("RC")) {
- const trimed_title = title.replace(/(?<=[\S\s]*)(HD|RC)([\s\S()]*|$)/, "").trim();
- boot_options.set(trimed_title, option[0].trim());
- }
- else {
- boot_options.set(option[1].trim(), option[0].trim());
- }
- }
- }
-
- return [boot_options, boot_first];
- }
-
- /**
- * Set's the next boot option
- * @param {string} id
- * @returns True if the boot option was set, otherwise false
- */
- static async SetBootOption(id) {
- if (!this.IsUseable()) return false;
- const [status, stdout, stderr] = await ExecCommand(['/usr/bin/pkexec', 'efibootmgr', '-n', id],);
- if (status === 0) {
- Log(`Set boot option to ${id}`);
- return true;
- }
- LogWarning("Unable to set boot option using efibootmgr");
- return false;
- }
-
- /**
- * Can we use this bootloader?
- * @returns True if useable otherwise false
- */
- static async IsUseable() {
- return await this.GetBinary() !== "";
- }
-
- /**
- * Get's efibootmgr binary path
- * @returns A string containing the location of the binary, if none is found returns a blank string
- */
- static async GetBinary() {
- let paths = ["/usr/bin/efibootmgr", "/usr/sbin/efibootmgr"];
-
- let file;
-
- for (let i = 0; i < paths.length; i++) {
- file = Gio.file_new_for_path(paths[i]);
- if (file.query_exists(null)) {
- return paths[i];
- }
- }
-
- return "";
- }
-
- /**
- * This boot loader cannot be quick rebooted
- */
- static async CanQuickReboot() {
- return false;
- }
-
- /**
- * This boot loader cannot be quick rebooted
- */
- static async QuickRebootEnabled() {
- return false;
- }
-} \ No newline at end of file