|
|
@ -25,30 +25,42 @@ destination="/$__object_id" |
|
|
|
state_should="$(cat "$__object/parameter/state")" |
|
|
|
state_should="$(cat "$__object/parameter/state")" |
|
|
|
exists="$(cat "$__object/explorer/exists")" |
|
|
|
exists="$(cat "$__object/explorer/exists")" |
|
|
|
|
|
|
|
|
|
|
|
if [ "$state_should" = "present" ]; then |
|
|
|
case "$state_should" in |
|
|
|
# No source? Create empty file |
|
|
|
present) |
|
|
|
if [ ! -f "$__object/parameter/source" ]; then |
|
|
|
# No source? Create empty file |
|
|
|
if [ "$exists" = "no" ]; then |
|
|
|
if [ ! -f "$__object/parameter/source" ]; then |
|
|
|
echo touch \"$destination\" |
|
|
|
if [ "$exists" = "no" ]; then |
|
|
|
|
|
|
|
echo touch \"$destination\" |
|
|
|
|
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Mode settings |
|
|
|
# Mode settings |
|
|
|
if [ -f "$__object/parameter/mode" ]; then |
|
|
|
if [ -f "$__object/parameter/mode" ]; then |
|
|
|
echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\" |
|
|
|
echo chmod \"$(cat "$__object/parameter/mode")\" \"$destination\" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Group |
|
|
|
# Group |
|
|
|
if [ -f "$__object/parameter/group" ]; then |
|
|
|
if [ -f "$__object/parameter/group" ]; then |
|
|
|
echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\" |
|
|
|
echo chgrp \"$(cat "$__object/parameter/group")\" \"$destination\" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# Owner |
|
|
|
# Owner |
|
|
|
if [ -f "$__object/parameter/owner" ]; then |
|
|
|
if [ -f "$__object/parameter/owner" ]; then |
|
|
|
echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\" |
|
|
|
echo chown \"$(cat "$__object/parameter/owner")\" \"$destination\" |
|
|
|
fi |
|
|
|
fi |
|
|
|
;; |
|
|
|
elif [ "$state_should" = "absent" ]; then |
|
|
|
|
|
|
|
if [ "$exists" = "yes" ]; then |
|
|
|
absent) |
|
|
|
echo rm -f \"$destination\" |
|
|
|
|
|
|
|
fi |
|
|
|
if [ "$exists" = "yes" ]; then |
|
|
|
fi |
|
|
|
echo rm -f \"$destination\" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*) |
|
|
|
|
|
|
|
echo "Unknown state: $state_should" >&2 |
|
|
|
|
|
|
|
exit 1 |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
esac |
|
|
|