#!/bin/sh
[ -x /usr/local/sbin/r10k_puppet.sh ] || { echo r10k_puppet.sh not found; exit 255; }
command -v screen >/dev/null 2>&1 || { echo screen not found; exit 255; }
environment=${1?Need environment}
shift
screen -L -S puppet sudo /usr/local/sbin/r10k_puppet.sh --environment="$environment" "$@"
ret=$?
echo "Exited with $ret"
exit $ret
