From 6f11fe505997b65384b0182983cf26f0aefac0b2 Mon Sep 17 00:00:00 2001 From: Liassica <115422798+Liassica@users.noreply.github.com> Date: Sun, 18 Aug 2024 15:42:26 -0500 Subject: [PATCH] feat: add alternative priv escalation https://github.com/thias/glim/pull/123 --- README.md | 2 +- nix/package/default.nix | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 89c019f..523a4d9 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ I've Nixified the upstream glim script, so it should work out of the box on syst Follow the upstream instructions for setting up your USB device. -Then, install glim to your USB by running `nix run github:Liassica/glim-flake`. You can override the theme by adding this repo as a flake input and overriding the 'theme' input. +Then, install glim to your USB by running `nix run github:Liassica/glim-flake`. You can override the theme or by adding this repo as a flake input and overriding the 'theme' input. E.g, to use the Breeze GRUB theme: diff --git a/nix/package/default.nix b/nix/package/default.nix index 2b07850..fb92c57 100644 --- a/nix/package/default.nix +++ b/nix/package/default.nix @@ -18,7 +18,7 @@ writeShellScriptBin "glim" '' grub2_efi rsync ] - }:$PATH + }:''$PATH # Check that we are *NOT* running as root if [[ `id -u` -eq 0 ]]; then @@ -26,6 +26,17 @@ writeShellScriptBin "glim" '' exit 1 fi + # Use alternative if sudo is not found + if [[ ! `which sudo &>/dev/null` ]]; then + if which doas &>/dev/null; then + alias sudo=doas + else + sudo () { + su -c "$*" + } + fi + fi + # Find GLIM device (use the first if multiple found, you've asked for trouble!) USBDEV1=`blkid -L GLIM | head -n 1`