Add kickstart.user.root?

This commit is contained in:
Bruno Tavares 2014-03-19 19:55:14 -03:00
parent 5bdabf6556
commit 9ee05e6933
3 changed files with 18 additions and 0 deletions

View File

@ -43,3 +43,4 @@
* [kickstart.user.exec](kickstart/user/exec)
* [kickstart.user.is_on_group](kickstart/user/is_on_group)
* [kickstart.user.remove_group](kickstart/user/remove_group)
* [kickstart.user.root?](kickstart/user/root?)

View File

@ -0,0 +1,13 @@
# kickstart.user.root?
Return 0 if the user running is root and 1 if not.
### Example
```bash
$ whoami
root
$ kickstart.user.root? && echo yup
yup
```

View File

@ -47,3 +47,7 @@ kickstart.user.exec() {
kickstart.info Running \'"$@"\' as $user
su $user - bash -c "$command"
}
kickstart.user.root?() {
[ `whoami` == root ]
}