better sudo catching
This commit is contained in:
1 parent
853fb23507
commit
0d54c3284a
1 file changed
+11
@@ -11,6 +11,16 @@ su_check() {
|
||||
fi
|
||||
}
|
||||
|
||||
# inverse sudo check because i found a bug last night
|
||||
inv_su_check() {
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo
|
||||
else
|
||||
echo "sysop: don't run this flag as sudo!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
# rebuild
|
||||
@@ -42,6 +52,7 @@ elif [[ $1 == "-d" ]]; then
|
||||
|
||||
# nix-shell
|
||||
elif [[ $1 == "-p" ]]; then
|
||||
inv_su_check
|
||||
nix-shell -p "$2" |& nom
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user