-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds script (nix-sudo) which gets the full path of the nix binaries and runs them with sudo -E. Hopefully this will help devs which use safe paths without the nix store. Signed-off-by: Tiago Castro <[email protected]>
- Loading branch information
1 parent
5374ae7
commit 14967b3
Showing
9 changed files
with
61 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
BIN= | ||
CMD='' | ||
for arg in "$@"; do | ||
arg="${arg//\\/\\\\}" | ||
if [ -n "$BIN" ]; then | ||
CMD="$CMD \"${arg//\"/\\\"}\"" | ||
shift | ||
continue | ||
fi | ||
case $1 in | ||
*=*|-*) | ||
CMD="$CMD \"${arg//\"/\\\"}\"" | ||
shift;; | ||
*) | ||
BIN="$(which "$1")" | ||
CMD="$CMD \"${BIN//\"/\\\"}\"" | ||
shift;; | ||
esac | ||
done | ||
bash -c "sudo -E $CMD" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters