add examples for __remote_{copy,exec} scripts

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-11-03 17:21:14 +01:00
commit 360a03a349
5 changed files with 85 additions and 0 deletions

View file

@ -0,0 +1,35 @@
#!/bin/sh
#
# __remote_exec script to run cdist against a local chroot instead of via ssh
# on a remote target host.
#
# Usage:
# __remote_exec="/path/to/this/script /path/to/your/chroot" cdist config target-id
#
log() {
#echo "$@" | logger -t "cdist-chroot-exec"
:
}
chroot="$1"; shift
target_host="$1"; shift
script=$(mktemp "${chroot}/tmp/chroot-${0##*/}.XXXXXXXXXX")
trap cleanup INT TERM EXIT
cleanup() {
[ $__cdist_debug ] || rm "$script"
}
log "$script"
log "$@"
echo "#!/bin/sh -l" > "$script"
echo "$@" >> "$script"
chmod +x "$script"
relative_script="${script#$chroot}"
log "relative_script: $relative_script"
# run in chroot
chroot "$chroot" "$relative_script"
log "-----"