forked from ungleich-public/cdist
rephrase if..elif..else to case..esac
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
parent
f1273aa7a1
commit
8320327956
1 changed files with 35 additions and 23 deletions
|
@ -25,7 +25,8 @@ 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
|
||||||
|
present)
|
||||||
# No source? Create empty file
|
# No source? Create empty file
|
||||||
if [ ! -f "$__object/parameter/source" ]; then
|
if [ ! -f "$__object/parameter/source" ]; then
|
||||||
if [ "$exists" = "no" ]; then
|
if [ "$exists" = "no" ]; then
|
||||||
|
@ -47,8 +48,19 @@ if [ "$state_should" = "present" ]; then
|
||||||
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
|
;;
|
||||||
|
|
||||||
|
absent)
|
||||||
|
|
||||||
if [ "$exists" = "yes" ]; then
|
if [ "$exists" = "yes" ]; then
|
||||||
echo rm -f \"$destination\"
|
echo rm -f \"$destination\"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Unknown state: $state_should" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
Loading…
Reference in a new issue