Backport __install_config from Steven

Signed-off-by: Nico Schottelius <nico@feder.schottelius.org>
This commit is contained in:
Nico Schottelius 2017-06-16 07:32:21 +02:00
parent fead1b6010
commit 3693cc9bbb
3 changed files with 13 additions and 24 deletions

View file

@ -25,7 +25,7 @@
# #
log() { log() {
echo "$@" | logger -t "__install_config copy" #echo "$@" | logger -t "__install_config copy"
: :
} }

View file

@ -25,7 +25,7 @@
# #
log() { log() {
echo "$@" | logger -t "__install_config exec" #echo "$@" | logger -t "__install_config exec"
: :
} }
@ -35,7 +35,10 @@ target_host="$__target_host"
shift shift
ssh="ssh -o User=root -q $target_host" ssh="ssh -o User=root -q $target_host"
code="$ssh chroot $chroot sh -c '$@'"
# escape ' with '"'"'
code="$(echo "$@" | sed -e "s/'/'\"'\"'/g")"
code="$ssh chroot $chroot sh -c '$code'"
log "target_host: $target_host" log "target_host: $target_host"
log "chroot: $chroot" log "chroot: $chroot"

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# 2011 Steven Armstrong (steven-cdist at armstrong.cc) # 2011-2017 Steven Armstrong (steven-cdist at armstrong.cc)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -22,29 +22,15 @@ chroot="$(cat "$__object/parameter/chroot")"
remote_exec="$__type/files/remote/exec" remote_exec="$__type/files/remote/exec"
remote_copy="$__type/files/remote/copy" remote_copy="$__type/files/remote/copy"
cdist_args="-v" cdist_args=""
[ "$__debug" = "yes" ] && cdist_args="$cdist_args -d" [ "$__verbose" = "yes" ] && cdist_args="-vv"
[ "$__debug" = "yes" ] && cdist_args="-d"
cat << DONE cat << DONE
#echo "__apt_noautostart --state present" \ cdist config \
# | cdist $cdist_args \ $cdist_args \
# config \
# --initial-manifest - \
# --remote-exec="$remote_exec $chroot" \
# --remote-copy="$remote_copy $chroot" \
# $__target_host
cdist $cdist_args \
config \
--remote-exec="$remote_exec $chroot" \ --remote-exec="$remote_exec $chroot" \
--remote-copy="$remote_copy $chroot" \ --remote-copy="$remote_copy $chroot" \
$__target_host $__target_host
#echo "__apt_noautostart --state absent" \
# | cdist $cdist_args \
# config \
# --initial-manifest - \
# --remote-exec="$remote_exec $chroot" \
# --remote-copy="$remote_copy $chroot" \
# $__target_host
DONE DONE