Add FreeBSD support

Added support for FreeBSD's mktemp
Fixed typo in generated script with one too many "s
This commit is contained in:
Jake Guffey 2012-09-13 17:17:37 -04:00
parent 1ad176aa63
commit 16ac158c41

View file

@ -18,6 +18,7 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
os="$(cat "$__global/explorer/os")"
user="$(cat "$__object/parameter/user")"
state_should="$(cat "$__object/parameter/state")"
state_is=$(diff -q "$__object/parameter/entry" "$__object/explorer/entry" \
@ -25,14 +26,21 @@ state_is=$(diff -q "$__object/parameter/entry" "$__object/explorer/entry" \
|| echo absent
)
# FreeBSD mktemp doesn't allow execution without at least one param
if [ "$os" = "freebsd" ]; then
mktemp="mktemp -t tmp"
else
mktemp="mktemp"
fi
if [ "$state_is" != "$state_should" ]; then
case "$state_should" in
present)
cat << DONE
tmp=\$(mktemp)
tmp=\$($mktemp)
crontab -u $user -l > \$tmp
cat >> \$tmp << EOC
$(cat "$__object/parameter/entry")"
$(cat "$__object/parameter/entry")
EOC
crontab -u $user \$tmp
rm \$tmp