Removes question marks from functions and update minor bash bugs

This commit is contained in:
Bruno Tavares 2015-05-23 23:39:39 -03:00
parent eb501d3b93
commit 421148456f
8 changed files with 31 additions and 31 deletions

View File

@ -1,15 +1,15 @@
# kickstart.debugging?
# kickstart.debugging
Returns 0 if you are debugging, and 1 if not
### Example
```bash
$ kickstart.debugging? || echo nope
$ kickstart.debugging || echo nope
nope
$ set -x; kickstart.debugging? && echo yup; set +x;
+ kickstart.debugging?
$ set -x; kickstart.debugging && echo yup; set +x;
+ kickstart.debugging
+ grep xtrace
+ kickstart.stream.contains on
+ grep -q on

View File

@ -1,16 +0,0 @@
# kickstart.user.homeFolder user
Looks up the `user` home folder on the `/etc/passwd` file.
### Example
```bash
$ kickstart.user.homeFolder vagrant
/home/vagrant
$ kickstart.user.homeFolder root
/root
$ kickstart.user.homeFolder no-user-existing
```

View File

@ -0,0 +1,16 @@
# kickstart.user.home_folder user
Looks up the `user` home folder on the `/etc/passwd` file.
### Example
```bash
$ kickstart.user.home_folder vagrant
/home/vagrant
$ kickstart.user.home_folder root
/root
$ kickstart.user.home_folder no-user-existing
```

View File

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

View File

@ -8,16 +8,16 @@ kickstart.context() {
kickstart_context="$*"
}
kickstart.debugging?() {
kickstart.debugging() {
set -o | grep xtrace | kickstart.stream.contains on
}
kickstart.mute() {
kickstart.info "Running \"$*\""
if kickstart.debugging?; then
"$*"
if kickstart.debugging; then
"$@"
else
"$*" >/dev/null 2>&1
"$@" >/dev/null 2>&1
fi
return $?
}

View File

@ -6,7 +6,7 @@ kickstart.os() {
}
kickstart.os.is() {
[[ $(kickstart.os) == "$1" ]]
[[ "$(kickstart.os)" == "$1" ]]
}
kickstart.os.codename() {

View File

@ -1,9 +1,9 @@
kickstart.user.exists?() {
kickstart.user.exists() {
kickstart.mute id "$1"
}
kickstart.user.create() {
kickstart.user.exists? "$1" || ( useradd -m -s /bin/bash -U -p "$(openssl passwd -1 "$2")" "$1" )
kickstart.user.exists "$1" || ( useradd -m -s /bin/bash -U -p "$(openssl passwd -1 "$2")" "$1" )
}
kickstart.user.is_on_group() {
@ -22,7 +22,7 @@ kickstart.user.remove_group() {
usermod -G "$(kickstart.print_with_separator , "${groups[*]}")" "$1"
}
kickstart.user.homeFolder() {
kickstart.user.home_folder() {
grep ^"$1" /etc/passwd | cut -d: -f 6
}
@ -57,6 +57,6 @@ kickstart.user.exec() {
sudo -H -u "$user" bash -c "$command"
}
kickstart.user.root?() {
kickstart.user.is_root() {
[ "$(whoami)" == root ]
}