Skip to content

Commit

Permalink
directory resource can do owner, group, mode, using install
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Bombadil committed Oct 6, 2012
1 parent 23e481a commit bb83ca6
Showing 1 changed file with 40 additions and 3 deletions.
43 changes: 40 additions & 3 deletions bin/_poop
@@ -1,15 +1,52 @@
_poop_name=
_poop_resource=
#!/bin/bash

function do_ {
true
}

function directory {
_poop_name="$1"; shift
_poop_resource="directory"
}

function do_directory {
mkdir -p "${_poop_name}"
install -v -d $(install_options)"${_poop_name}"
}

function mode {
_poop_mode="$1"; shift
}

function owner {
_poop_owner="$1"; shift
}

function group {
_poop_group="$1"; shift
}

function end {
eval "do_${_poop_resource}"

_poop_name=
_poop_mode=
_poop_owner=
_poop_group=
}

function install_options {
if [[ -n "$_poop_mode" ]]; then
echo -n "-m $_poop_mode "
fi

if [[ -n "$_poop_owner" ]]; then
echo -n "-o $_poop_owner"
fi

if [[ -n "$_poop_group" ]]; then
echo -n "-g $_poop_group"
fi
}

_poop_resource=
end

0 comments on commit bb83ca6

Please sign in to comment.