From 9797b48ff54a5a7b21f8a30ad2c7b0a3b094eccc 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 | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5f7345c..651b9fa 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 d383f45..3f7338f 100644 --- a/nix/package/default.nix +++ b/nix/package/default.nix @@ -12,6 +12,8 @@ let cfg = ../../grub2; in writeShellScriptBin "glim" '' + shopt -s expand_aliases + export PATH=${ lib.makeBinPath [ coreutils-full @@ -20,7 +22,7 @@ writeShellScriptBin "glim" '' rsync util-linux ] - }:$PATH + }:''$PATH # Check that we are *NOT* running as root if [[ `id -u` -eq 0 ]]; then @@ -28,6 +30,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`