Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
directory resource can do owner, group, mode, using install
- Loading branch information
Tom Bombadil
committed
Oct 6, 2012
1 parent
23e481a
commit bb83ca6
Showing
1 changed file
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |