Support --data-file instead of passing JSON as arguments

This is required for systemd-run, which limits the process
argument length and makes the data get truncated

https://github.com/coreos/fleet/issues/992
This commit is contained in:
Johannes
2016-11-01 18:12:41 +01:00
parent 50cbae420c
commit 4f6f5bf3b7

View File

@@ -23,14 +23,16 @@ chmod +x /home/yellowtent/provision.sh
arg_source_tarball_url=""
arg_data=""
arg_data_file=""
args=$(getopt -o "" -l "sourcetarballurl:,data:" -n "$0" -- "$@")
args=$(getopt -o "" -l "sourcetarballurl:,data:,data-file:" -n "$0" -- "$@")
eval set -- "${args}"
while true; do
case "$1" in
--sourcetarballurl) arg_source_tarball_url="$2";;
--data) arg_data="$2";;
--data-file) arg_data_file="$2";;
--) break;;
*) echo "Unknown option $1"; exit 1;;
esac
@@ -38,6 +40,10 @@ while true; do
shift 2
done
if [[ ! -z ${arg_data_file} ]]; then
arg_data=$(cat "${arg_data_file}")
fi
box_src_tmp_dir=$(mktemp -dt box-src-XXXXXX)
echo "Downloading box code from ${arg_source_tarball_url} to ${box_src_tmp_dir}"