finish conf/types/__file/explorers/md5sum

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-02-23 09:32:35 +01:00
parent 0c0209e83b
commit 2e266cfe3a

View file

@ -18,44 +18,20 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
# #
# #
# __file is a very basic type and should be able to be used as an # Retrieve the md5sum of a file to be created, if it is already existing.
# example for typewrites later
# #
################################################################################ ################################################################################
# New code # New code
# #
exit 1 if [ -f parameters/destination ]; then
################################################################################ destination="$(cat parameters/destination)"
# Old code
#
type="$(cat type)"
# If destination was specified, do not use the id
if [ -f destination ]; then
destination="$(cat destination)"
else else
destination="$1" destination="$1"
fi fi
case "$type" in # No output if file does not exist - does definitely not match the md5sum :-)
directory) if [ -e "$destination" ]; then
echo mkdir \"$destination\" md5sum "$destination"
;;
file)
echo touch \"$destination\"
;;
*)
echo "Unsupported type: \"$type\"" >&2
exit 1
;;
esac
if [ -f mode ]; then
mode="$(cat mode)"
echo chmod \"$mode\" \"$destination\"
fi fi