safeguard against running nixos-edit as root
This commit is contained in:
parent
c7cc2323e3
commit
9a4f3a2e74
1 changed files with 6 additions and 0 deletions
|
@ -66,6 +66,12 @@ pkgs.writeShellScriptBin "nixos-edit" ''
|
|||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$(whoami)" = root ] ; then
|
||||
echo "re-executing as tudbut"
|
||||
sleep 2
|
||||
exec sudo -iu tudbut nixos-edit $1 || exit 1
|
||||
fi
|
||||
|
||||
cd /etc/nixos
|
||||
if [ "$1" = "pull" ] ; then
|
||||
git pull
|
||||
|
|
Loading…
Add table
Reference in a new issue