forked from ungleich-public/cdist
Merge remote branch 'nico/master'
This commit is contained in:
commit
a6b88d323e
26 changed files with 1839 additions and 241 deletions
|
|
@ -28,13 +28,56 @@ if grep -q ^DISTRIB_ID=Ubuntu /etc/lsb-release 2>/dev/null; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
[ -f /etc/arch-release ] && echo archlinux
|
||||
if [ -f /etc/arch-release ]; then
|
||||
echo archlinux
|
||||
exit 0
|
||||
fi
|
||||
|
||||
[ -f /etc/debian_version ] && echo debian
|
||||
if [ -f /etc/debian_version ]; then
|
||||
echo debian
|
||||
exit 0
|
||||
fi
|
||||
|
||||
[ -f /etc/gentoo-release ] && echo gentoo
|
||||
if [ -f /etc/gentoo-release ]; then
|
||||
echo gentoo
|
||||
exit 0
|
||||
fi
|
||||
|
||||
[ -f /etc/redhat-release ] && echo redhat
|
||||
if [ -f /etc/redhat-release ]; then
|
||||
echo redhat
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# ensure correct exit, otherwise other explorer won't get started
|
||||
exit 0
|
||||
if [ -f /etc/SuSE-release ]; then
|
||||
echo suse
|
||||
exit 0
|
||||
fi
|
||||
|
||||
uname_s="$(uname -s)"
|
||||
|
||||
# Assume there is no tr on the client -> do lower case ourselves
|
||||
case "$uname_s" in
|
||||
Darwin)
|
||||
echo macosx
|
||||
exit 0
|
||||
;;
|
||||
NetBSD)
|
||||
echo netbsd
|
||||
exit 0
|
||||
;;
|
||||
FreeBSD)
|
||||
echo freebsd
|
||||
exit 0
|
||||
;;
|
||||
OpenBSD)
|
||||
echo openbsd
|
||||
exit 0
|
||||
;;
|
||||
SunOS)
|
||||
echo solaris
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Unknown OS" >&2
|
||||
exit 1
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ __file /etc/cdist-configured --type file
|
|||
case "$__target_host" in
|
||||
# Everybody has this
|
||||
localhost)
|
||||
__issue iddoesnotmatterhere
|
||||
__file test --type file --destination /tmp/cdist-testfile
|
||||
;;
|
||||
|
||||
|
|
@ -29,4 +28,7 @@ case "$__target_host" in
|
|||
__package_apt zsh --state installed
|
||||
__package_apt apache2 --state uninstalled
|
||||
;;
|
||||
kr)
|
||||
__issue iddoesnotmatterhere
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -24,12 +24,24 @@
|
|||
if [ -f "$__object/parameter/destination" ]; then
|
||||
destination="$(cat "$__object/parameter/destination")"
|
||||
else
|
||||
destination="$__object_id"
|
||||
destination="/$__object_id"
|
||||
fi
|
||||
|
||||
os="$(cat $__global/explorer/os)"
|
||||
|
||||
case "$os" in
|
||||
macosx)
|
||||
md5sum="md5"
|
||||
;;
|
||||
|
||||
*)
|
||||
md5sum="md5sum"
|
||||
;;
|
||||
esac
|
||||
|
||||
# No output if file does not exist - does definitely not match the md5sum :-)
|
||||
if [ -e "$destination" ]; then
|
||||
md5sum "$destination"
|
||||
$md5sum < "$destination"
|
||||
else
|
||||
echo "NO FILE NOT FOUND, NO CHECKSUM CALCULATED."
|
||||
echo "NO FILE FOUND, NO CHECKSUM CALCULATED."
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -40,20 +40,26 @@ if ! $(echo "$destination" | grep -q ^/); then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
case "$os" in
|
||||
macosx)
|
||||
md5sum="md5"
|
||||
;;
|
||||
|
||||
*)
|
||||
md5sum="md5sum"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Copy source if existing
|
||||
# FIXME: directory handling not supported - add recursive flag?
|
||||
if [ -f "$__object/parameter/source" ]; then
|
||||
source="$(cat "$__object/parameter/source")"
|
||||
|
||||
exec 3>&1
|
||||
exec 1>&2
|
||||
|
||||
set -x
|
||||
md5sum="$(md5sum "$source")"
|
||||
local_md5sum="$($md5sum < "$source")"
|
||||
remote_md5sum="$(cat "$__object/explorer/md5sum")"
|
||||
|
||||
# Is md5sum the right approach?
|
||||
if [ "$md5sum" != "$remote_md5sum" ]; then
|
||||
if [ "$local_md5sum" != "$remote_md5sum" ]; then
|
||||
# FIXME: This is ugly and hardcoded, replace after 1.0!
|
||||
# Probably a better aproach is to have the user configured
|
||||
# ~/.ssh/config to contain the right username
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue