Skip to content

Commit

Permalink
feat: add alternative priv escalation
Browse files Browse the repository at this point in the history
  • Loading branch information
Liassica committed Aug 18, 2024
1 parent 2bc4c69 commit 9797b48
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
15 changes: 14 additions & 1 deletion nix/package/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ let
cfg = ../../grub2;
in
writeShellScriptBin "glim" ''
shopt -s expand_aliases
export PATH=${
lib.makeBinPath [
coreutils-full
Expand All @@ -20,14 +22,25 @@ writeShellScriptBin "glim" ''
rsync
util-linux
]
}:$PATH
}:''$PATH
# Check that we are *NOT* running as root
if [[ `id -u` -eq 0 ]]; then
echo "ERROR: Don't run as root, use a user with full sudo access."
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`
Expand Down

0 comments on commit 9797b48

Please sign in to comment.