Skip to content

Commit 73a3915

Browse files
committed
feat: add alternative priv escalation
thias#123
1 parent c34f93a commit 73a3915

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ I've Nixified the upstream glim script, so it should work out of the box on syst
1010

1111
Follow the upstream instructions for setting up your USB device.
1212

13-
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.
13+
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.
1414

1515
E.g, to use the Breeze GRUB theme:
1616

nix/package/default.nix

+14-1
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,34 @@ let
1111
cfg = ../../grub2;
1212
in
1313
writeShellScriptBin "glim" ''
14+
shopt -s expand_aliases
15+
1416
export PATH=${
1517
lib.makeBinPath [
1618
util-linux
1719
coreutils-full
1820
grub2_efi
1921
rsync
2022
]
21-
}:$PATH
23+
}:''$PATH
2224
2325
# Check that we are *NOT* running as root
2426
if [[ `id -u` -eq 0 ]]; then
2527
echo "ERROR: Don't run as root, use a user with full sudo access."
2628
exit 1
2729
fi
2830
31+
# Use alternative if sudo is not found
32+
if [[ ! `which sudo &>/dev/null` ]]; then
33+
if which doas &>/dev/null; then
34+
alias sudo=doas
35+
else
36+
sudo () {
37+
su -c "$*"
38+
}
39+
fi
40+
fi
41+
2942
# Find GLIM device (use the first if multiple found, you've asked for trouble!)
3043
USBDEV1=`blkid -L GLIM | head -n 1`
3144

0 commit comments

Comments
 (0)