Skip to content

Commit 9797b48

Browse files
committed
feat: add alternative priv escalation
thias#123
1 parent 2bc4c69 commit 9797b48

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
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

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

0 commit comments

Comments
 (0)