Merge branch 'master' into only_once
This commit is contained in:
commit
ddc1724ae0
4 changed files with 66 additions and 23 deletions
34
conf/type/__file/explorer/exists
Executable file
34
conf/type/__file/explorer/exists
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
|
||||||
|
#
|
||||||
|
# This file is part of cdist.
|
||||||
|
#
|
||||||
|
# cdist is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# cdist is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Check whether file exists or not
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ -f "$__object/parameter/destination" ]; then
|
||||||
|
destination="$(cat "$__object/parameter/destination")"
|
||||||
|
else
|
||||||
|
destination="/$__object_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "$destination" ]; then
|
||||||
|
echo yes
|
||||||
|
else
|
||||||
|
echo no
|
||||||
|
fi
|
|
@ -41,7 +41,11 @@ esac
|
||||||
|
|
||||||
# No output if file does not exist - does definitely not match the md5sum :-)
|
# No output if file does not exist - does definitely not match the md5sum :-)
|
||||||
if [ -e "$destination" ]; then
|
if [ -e "$destination" ]; then
|
||||||
|
if [ -f "$destination" ]; then
|
||||||
$md5sum < "$destination"
|
$md5sum < "$destination"
|
||||||
|
else
|
||||||
|
echo "NO REGULAR FILE"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "NO FILE FOUND, NO CHECKSUM CALCULATED."
|
echo "NO FILE FOUND, NO CHECKSUM CALCULATED."
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -55,6 +55,7 @@ esac
|
||||||
if [ -f "$__object/parameter/source" ]; then
|
if [ -f "$__object/parameter/source" ]; then
|
||||||
source="$(cat "$__object/parameter/source")"
|
source="$(cat "$__object/parameter/source")"
|
||||||
|
|
||||||
|
if [ -f "$source" ]; then
|
||||||
local_md5sum="$($md5sum < "$source")"
|
local_md5sum="$($md5sum < "$source")"
|
||||||
remote_md5sum="$(cat "$__object/explorer/md5sum")"
|
remote_md5sum="$(cat "$__object/explorer/md5sum")"
|
||||||
|
|
||||||
|
@ -66,8 +67,11 @@ if [ -f "$__object/parameter/source" ]; then
|
||||||
# Probably describe it in cdist-quickstart...
|
# Probably describe it in cdist-quickstart...
|
||||||
scp "$source" "root@${__target_host}:${destination}"
|
scp "$source" "root@${__target_host}:${destination}"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
# No source? Create empty file/dir
|
# No source? Create empty file/dir
|
||||||
else
|
else
|
||||||
|
# Only touch / create if it does not exist
|
||||||
|
if [ no = "$(cat "$__object/explorer/exists")" ]; then
|
||||||
case "$type" in
|
case "$type" in
|
||||||
directory)
|
directory)
|
||||||
echo mkdir \"$destination\"
|
echo mkdir \"$destination\"
|
||||||
|
@ -83,6 +87,7 @@ else
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f "$__object/parameter/mode" ]; then
|
if [ -f "$__object/parameter/mode" ]; then
|
||||||
mode="$(cat "$__object/parameters/mode")"
|
mode="$(cat "$__object/parameters/mode")"
|
||||||
|
|
|
@ -29,7 +29,7 @@ fi
|
||||||
|
|
||||||
state="$(cat "$__object/parameter/state")"
|
state="$(cat "$__object/parameter/state")"
|
||||||
|
|
||||||
is_installed="$(grep "^Status: install ok installed" "$__object/explorer/pkg_status")"
|
is_installed="$(grep "^Status: install ok installed" "$__object/explorer/pkg_status" || true)"
|
||||||
|
|
||||||
case "$state" in
|
case "$state" in
|
||||||
installed)
|
installed)
|
||||||
|
|
Loading…
Reference in a new issue